react-native-reanimated 3.0.2 → 3.1.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/Common/cpp/Fabric/FabricUtils.h +1 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
- package/Common/cpp/SharedItems/Shareables.h +22 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
- package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
- package/RNReanimated.podspec +5 -2
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +18 -10
- package/android/src/main/cpp/NativeProxy.cpp +316 -337
- package/android/src/main/cpp/NativeProxy.h +53 -11
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
- package/ios/REANodesManager.h +1 -0
- package/ios/REANodesManager.mm +30 -4
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.mm +4 -1
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.mm +1 -1
- package/ios/native/REAInitializer.mm +1 -1
- package/ios/native/REAMessageThread.mm +2 -2
- package/lib/commonjs/Animated.js +0 -8
- package/lib/commonjs/Animated.js.map +1 -1
- package/lib/commonjs/ConfigHelper.js +8 -19
- package/lib/commonjs/ConfigHelper.js.map +1 -1
- package/lib/commonjs/createAnimatedComponent.js +20 -158
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/index.js +0 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +0 -7
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/reanimated2/Bezier.js +14 -34
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +60 -132
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/Easing.js +81 -34
- package/lib/commonjs/reanimated2/Easing.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
- package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/decay.js +7 -18
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -11
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/index.js +0 -8
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/spring.js +11 -23
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/timing.js +0 -11
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +11 -41
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +16 -23
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Image.js +0 -4
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
- package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Text.js +0 -4
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
- package/lib/commonjs/reanimated2/component/View.js +0 -4
- package/lib/commonjs/reanimated2/component/View.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +6 -48
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +3 -14
- package/lib/commonjs/reanimated2/errors.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -12
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +8 -39
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +0 -26
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +21 -43
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolation.js +14 -29
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +11 -44
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +26 -32
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +5 -15
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +2 -28
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/shareables.js +92 -49
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +42 -46
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +0 -5
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +6 -21
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/commonjs/setAndForwardRef.js +3 -3
- package/lib/commonjs/setAndForwardRef.js.map +1 -1
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +9 -15
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +20 -139
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js +14 -33
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +59 -109
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +37 -33
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeMethods.js +8 -15
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +12 -10
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js +3 -5
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/decay.js +7 -15
- package/lib/module/reanimated2/animation/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -9
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +6 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +3 -18
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +11 -21
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +0 -8
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +10 -33
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +12 -19
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +0 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -22
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +3 -13
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +3 -3
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/Hooks.js +3 -2
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +8 -21
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +23 -37
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +5 -34
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +13 -28
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +11 -35
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +2 -6
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +3 -9
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +26 -25
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +5 -15
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -19
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +96 -44
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +39 -33
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +0 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +6 -19
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/setAndForwardRef.js +3 -2
- package/lib/module/setAndForwardRef.js.map +1 -1
- package/package.json +46 -40
- package/plugin/.eslintrc.js +7 -0
- package/plugin/README.md +241 -0
- package/plugin/build/plugin.js +714 -0
- package/plugin/build/plugin.js.map +7 -0
- package/plugin/index.js +1 -807
- package/plugin/package.json +23 -0
- package/plugin/src/buildWorkletString.ts +213 -0
- package/plugin/src/commonObjects.ts +60 -0
- package/plugin/src/injectVersion.ts +37 -0
- package/plugin/src/makeWorklet.ts +375 -0
- package/plugin/src/plugin.ts +49 -0
- package/plugin/src/processForCalleesWorklets.ts +106 -0
- package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
- package/plugin/src/processIfWorkletFunction.ts +55 -0
- package/plugin/src/processIfWorkletNode.ts +44 -0
- package/plugin/src/processInlineStylesWarning.ts +129 -0
- package/plugin/src/processWorkletObjectMethod.ts +31 -0
- package/plugin/src/types.ts +15 -0
- package/plugin/src/utils.ts +6 -0
- package/plugin/tsconfig.json +15 -0
- package/plugin/yarn.lock +2193 -0
- package/react-native-reanimated.d.ts +1 -0
- package/scripts/reanimated_utils.rb +2 -2
- package/src/createAnimatedComponent.tsx +2 -3
- package/src/reanimated2/Easing.ts +19 -0
- package/src/reanimated2/NativeMethods.ts +9 -4
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
- package/src/reanimated2/UpdateProps.ts +2 -2
- package/src/reanimated2/animation/decay.ts +7 -1
- package/src/reanimated2/animation/styleAnimation.ts +5 -1
- package/src/reanimated2/core.ts +4 -4
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
- package/src/reanimated2/globals.d.ts +71 -112
- package/src/reanimated2/hook/commonTypes.ts +1 -1
- package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
- package/src/reanimated2/initializers.ts +11 -8
- package/src/reanimated2/jestUtils.ts +0 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
- package/src/reanimated2/js-reanimated/index.ts +1 -1
- package/src/reanimated2/mappers.ts +26 -4
- package/src/reanimated2/mock.ts +1 -0
- package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
- package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
- package/src/reanimated2/shareables.ts +107 -8
- package/src/reanimated2/threads.ts +36 -17
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// lib/commonObjects.js
|
|
8
|
+
var require_commonObjects = __commonJS({
|
|
9
|
+
"lib/commonObjects.js"(exports2) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12
|
+
exports2.globals = void 0;
|
|
13
|
+
exports2.globals = /* @__PURE__ */ new Set([
|
|
14
|
+
"this",
|
|
15
|
+
"console",
|
|
16
|
+
"performance",
|
|
17
|
+
"Date",
|
|
18
|
+
"Array",
|
|
19
|
+
"ArrayBuffer",
|
|
20
|
+
"Int8Array",
|
|
21
|
+
"Int16Array",
|
|
22
|
+
"Int32Array",
|
|
23
|
+
"Uint8Array",
|
|
24
|
+
"Uint8ClampedArray",
|
|
25
|
+
"Uint16Array",
|
|
26
|
+
"Uint32Array",
|
|
27
|
+
"Float32Array",
|
|
28
|
+
"Float64Array",
|
|
29
|
+
"HermesInternal",
|
|
30
|
+
"JSON",
|
|
31
|
+
"Math",
|
|
32
|
+
"Number",
|
|
33
|
+
"Object",
|
|
34
|
+
"String",
|
|
35
|
+
"Symbol",
|
|
36
|
+
"undefined",
|
|
37
|
+
"null",
|
|
38
|
+
"UIManager",
|
|
39
|
+
"requestAnimationFrame",
|
|
40
|
+
"setImmediate",
|
|
41
|
+
"queueMicrotask",
|
|
42
|
+
"_WORKLET",
|
|
43
|
+
"arguments",
|
|
44
|
+
"Boolean",
|
|
45
|
+
"parseInt",
|
|
46
|
+
"parseFloat",
|
|
47
|
+
"Map",
|
|
48
|
+
"WeakMap",
|
|
49
|
+
"Proxy",
|
|
50
|
+
"WeakRef",
|
|
51
|
+
"Set",
|
|
52
|
+
"_log",
|
|
53
|
+
"_scheduleOnJS",
|
|
54
|
+
"_makeShareableClone",
|
|
55
|
+
"_updateDataSynchronously",
|
|
56
|
+
"eval",
|
|
57
|
+
"_updatePropsPaper",
|
|
58
|
+
"_updatePropsFabric",
|
|
59
|
+
"_removeShadowNodeFromRegistry",
|
|
60
|
+
"RegExp",
|
|
61
|
+
"Error",
|
|
62
|
+
"__ErrorUtils",
|
|
63
|
+
"global",
|
|
64
|
+
"_measure",
|
|
65
|
+
"_scrollTo",
|
|
66
|
+
"_dispatchCommand",
|
|
67
|
+
"_setGestureState",
|
|
68
|
+
"isNaN",
|
|
69
|
+
"LayoutAnimationRepository",
|
|
70
|
+
"_notifyAboutProgress",
|
|
71
|
+
"_notifyAboutEnd"
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// lib/utils.js
|
|
77
|
+
var require_utils = __commonJS({
|
|
78
|
+
"lib/utils.js"(exports2) {
|
|
79
|
+
"use strict";
|
|
80
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81
|
+
exports2.isRelease = void 0;
|
|
82
|
+
function isRelease() {
|
|
83
|
+
return process.env.BABEL_ENV && ["production", "release"].includes(process.env.BABEL_ENV);
|
|
84
|
+
}
|
|
85
|
+
exports2.isRelease = isRelease;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// lib/buildWorkletString.js
|
|
90
|
+
var require_buildWorkletString = __commonJS({
|
|
91
|
+
"lib/buildWorkletString.js"(exports2) {
|
|
92
|
+
"use strict";
|
|
93
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
94
|
+
if (k2 === void 0)
|
|
95
|
+
k2 = k;
|
|
96
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
97
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
98
|
+
desc = { enumerable: true, get: function() {
|
|
99
|
+
return m[k];
|
|
100
|
+
} };
|
|
101
|
+
}
|
|
102
|
+
Object.defineProperty(o, k2, desc);
|
|
103
|
+
} : function(o, m, k, k2) {
|
|
104
|
+
if (k2 === void 0)
|
|
105
|
+
k2 = k;
|
|
106
|
+
o[k2] = m[k];
|
|
107
|
+
});
|
|
108
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
109
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
110
|
+
} : function(o, v) {
|
|
111
|
+
o["default"] = v;
|
|
112
|
+
});
|
|
113
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
114
|
+
if (mod && mod.__esModule)
|
|
115
|
+
return mod;
|
|
116
|
+
var result = {};
|
|
117
|
+
if (mod != null) {
|
|
118
|
+
for (var k in mod)
|
|
119
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
120
|
+
__createBinding(result, mod, k);
|
|
121
|
+
}
|
|
122
|
+
__setModuleDefault(result, mod);
|
|
123
|
+
return result;
|
|
124
|
+
};
|
|
125
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
126
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
127
|
+
};
|
|
128
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
129
|
+
exports2.buildWorkletString = void 0;
|
|
130
|
+
var core_1 = require("@babel/core");
|
|
131
|
+
var generator_1 = __importDefault(require("@babel/generator"));
|
|
132
|
+
var types_1 = require("@babel/types");
|
|
133
|
+
var fs = __importStar(require("fs"));
|
|
134
|
+
var convertSourceMap = __importStar(require("convert-source-map"));
|
|
135
|
+
var assert_1 = require("assert");
|
|
136
|
+
var utils_1 = require_utils();
|
|
137
|
+
function buildWorkletString(fun, closureVariables, name, inputMap) {
|
|
138
|
+
const draftExpression = fun.program.body.find((obj) => (0, types_1.isFunctionDeclaration)(obj)) || fun.program.body.find((obj) => (0, types_1.isExpressionStatement)(obj)) || void 0;
|
|
139
|
+
(0, assert_1.strict)(draftExpression, "'draftExpression' is undefined");
|
|
140
|
+
const expression = (0, types_1.isFunctionDeclaration)(draftExpression) ? draftExpression : draftExpression.expression;
|
|
141
|
+
(0, assert_1.strict)("params" in expression, "'params' property is undefined in 'expression'");
|
|
142
|
+
(0, assert_1.strict)((0, types_1.isBlockStatement)(expression.body), "'expression.body' is not a 'BlockStatement'");
|
|
143
|
+
const workletFunction = (0, types_1.functionExpression)((0, types_1.identifier)(name), expression.params, expression.body);
|
|
144
|
+
const code = (0, generator_1.default)(workletFunction).code;
|
|
145
|
+
(0, assert_1.strict)(inputMap, "'inputMap' is undefined");
|
|
146
|
+
const includeSourceMap = shouldGenerateSourceMap();
|
|
147
|
+
if (includeSourceMap) {
|
|
148
|
+
inputMap.sourcesContent = [];
|
|
149
|
+
for (const sourceFile of inputMap.sources) {
|
|
150
|
+
inputMap.sourcesContent.push(fs.readFileSync(sourceFile).toString("utf-8"));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const transformed = (0, core_1.transformSync)(code, {
|
|
154
|
+
plugins: [prependClosureVariablesIfNecessary(closureVariables)],
|
|
155
|
+
compact: !includeSourceMap,
|
|
156
|
+
sourceMaps: includeSourceMap,
|
|
157
|
+
inputSourceMap: inputMap,
|
|
158
|
+
ast: false,
|
|
159
|
+
babelrc: false,
|
|
160
|
+
configFile: false,
|
|
161
|
+
comments: false
|
|
162
|
+
});
|
|
163
|
+
(0, assert_1.strict)(transformed, "'transformed' is null");
|
|
164
|
+
let sourceMap;
|
|
165
|
+
if (includeSourceMap) {
|
|
166
|
+
sourceMap = convertSourceMap.fromObject(transformed.map).toObject();
|
|
167
|
+
delete sourceMap.sourcesContent;
|
|
168
|
+
}
|
|
169
|
+
return [transformed.code, JSON.stringify(sourceMap)];
|
|
170
|
+
}
|
|
171
|
+
exports2.buildWorkletString = buildWorkletString;
|
|
172
|
+
function shouldGenerateSourceMap() {
|
|
173
|
+
if ((0, utils_1.isRelease)()) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (process.env.REANIMATED_JEST_DISABLE_SOURCEMAP === "jest") {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
function prependClosure(path, closureVariables, closureDeclaration) {
|
|
182
|
+
if (closureVariables.length === 0 || !(0, types_1.isProgram)(path.parent)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!(0, types_1.isExpression)(path.node.body)) {
|
|
186
|
+
path.node.body.body.unshift(closureDeclaration);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function prependRecursiveDeclaration(path) {
|
|
190
|
+
var _a;
|
|
191
|
+
if ((0, types_1.isProgram)(path.parent) && !(0, types_1.isArrowFunctionExpression)(path.node) && !(0, types_1.isObjectMethod)(path.node) && path.node.id && path.scope.parent) {
|
|
192
|
+
const hasRecursiveCalls = ((_a = path.scope.parent.bindings[path.node.id.name]) === null || _a === void 0 ? void 0 : _a.references) > 0;
|
|
193
|
+
if (hasRecursiveCalls) {
|
|
194
|
+
path.node.body.body.unshift((0, types_1.variableDeclaration)("const", [
|
|
195
|
+
(0, types_1.variableDeclarator)((0, types_1.identifier)(path.node.id.name), (0, types_1.memberExpression)((0, types_1.thisExpression)(), (0, types_1.identifier)("_recur")))
|
|
196
|
+
]));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function prependClosureVariablesIfNecessary(closureVariables) {
|
|
201
|
+
const closureDeclaration = (0, types_1.variableDeclaration)("const", [
|
|
202
|
+
(0, types_1.variableDeclarator)((0, types_1.objectPattern)(closureVariables.map((variable) => (0, types_1.objectProperty)((0, types_1.identifier)(variable.name), (0, types_1.identifier)(variable.name), false, true))), (0, types_1.memberExpression)((0, types_1.thisExpression)(), (0, types_1.identifier)("_closure")))
|
|
203
|
+
]);
|
|
204
|
+
return {
|
|
205
|
+
visitor: {
|
|
206
|
+
"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod": (path) => {
|
|
207
|
+
prependClosure(path, closureVariables, closureDeclaration);
|
|
208
|
+
prependRecursiveDeclaration(path);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// lib/makeWorklet.js
|
|
217
|
+
var require_makeWorklet = __commonJS({
|
|
218
|
+
"lib/makeWorklet.js"(exports2) {
|
|
219
|
+
"use strict";
|
|
220
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
221
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
222
|
+
};
|
|
223
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
224
|
+
exports2.makeWorklet = void 0;
|
|
225
|
+
var core_1 = require("@babel/core");
|
|
226
|
+
var generator_1 = __importDefault(require("@babel/generator"));
|
|
227
|
+
var types_1 = require("@babel/types");
|
|
228
|
+
var utils_1 = require_utils();
|
|
229
|
+
var assert_1 = require("assert");
|
|
230
|
+
var commonObjects_12 = require_commonObjects();
|
|
231
|
+
var path_1 = require("path");
|
|
232
|
+
var buildWorkletString_1 = require_buildWorkletString();
|
|
233
|
+
var version = require("../../package.json").version;
|
|
234
|
+
function makeWorklet(fun, state) {
|
|
235
|
+
const functionName = makeWorkletName(fun);
|
|
236
|
+
fun.traverse({
|
|
237
|
+
DirectiveLiteral(path) {
|
|
238
|
+
if (path.node.value === "worklet" && path.getFunctionParent() === fun) {
|
|
239
|
+
path.parentPath.remove();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
(0, assert_1.strict)(state.file.opts.filename, "'state.file.opts.filename' is undefined");
|
|
244
|
+
const codeObject = (0, generator_1.default)(fun.node, {
|
|
245
|
+
sourceMaps: true,
|
|
246
|
+
sourceFileName: state.file.opts.filename
|
|
247
|
+
});
|
|
248
|
+
codeObject.code = "(" + ((0, types_1.isObjectMethod)(fun) ? "function " : "") + codeObject.code + "\n)";
|
|
249
|
+
const transformed = (0, core_1.transformSync)(codeObject.code, {
|
|
250
|
+
filename: state.file.opts.filename,
|
|
251
|
+
presets: ["@babel/preset-typescript"],
|
|
252
|
+
plugins: [
|
|
253
|
+
"@babel/plugin-transform-shorthand-properties",
|
|
254
|
+
"@babel/plugin-transform-arrow-functions",
|
|
255
|
+
"@babel/plugin-proposal-optional-chaining",
|
|
256
|
+
"@babel/plugin-proposal-nullish-coalescing-operator",
|
|
257
|
+
["@babel/plugin-transform-template-literals", { loose: true }]
|
|
258
|
+
],
|
|
259
|
+
ast: true,
|
|
260
|
+
babelrc: false,
|
|
261
|
+
configFile: false,
|
|
262
|
+
inputSourceMap: codeObject.map
|
|
263
|
+
});
|
|
264
|
+
(0, assert_1.strict)(transformed, "'transformed' is undefined");
|
|
265
|
+
(0, assert_1.strict)(transformed.ast, "'transformed.ast' is undefined");
|
|
266
|
+
const variables = makeArrayFromCapturedBindings(transformed.ast, fun);
|
|
267
|
+
const privateFunctionId = (0, types_1.identifier)("_f");
|
|
268
|
+
const clone = (0, types_1.cloneNode)(fun.node);
|
|
269
|
+
const funExpression = (0, types_1.isBlockStatement)(clone.body) ? (0, types_1.functionExpression)(null, clone.params, clone.body) : clone;
|
|
270
|
+
const [funString, sourceMapString] = (0, buildWorkletString_1.buildWorkletString)(transformed.ast, variables, functionName, transformed.map);
|
|
271
|
+
(0, assert_1.strict)(funString, "'funString' is undefined");
|
|
272
|
+
const workletHash = hash(funString);
|
|
273
|
+
let location = state.file.opts.filename;
|
|
274
|
+
if (state.opts.relativeSourceLocation) {
|
|
275
|
+
location = (0, path_1.relative)(state.cwd, location);
|
|
276
|
+
}
|
|
277
|
+
let lineOffset = 1;
|
|
278
|
+
if (variables.length > 0) {
|
|
279
|
+
lineOffset -= variables.length + 2;
|
|
280
|
+
}
|
|
281
|
+
const pathForStringDefinitions = fun.parentPath.isProgram() ? fun : fun.findParent((path) => (0, types_1.isProgram)(path.parentPath));
|
|
282
|
+
(0, assert_1.strict)(pathForStringDefinitions, "'pathForStringDefinitions' is null");
|
|
283
|
+
(0, assert_1.strict)(pathForStringDefinitions.parentPath, "'pathForStringDefinitions.parentPath' is null");
|
|
284
|
+
const initDataId = pathForStringDefinitions.parentPath.scope.generateUidIdentifier(`worklet_${workletHash}_init_data`);
|
|
285
|
+
const initDataObjectExpression = (0, types_1.objectExpression)([
|
|
286
|
+
(0, types_1.objectProperty)((0, types_1.identifier)("code"), (0, types_1.stringLiteral)(funString)),
|
|
287
|
+
(0, types_1.objectProperty)((0, types_1.identifier)("location"), (0, types_1.stringLiteral)(location))
|
|
288
|
+
]);
|
|
289
|
+
if (sourceMapString) {
|
|
290
|
+
initDataObjectExpression.properties.push((0, types_1.objectProperty)((0, types_1.identifier)("sourceMap"), (0, types_1.stringLiteral)(sourceMapString)));
|
|
291
|
+
}
|
|
292
|
+
pathForStringDefinitions.insertBefore((0, types_1.variableDeclaration)("const", [
|
|
293
|
+
(0, types_1.variableDeclarator)(initDataId, initDataObjectExpression)
|
|
294
|
+
]));
|
|
295
|
+
(0, assert_1.strict)(!(0, types_1.isFunctionDeclaration)(funExpression), "'funExpression' is a 'FunctionDeclaration'");
|
|
296
|
+
(0, assert_1.strict)(!(0, types_1.isObjectMethod)(funExpression), "'funExpression' is an 'ObjectMethod'");
|
|
297
|
+
const statements = [
|
|
298
|
+
(0, types_1.variableDeclaration)("const", [
|
|
299
|
+
(0, types_1.variableDeclarator)(privateFunctionId, funExpression)
|
|
300
|
+
]),
|
|
301
|
+
(0, types_1.expressionStatement)((0, types_1.assignmentExpression)("=", (0, types_1.memberExpression)(privateFunctionId, (0, types_1.identifier)("_closure"), false), (0, types_1.objectExpression)(variables.map((variable) => (0, types_1.objectProperty)((0, types_1.identifier)(variable.name), variable, false, true))))),
|
|
302
|
+
(0, types_1.expressionStatement)((0, types_1.assignmentExpression)("=", (0, types_1.memberExpression)(privateFunctionId, (0, types_1.identifier)("__initData"), false), initDataId)),
|
|
303
|
+
(0, types_1.expressionStatement)((0, types_1.assignmentExpression)("=", (0, types_1.memberExpression)(privateFunctionId, (0, types_1.identifier)("__workletHash"), false), (0, types_1.numericLiteral)(workletHash)))
|
|
304
|
+
];
|
|
305
|
+
if (!(0, utils_1.isRelease)()) {
|
|
306
|
+
statements.unshift((0, types_1.variableDeclaration)("const", [
|
|
307
|
+
(0, types_1.variableDeclarator)((0, types_1.identifier)("_e"), (0, types_1.arrayExpression)([
|
|
308
|
+
(0, types_1.newExpression)((0, types_1.memberExpression)((0, types_1.identifier)("global"), (0, types_1.identifier)("Error")), []),
|
|
309
|
+
(0, types_1.numericLiteral)(lineOffset),
|
|
310
|
+
(0, types_1.numericLiteral)(-27)
|
|
311
|
+
]))
|
|
312
|
+
]));
|
|
313
|
+
statements.push((0, types_1.expressionStatement)((0, types_1.assignmentExpression)("=", (0, types_1.memberExpression)(privateFunctionId, (0, types_1.identifier)("__stackDetails"), false), (0, types_1.identifier)("_e"))));
|
|
314
|
+
if (shouldInjectVersion()) {
|
|
315
|
+
statements.push((0, types_1.expressionStatement)((0, types_1.assignmentExpression)("=", (0, types_1.memberExpression)(privateFunctionId, (0, types_1.identifier)("__version"), false), (0, types_1.stringLiteral)(version))));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
statements.push((0, types_1.returnStatement)(privateFunctionId));
|
|
319
|
+
const newFun = (0, types_1.functionExpression)(void 0, [], (0, types_1.blockStatement)(statements));
|
|
320
|
+
return newFun;
|
|
321
|
+
}
|
|
322
|
+
exports2.makeWorklet = makeWorklet;
|
|
323
|
+
function shouldInjectVersion() {
|
|
324
|
+
if ((0, utils_1.isRelease)()) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (process.env.REANIMATED_JEST_DISABLE_VERSION === "jest") {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
function hash(str) {
|
|
333
|
+
let i = str.length;
|
|
334
|
+
let hash1 = 5381;
|
|
335
|
+
let hash2 = 52711;
|
|
336
|
+
while (i--) {
|
|
337
|
+
const char = str.charCodeAt(i);
|
|
338
|
+
hash1 = hash1 * 33 ^ char;
|
|
339
|
+
hash2 = hash2 * 33 ^ char;
|
|
340
|
+
}
|
|
341
|
+
return (hash1 >>> 0) * 4096 + (hash2 >>> 0);
|
|
342
|
+
}
|
|
343
|
+
function makeWorkletName(fun) {
|
|
344
|
+
if ((0, types_1.isObjectMethod)(fun.node) && "name" in fun.node.key) {
|
|
345
|
+
return fun.node.key.name;
|
|
346
|
+
}
|
|
347
|
+
if ((0, types_1.isFunctionDeclaration)(fun.node) && fun.node.id) {
|
|
348
|
+
return fun.node.id.name;
|
|
349
|
+
}
|
|
350
|
+
if ((0, types_1.isFunctionExpression)(fun.node) && (0, types_1.isIdentifier)(fun.node.id)) {
|
|
351
|
+
return fun.node.id.name;
|
|
352
|
+
}
|
|
353
|
+
return "anonymous";
|
|
354
|
+
}
|
|
355
|
+
function makeArrayFromCapturedBindings(ast, fun) {
|
|
356
|
+
const closure = /* @__PURE__ */ new Map();
|
|
357
|
+
(0, core_1.traverse)(ast, {
|
|
358
|
+
Identifier(path) {
|
|
359
|
+
if (!path.isReferencedIdentifier()) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const name = path.node.name;
|
|
363
|
+
if (commonObjects_12.globals.has(name)) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if ("id" in fun.node && fun.node.id && fun.node.id.name === name) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const parentNode = path.parent;
|
|
370
|
+
if ((0, types_1.isMemberExpression)(parentNode) && parentNode.property === path.node && !parentNode.computed) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if ((0, types_1.isObjectProperty)(parentNode) && (0, types_1.isObjectExpression)(path.parentPath.parent) && path.node !== parentNode.value) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
let currentScope = path.scope;
|
|
377
|
+
while (currentScope != null) {
|
|
378
|
+
if (currentScope.bindings[name] != null) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
currentScope = currentScope.parent;
|
|
382
|
+
}
|
|
383
|
+
closure.set(name, path.node);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
return Array.from(closure.values());
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// lib/processWorkletObjectMethod.js
|
|
392
|
+
var require_processWorkletObjectMethod = __commonJS({
|
|
393
|
+
"lib/processWorkletObjectMethod.js"(exports2) {
|
|
394
|
+
"use strict";
|
|
395
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
396
|
+
exports2.processWorkletObjectMethod = void 0;
|
|
397
|
+
var types_1 = require("@babel/types");
|
|
398
|
+
var makeWorklet_1 = require_makeWorklet();
|
|
399
|
+
function processWorkletObjectMethod(path, state) {
|
|
400
|
+
if (!(0, types_1.isFunctionParent)(path)) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const newFun = (0, makeWorklet_1.makeWorklet)(path, state);
|
|
404
|
+
const replacement = (0, types_1.objectProperty)((0, types_1.identifier)((0, types_1.isIdentifier)(path.node.key) ? path.node.key.name : ""), (0, types_1.callExpression)(newFun, []));
|
|
405
|
+
path.replaceWith(replacement);
|
|
406
|
+
}
|
|
407
|
+
exports2.processWorkletObjectMethod = processWorkletObjectMethod;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
// lib/processIfWorkletFunction.js
|
|
412
|
+
var require_processIfWorkletFunction = __commonJS({
|
|
413
|
+
"lib/processIfWorkletFunction.js"(exports2) {
|
|
414
|
+
"use strict";
|
|
415
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
416
|
+
exports2.processIfWorkletFunction = void 0;
|
|
417
|
+
var types_1 = require("@babel/types");
|
|
418
|
+
var makeWorklet_1 = require_makeWorklet();
|
|
419
|
+
function processIfWorkletFunction(path, state) {
|
|
420
|
+
if (path.isFunctionDeclaration() || path.isFunctionExpression() || path.isArrowFunctionExpression()) {
|
|
421
|
+
processWorkletFunction(path, state);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
exports2.processIfWorkletFunction = processIfWorkletFunction;
|
|
425
|
+
function processWorkletFunction(path, state) {
|
|
426
|
+
const newFun = (0, makeWorklet_1.makeWorklet)(path, state);
|
|
427
|
+
const replacement = (0, types_1.callExpression)(newFun, []);
|
|
428
|
+
const needDeclaration = (0, types_1.isScopable)(path.parent) || (0, types_1.isExportNamedDeclaration)(path.parent);
|
|
429
|
+
path.replaceWith("id" in path.node && path.node.id && needDeclaration ? (0, types_1.variableDeclaration)("const", [
|
|
430
|
+
(0, types_1.variableDeclarator)(path.node.id, replacement)
|
|
431
|
+
]) : replacement);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// lib/processForCalleesWorklets.js
|
|
437
|
+
var require_processForCalleesWorklets = __commonJS({
|
|
438
|
+
"lib/processForCalleesWorklets.js"(exports2) {
|
|
439
|
+
"use strict";
|
|
440
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
441
|
+
exports2.processForCalleesWorklets = void 0;
|
|
442
|
+
var types_1 = require("@babel/types");
|
|
443
|
+
var processWorkletObjectMethod_1 = require_processWorkletObjectMethod();
|
|
444
|
+
var processIfWorkletFunction_1 = require_processIfWorkletFunction();
|
|
445
|
+
var assert_1 = require("assert");
|
|
446
|
+
var functionArgsToWorkletize = /* @__PURE__ */ new Map([
|
|
447
|
+
["useFrameCallback", [0]],
|
|
448
|
+
["useAnimatedStyle", [0]],
|
|
449
|
+
["useAnimatedProps", [0]],
|
|
450
|
+
["createAnimatedPropAdapter", [0]],
|
|
451
|
+
["useDerivedValue", [0]],
|
|
452
|
+
["useAnimatedScrollHandler", [0]],
|
|
453
|
+
["useAnimatedReaction", [0, 1]],
|
|
454
|
+
["useWorkletCallback", [0]],
|
|
455
|
+
["withTiming", [2]],
|
|
456
|
+
["withSpring", [2]],
|
|
457
|
+
["withDecay", [1]],
|
|
458
|
+
["withRepeat", [3]]
|
|
459
|
+
]);
|
|
460
|
+
var objectHooks = /* @__PURE__ */ new Set([
|
|
461
|
+
"useAnimatedGestureHandler",
|
|
462
|
+
"useAnimatedScrollHandler"
|
|
463
|
+
]);
|
|
464
|
+
function processForCalleesWorklets(path, state) {
|
|
465
|
+
const callee = (0, types_1.isSequenceExpression)(path.node.callee) ? path.node.callee.expressions[path.node.callee.expressions.length - 1] : path.node.callee;
|
|
466
|
+
const name = "name" in callee ? callee.name : "property" in callee && "name" in callee.property ? callee.property.name : void 0;
|
|
467
|
+
if (name === void 0) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (objectHooks.has(name)) {
|
|
471
|
+
const workletToProcess = path.get("arguments.0");
|
|
472
|
+
(0, assert_1.strict)(!Array.isArray(workletToProcess), "'workletToProcess' is an array'");
|
|
473
|
+
if (workletToProcess.isObjectExpression()) {
|
|
474
|
+
processObjectHook(workletToProcess, state);
|
|
475
|
+
} else if (name === "useAnimatedScrollHandler") {
|
|
476
|
+
(0, processIfWorkletFunction_1.processIfWorkletFunction)(workletToProcess, state);
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
const indices = functionArgsToWorkletize.get(name);
|
|
480
|
+
if (indices === void 0) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
processArguments(path, indices, state);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
exports2.processForCalleesWorklets = processForCalleesWorklets;
|
|
487
|
+
function processObjectHook(path, state) {
|
|
488
|
+
const properties = path.get("properties");
|
|
489
|
+
for (const property of properties) {
|
|
490
|
+
if (property.isObjectMethod()) {
|
|
491
|
+
(0, processWorkletObjectMethod_1.processWorkletObjectMethod)(property, state);
|
|
492
|
+
} else if (property.isObjectProperty()) {
|
|
493
|
+
const value = property.get("value");
|
|
494
|
+
(0, assert_1.strict)(!Array.isArray(value), "'value' is an array'");
|
|
495
|
+
(0, processIfWorkletFunction_1.processIfWorkletFunction)(value, state);
|
|
496
|
+
} else {
|
|
497
|
+
throw new Error(`'${property.type}' as to-be workletized arguments is not supported for object hooks`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function processArguments(path, indices, state) {
|
|
502
|
+
const argumentsArray = path.get("arguments");
|
|
503
|
+
indices.forEach((index) => {
|
|
504
|
+
const argumentToWorkletize = argumentsArray[index];
|
|
505
|
+
if (!argumentToWorkletize) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
(0, processIfWorkletFunction_1.processIfWorkletFunction)(argumentToWorkletize, state);
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// lib/processIfWorkletNode.js
|
|
515
|
+
var require_processIfWorkletNode = __commonJS({
|
|
516
|
+
"lib/processIfWorkletNode.js"(exports2) {
|
|
517
|
+
"use strict";
|
|
518
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
519
|
+
exports2.processIfWorkletNode = void 0;
|
|
520
|
+
var types_1 = require("@babel/types");
|
|
521
|
+
var processIfWorkletFunction_1 = require_processIfWorkletFunction();
|
|
522
|
+
function processIfWorkletNode(fun, state) {
|
|
523
|
+
fun.traverse({
|
|
524
|
+
DirectiveLiteral(path) {
|
|
525
|
+
const value = path.node.value;
|
|
526
|
+
if (value === "worklet" && path.getFunctionParent() === fun && (0, types_1.isBlockStatement)(fun.node.body)) {
|
|
527
|
+
const directives = fun.node.body.directives;
|
|
528
|
+
if (directives && directives.length > 0 && directives.some((directive) => (0, types_1.isDirectiveLiteral)(directive.value) && directive.value.value === "worklet")) {
|
|
529
|
+
(0, processIfWorkletFunction_1.processIfWorkletFunction)(fun, state);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
exports2.processIfWorkletNode = processIfWorkletNode;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// lib/processIfGestureHandlerEventCallbackFunctionNode.js
|
|
540
|
+
var require_processIfGestureHandlerEventCallbackFunctionNode = __commonJS({
|
|
541
|
+
"lib/processIfGestureHandlerEventCallbackFunctionNode.js"(exports2) {
|
|
542
|
+
"use strict";
|
|
543
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
544
|
+
exports2.processIfGestureHandlerEventCallbackFunctionNode = void 0;
|
|
545
|
+
var types_1 = require("@babel/types");
|
|
546
|
+
var processIfWorkletFunction_1 = require_processIfWorkletFunction();
|
|
547
|
+
var gestureHandlerGestureObjects = /* @__PURE__ */ new Set([
|
|
548
|
+
"Tap",
|
|
549
|
+
"Pan",
|
|
550
|
+
"Pinch",
|
|
551
|
+
"Rotation",
|
|
552
|
+
"Fling",
|
|
553
|
+
"LongPress",
|
|
554
|
+
"ForceTouch",
|
|
555
|
+
"Native",
|
|
556
|
+
"Manual",
|
|
557
|
+
"Race",
|
|
558
|
+
"Simultaneous",
|
|
559
|
+
"Exclusive"
|
|
560
|
+
]);
|
|
561
|
+
var gestureHandlerBuilderMethods = /* @__PURE__ */ new Set([
|
|
562
|
+
"onBegin",
|
|
563
|
+
"onStart",
|
|
564
|
+
"onEnd",
|
|
565
|
+
"onFinalize",
|
|
566
|
+
"onUpdate",
|
|
567
|
+
"onChange",
|
|
568
|
+
"onTouchesDown",
|
|
569
|
+
"onTouchesMove",
|
|
570
|
+
"onTouchesUp",
|
|
571
|
+
"onTouchesCancelled"
|
|
572
|
+
]);
|
|
573
|
+
function processIfGestureHandlerEventCallbackFunctionNode(path, state) {
|
|
574
|
+
if ((0, types_1.isCallExpression)(path.parent) && (0, types_1.isExpression)(path.parent.callee) && isGestureObjectEventCallbackMethod(path.parent.callee)) {
|
|
575
|
+
(0, processIfWorkletFunction_1.processIfWorkletFunction)(path, state);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
exports2.processIfGestureHandlerEventCallbackFunctionNode = processIfGestureHandlerEventCallbackFunctionNode;
|
|
579
|
+
function isGestureObjectEventCallbackMethod(exp) {
|
|
580
|
+
return (0, types_1.isMemberExpression)(exp) && (0, types_1.isIdentifier)(exp.property) && gestureHandlerBuilderMethods.has(exp.property.name) && containsGestureObject(exp.object);
|
|
581
|
+
}
|
|
582
|
+
function containsGestureObject(exp) {
|
|
583
|
+
if (isGestureObject(exp)) {
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
if ((0, types_1.isCallExpression)(exp) && (0, types_1.isMemberExpression)(exp.callee) && containsGestureObject(exp.callee.object)) {
|
|
587
|
+
return true;
|
|
588
|
+
}
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
function isGestureObject(exp) {
|
|
592
|
+
return (0, types_1.isCallExpression)(exp) && (0, types_1.isMemberExpression)(exp.callee) && (0, types_1.isIdentifier)(exp.callee.object) && exp.callee.object.name === "Gesture" && (0, types_1.isIdentifier)(exp.callee.property) && gestureHandlerGestureObjects.has(exp.callee.property.name);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// lib/processInlineStylesWarning.js
|
|
598
|
+
var require_processInlineStylesWarning = __commonJS({
|
|
599
|
+
"lib/processInlineStylesWarning.js"(exports2) {
|
|
600
|
+
"use strict";
|
|
601
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
602
|
+
exports2.processInlineStylesWarning = void 0;
|
|
603
|
+
var types_1 = require("@babel/types");
|
|
604
|
+
var utils_1 = require_utils();
|
|
605
|
+
var assert_1 = require("assert");
|
|
606
|
+
function generateInlineStylesWarning(path) {
|
|
607
|
+
return (0, types_1.callExpression)((0, types_1.arrowFunctionExpression)([], (0, types_1.blockStatement)([
|
|
608
|
+
(0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)("console"), (0, types_1.identifier)("warn")), [
|
|
609
|
+
(0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.callExpression)((0, types_1.identifier)("require"), [
|
|
610
|
+
(0, types_1.stringLiteral)("react-native-reanimated")
|
|
611
|
+
]), (0, types_1.identifier)("getUseOfValueInStyleWarning")), [])
|
|
612
|
+
])),
|
|
613
|
+
(0, types_1.returnStatement)(path.node)
|
|
614
|
+
])), []);
|
|
615
|
+
}
|
|
616
|
+
function processPropertyValueForInlineStylesWarning(path) {
|
|
617
|
+
if (path.isMemberExpression() && (0, types_1.isIdentifier)(path.node.property)) {
|
|
618
|
+
if (path.node.property.name === "value") {
|
|
619
|
+
path.replaceWith(generateInlineStylesWarning(path));
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function processTransformPropertyForInlineStylesWarning(path) {
|
|
624
|
+
if ((0, types_1.isArrayExpression)(path.node)) {
|
|
625
|
+
const elements = path.get("elements");
|
|
626
|
+
(0, assert_1.strict)(Array.isArray(elements), "'elements' should be an array");
|
|
627
|
+
for (const element of elements) {
|
|
628
|
+
if (element.isObjectExpression()) {
|
|
629
|
+
processStyleObjectForInlineStylesWarning(element);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function processStyleObjectForInlineStylesWarning(path) {
|
|
635
|
+
const properties = path.get("properties");
|
|
636
|
+
for (const property of properties) {
|
|
637
|
+
if (property.isObjectProperty()) {
|
|
638
|
+
const value = property.get("value");
|
|
639
|
+
if ((0, types_1.isIdentifier)(property.node.key) && property.node.key.name === "transform") {
|
|
640
|
+
processTransformPropertyForInlineStylesWarning(value);
|
|
641
|
+
} else {
|
|
642
|
+
processPropertyValueForInlineStylesWarning(value);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function processInlineStylesWarning(path, state) {
|
|
648
|
+
if ((0, utils_1.isRelease)()) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
if (state.opts.disableInlineStylesWarning) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (path.node.name.name !== "style") {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (!(0, types_1.isJSXExpressionContainer)(path.node.value)) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const expression = path.get("value").get("expression");
|
|
661
|
+
(0, assert_1.strict)(!Array.isArray(expression), "'expression' should not be an array");
|
|
662
|
+
if (expression.isArrayExpression()) {
|
|
663
|
+
const elements = expression.get("elements");
|
|
664
|
+
(0, assert_1.strict)(Array.isArray(elements), "'elements' should be an array");
|
|
665
|
+
for (const element of elements) {
|
|
666
|
+
if (element.isObjectExpression()) {
|
|
667
|
+
processStyleObjectForInlineStylesWarning(element);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
} else if (expression.isObjectExpression()) {
|
|
671
|
+
processStyleObjectForInlineStylesWarning(expression);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
exports2.processInlineStylesWarning = processInlineStylesWarning;
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// lib/plugin.js
|
|
679
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
680
|
+
var commonObjects_1 = require_commonObjects();
|
|
681
|
+
var processForCalleesWorklets_1 = require_processForCalleesWorklets();
|
|
682
|
+
var processIfWorkletNode_1 = require_processIfWorkletNode();
|
|
683
|
+
var processIfGestureHandlerEventCallbackFunctionNode_1 = require_processIfGestureHandlerEventCallbackFunctionNode();
|
|
684
|
+
var processInlineStylesWarning_1 = require_processInlineStylesWarning();
|
|
685
|
+
module.exports = function() {
|
|
686
|
+
return {
|
|
687
|
+
pre() {
|
|
688
|
+
if (this.opts != null && Array.isArray(this.opts.globals)) {
|
|
689
|
+
this.opts.globals.forEach((name) => {
|
|
690
|
+
commonObjects_1.globals.add(name);
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
visitor: {
|
|
695
|
+
CallExpression: {
|
|
696
|
+
enter(path, state) {
|
|
697
|
+
(0, processForCalleesWorklets_1.processForCalleesWorklets)(path, state);
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression": {
|
|
701
|
+
enter(path, state) {
|
|
702
|
+
(0, processIfWorkletNode_1.processIfWorkletNode)(path, state);
|
|
703
|
+
(0, processIfGestureHandlerEventCallbackFunctionNode_1.processIfGestureHandlerEventCallbackFunctionNode)(path, state);
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
JSXAttribute: {
|
|
707
|
+
enter(path, state) {
|
|
708
|
+
(0, processInlineStylesWarning_1.processInlineStylesWarning)(path, state);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
//# sourceMappingURL=plugin.js.map
|