@amazon-devices/react-native-worklets 1.0.0-rn-83
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/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +71 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +712 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +88 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +89 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +80 -0
- package/Common/cpp/worklets/Public/AsyncQueue.h +14 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +51 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +40 -0
- package/Common/cpp/worklets/Resources/SynchronizableUnpacker.cpp +49 -0
- package/Common/cpp/worklets/Resources/Unpackers.h +6 -0
- package/Common/cpp/worklets/Resources/ValueUnpacker.cpp +53 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +62 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +46 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.cpp +112 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
- package/Common/cpp/worklets/SharedItems/Serializable.cpp +545 -0
- package/Common/cpp/worklets/SharedItems/Serializable.h +473 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +67 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.h +59 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +81 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
- package/Common/cpp/worklets/Tools/Defs.h +10 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.cpp +15 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
- package/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -0
- package/Common/cpp/worklets/Tools/JSISerializer.h +51 -0
- package/Common/cpp/worklets/Tools/JSLogger.cpp +68 -0
- package/Common/cpp/worklets/Tools/JSLogger.h +37 -0
- package/Common/cpp/worklets/Tools/JSScheduler.cpp +24 -0
- package/Common/cpp/worklets/Tools/JSScheduler.h +39 -0
- package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
- package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +82 -0
- package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
- package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
- package/Common/cpp/worklets/Tools/UIScheduler.h +26 -0
- package/Common/cpp/worklets/Tools/VersionUtils.cpp +75 -0
- package/Common/cpp/worklets/Tools/VersionUtils.h +28 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +46 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +208 -0
- package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +161 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +54 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.h +20 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +38 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +21 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeData.cpp +3 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +12 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeKind.h +16 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +105 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +63 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +23 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +16 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +119 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +134 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +244 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +102 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +308 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +26 -0
- package/LICENSE +7 -0
- package/README.md +31 -0
- package/RNWorklets.podspec +94 -0
- package/SystemBundles/cc12deac6e91c435b76698c8445aed85612f2f88e733218d14f88a35d06fb0f4.bundle +10512 -0
- package/SystemBundles/cc12deac6e91c435b76698c8445aed85612f2f88e733218d14f88a35d06fb0f4.map +3771 -0
- package/SystemModules/amzn__react-native-worklets-1.modules.txt +39 -0
- package/SystemModules/amzn__react-native-worklets-1.private.modules.txt +61 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/android/CMakeLists.txt +124 -0
- package/android/build.gradle +350 -0
- package/android/gradle.properties +5 -0
- package/android/proguard-rules.pro +3 -0
- package/android/spotless.gradle +9 -0
- package/android/src/experimentalBundling/com/swmansion/worklets/WorkletsModule.java +149 -0
- package/android/src/legacyBundling/com/swmansion/worklets/WorkletsModule.java +122 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +63 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +43 -0
- package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +34 -0
- package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +29 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +115 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.h +78 -0
- package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +13 -0
- package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.java +60 -0
- package/android/src/main/java/com/swmansion/worklets/JSCallInvokerResolver.java +27 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThread.java +16 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThreadBase.java +73 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.java +48 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.java +19 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.java +113 -0
- package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
- package/apple/worklets/apple/AnimationFrameQueue.mm +135 -0
- package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
- package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +16 -0
- package/apple/worklets/apple/IOSUIScheduler.h +15 -0
- package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
- package/apple/worklets/apple/PlatformLogger.mm +31 -0
- package/apple/worklets/apple/SlowAnimations.h +8 -0
- package/apple/worklets/apple/SlowAnimations.mm +45 -0
- package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
- package/apple/worklets/apple/WorkletsMessageThread.h +16 -0
- package/apple/worklets/apple/WorkletsMessageThread.mm +31 -0
- package/apple/worklets/apple/WorkletsModule.h +28 -0
- package/apple/worklets/apple/WorkletsModule.mm +121 -0
- package/bundleMode/index.d.ts +3 -0
- package/bundleMode/index.js +59 -0
- package/compatibility.json +11 -0
- package/kepler-compatibility.json +5 -0
- package/kepler-transformed-package-info.json +3 -0
- package/lib/module/PlatformChecker/PlatformChecker.js +8 -0
- package/lib/module/PlatformChecker/PlatformChecker.js.map +1 -0
- package/lib/module/PlatformChecker/index.js +18 -0
- package/lib/module/PlatformChecker/index.js.map +1 -0
- package/lib/module/WorkletsError.js +29 -0
- package/lib/module/WorkletsError.js.map +1 -0
- package/lib/module/WorkletsModule/JSWorklets.js +111 -0
- package/lib/module/WorkletsModule/JSWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/NativeWorklets.js +126 -0
- package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/index.js +4 -0
- package/lib/module/WorkletsModule/index.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.js +7 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.web.js +5 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.web.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
- package/lib/module/bundleUnpacker.js +47 -0
- package/lib/module/bundleUnpacker.js.map +1 -0
- package/lib/module/callGuard.js +30 -0
- package/lib/module/callGuard.js.map +1 -0
- package/lib/module/deprecated.js +20 -0
- package/lib/module/deprecated.js.map +1 -0
- package/lib/module/errors.js +69 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/featureFlags/index.js +48 -0
- package/lib/module/featureFlags/index.js.map +1 -0
- package/lib/module/featureFlags/staticFlags.json +4 -0
- package/lib/module/index.js +26 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initializers.js +221 -0
- package/lib/module/initializers.js.map +1 -0
- package/lib/module/isSynchronizable.js +6 -0
- package/lib/module/isSynchronizable.js.map +1 -0
- package/lib/module/logger.js +15 -0
- package/lib/module/logger.js.map +1 -0
- package/lib/module/privateGlobals.d.js +7 -0
- package/lib/module/privateGlobals.d.js.map +1 -0
- package/lib/module/publicGlobals.js +6 -0
- package/lib/module/publicGlobals.js.map +1 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +52 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/index.js +19 -0
- package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
- package/lib/module/runtimeKind.js +39 -0
- package/lib/module/runtimeKind.js.map +1 -0
- package/lib/module/runtimes.js +100 -0
- package/lib/module/runtimes.js.map +1 -0
- package/lib/module/serializable.js +568 -0
- package/lib/module/serializable.js.map +1 -0
- package/lib/module/serializableMappingCache.js +37 -0
- package/lib/module/serializableMappingCache.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.js +5 -0
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.kepler.js +7 -0
- package/lib/module/specs/NativeWorkletsModule.kepler.js.map +1 -0
- package/lib/module/specs/index.js +10 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/synchronizable.js +9 -0
- package/lib/module/synchronizable.js.map +1 -0
- package/lib/module/synchronizableUnpacker.js +42 -0
- package/lib/module/synchronizableUnpacker.js.map +1 -0
- package/lib/module/threads.js +347 -0
- package/lib/module/threads.js.map +1 -0
- package/lib/module/utils/checkCppVersion.js +30 -0
- package/lib/module/utils/checkCppVersion.js.map +1 -0
- package/lib/module/utils/jsVersion.js +9 -0
- package/lib/module/utils/jsVersion.js.map +1 -0
- package/lib/module/valueUnpacker.js +60 -0
- package/lib/module/valueUnpacker.js.map +1 -0
- package/lib/module/workletFunction.js +37 -0
- package/lib/module/workletFunction.js.map +1 -0
- package/lib/module/workletRuntimeEntry.js +32 -0
- package/lib/module/workletRuntimeEntry.js.map +1 -0
- package/lib/module/workletTypes.js +12 -0
- package/lib/module/workletTypes.js.map +1 -0
- package/lib/typescript/PlatformChecker/PlatformChecker.d.ts +5 -0
- package/lib/typescript/PlatformChecker/PlatformChecker.d.ts.map +1 -0
- package/lib/typescript/PlatformChecker/index.d.ts +10 -0
- package/lib/typescript/PlatformChecker/index.d.ts.map +1 -0
- package/lib/typescript/WorkletsError.d.ts +15 -0
- package/lib/typescript/WorkletsError.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/JSWorklets.d.ts +3 -0
- package/lib/typescript/WorkletsModule/JSWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/index.d.ts +3 -0
- package/lib/typescript/WorkletsModule/index.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts +2 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts +2 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +37 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
- package/lib/typescript/bundleUnpacker.d.ts +7 -0
- package/lib/typescript/bundleUnpacker.d.ts.map +1 -0
- package/lib/typescript/callGuard.d.ts +4 -0
- package/lib/typescript/callGuard.d.ts.map +1 -0
- package/lib/typescript/deprecated.d.ts +20 -0
- package/lib/typescript/deprecated.d.ts.map +1 -0
- package/lib/typescript/errors.d.ts +16 -0
- package/lib/typescript/errors.d.ts.map +1 -0
- package/lib/typescript/featureFlags/index.d.ts +23 -0
- package/lib/typescript/featureFlags/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +17 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers.d.ts +17 -0
- package/lib/typescript/initializers.d.ts.map +1 -0
- package/lib/typescript/isSynchronizable.d.ts +3 -0
- package/lib/typescript/isSynchronizable.d.ts.map +1 -0
- package/lib/typescript/logger.d.ts +5 -0
- package/lib/typescript/logger.d.ts.map +1 -0
- package/lib/typescript/publicGlobals.d.ts +31 -0
- package/lib/typescript/publicGlobals.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
- package/lib/typescript/runtimeKind.d.ts +25 -0
- package/lib/typescript/runtimeKind.d.ts.map +1 -0
- package/lib/typescript/runtimes.d.ts +77 -0
- package/lib/typescript/runtimes.d.ts.map +1 -0
- package/lib/typescript/serializable.d.ts +20 -0
- package/lib/typescript/serializable.d.ts.map +1 -0
- package/lib/typescript/serializableMappingCache.d.ts +16 -0
- package/lib/typescript/serializableMappingCache.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +7 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.kepler.d.ts +7 -0
- package/lib/typescript/specs/NativeWorkletsModule.kepler.d.ts.map +1 -0
- package/lib/typescript/specs/index.d.ts +3 -0
- package/lib/typescript/specs/index.d.ts.map +1 -0
- package/lib/typescript/synchronizable.d.ts +15 -0
- package/lib/typescript/synchronizable.d.ts.map +1 -0
- package/lib/typescript/synchronizableUnpacker.d.ts +4 -0
- package/lib/typescript/synchronizableUnpacker.d.ts.map +1 -0
- package/lib/typescript/threads.d.ts +138 -0
- package/lib/typescript/threads.d.ts.map +1 -0
- package/lib/typescript/utils/checkCppVersion.d.ts +3 -0
- package/lib/typescript/utils/checkCppVersion.d.ts.map +1 -0
- package/lib/typescript/utils/jsVersion.d.ts +7 -0
- package/lib/typescript/utils/jsVersion.d.ts.map +1 -0
- package/lib/typescript/valueUnpacker.d.ts +6 -0
- package/lib/typescript/valueUnpacker.d.ts.map +1 -0
- package/lib/typescript/workletFunction.d.ts +27 -0
- package/lib/typescript/workletFunction.d.ts.map +1 -0
- package/lib/typescript/workletRuntimeEntry.d.ts +14 -0
- package/lib/typescript/workletRuntimeEntry.d.ts.map +1 -0
- package/lib/typescript/workletTypes.d.ts +61 -0
- package/lib/typescript/workletTypes.d.ts.map +1 -0
- package/package.json +153 -0
- package/plugin/index.js +1761 -0
- package/react-native.config.js +21 -0
- package/scripts/validate-react-native-version.js +43 -0
- package/scripts/worklets_utils.rb +94 -0
- package/src/PlatformChecker/PlatformChecker.ts +7 -0
- package/src/PlatformChecker/index.ts +30 -0
- package/src/WorkletsError.ts +36 -0
- package/src/WorkletsModule/JSWorklets.ts +200 -0
- package/src/WorkletsModule/NativeWorklets.ts +256 -0
- package/src/WorkletsModule/index.ts +7 -0
- package/src/WorkletsModule/workletsModuleInstance.ts +9 -0
- package/src/WorkletsModule/workletsModuleInstance.web.ts +5 -0
- package/src/WorkletsModule/workletsModuleProxy.ts +126 -0
- package/src/bundleUnpacker.ts +75 -0
- package/src/callGuard.ts +33 -0
- package/src/deprecated.ts +32 -0
- package/src/errors.ts +80 -0
- package/src/featureFlags/index.ts +72 -0
- package/src/featureFlags/staticFlags.json +4 -0
- package/src/index.ts +53 -0
- package/src/initializers.ts +262 -0
- package/src/isSynchronizable.ts +13 -0
- package/src/logger.ts +16 -0
- package/src/privateGlobals.d.ts +79 -0
- package/src/publicGlobals.ts +39 -0
- package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
- package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
- package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
- package/src/runLoop/uiRuntime/requestAnimationFrame.ts +66 -0
- package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
- package/src/runLoop/workletRuntime/index.ts +18 -0
- package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
- package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
- package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
- package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
- package/src/runtimeKind.ts +37 -0
- package/src/runtimes.ts +193 -0
- package/src/serializable.ts +801 -0
- package/src/serializableMappingCache.ts +42 -0
- package/src/specs/NativeWorkletsModule.kepler.ts +11 -0
- package/src/specs/NativeWorkletsModule.ts +9 -0
- package/src/specs/index.ts +13 -0
- package/src/synchronizable.ts +32 -0
- package/src/synchronizableUnpacker.ts +67 -0
- package/src/threads.ts +452 -0
- package/src/utils/checkCppVersion.ts +34 -0
- package/src/utils/jsVersion.ts +7 -0
- package/src/valueUnpacker.ts +90 -0
- package/src/workletFunction.ts +42 -0
- package/src/workletRuntimeEntry.ts +35 -0
- package/src/workletTypes.ts +81 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
node_modules/@amzn/react-native-worklets_1/src/index.ts:92dc5fad3e3c1eeb4368
|
|
2
|
+
node_modules/@amzn/react-native-worklets_1/src/runtimeKind.ts:c61bd1d326ebb2baf5b9
|
|
3
|
+
node_modules/@amzn/react-native-worklets_1/src/WorkletsModule/index.ts:9450964c02b706827b89
|
|
4
|
+
node_modules/@amzn/react-native-worklets_1/src/WorkletsModule/workletsModuleInstance.ts:e79c59849894fd2eba81
|
|
5
|
+
node_modules/@amzn/react-native-worklets_1/src/PlatformChecker/index.ts:8aea4a1fe67b9152ae38
|
|
6
|
+
node_modules/@amzn/react-native-worklets_1/src/PlatformChecker/PlatformChecker.ts:7c985777cfff18a29798
|
|
7
|
+
node_modules/@amzn/react-native-worklets_1/src/WorkletsModule/JSWorklets.ts:879795fe4f62c2ff3488
|
|
8
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts:72f11271103bf8ddffba
|
|
9
|
+
node_modules/@amzn/react-native-worklets_1/src/WorkletsError.ts:80a0712d800414a8838a
|
|
10
|
+
node_modules/@amzn/react-native-worklets_1/src/WorkletsModule/NativeWorklets.ts:ca34ec291cb9aae170e3
|
|
11
|
+
node_modules/@amzn/react-native-worklets_1/src/utils/jsVersion.ts:fe5c8ac3d1ad6d8b767c
|
|
12
|
+
node_modules/@amzn/react-native-worklets_1/src/specs/index.ts:ee9af6e25724f0b06aa0
|
|
13
|
+
node_modules/@amzn/react-native-worklets_1/src/specs/NativeWorkletsModule.kepler.ts:d4a43c6a0f0a92da5b7f
|
|
14
|
+
node_modules/@amzn/react-native-worklets_1/src/threads.ts:57269a569e68db39f877
|
|
15
|
+
node_modules/@amzn/react-native-worklets_1/src/serializable.ts:4b5d5d7ee5afc1561858
|
|
16
|
+
node_modules/@amzn/react-native-worklets_1/src/serializableMappingCache.ts:b7986763a699028eec54
|
|
17
|
+
node_modules/@amzn/react-native-worklets_1/src/workletFunction.ts:e4cf6b5e8a9c81f6eeff
|
|
18
|
+
node_modules/@amzn/react-native-worklets_1/src/isSynchronizable.ts:74e162ea64939358d949
|
|
19
|
+
node_modules/@amzn/react-native-worklets_1/src/logger.ts:51a72bffa8e86d7e7a5d
|
|
20
|
+
node_modules/@amzn/react-native-worklets_1/src/synchronizable.ts:36f8eb64e47bac46f42b
|
|
21
|
+
node_modules/@amzn/react-native-worklets_1/src/runtimes.ts:50ca147e06e1da2ca8fa
|
|
22
|
+
node_modules/@amzn/react-native-worklets_1/src/initializers.ts:2b74ece7a557c3b3fa49
|
|
23
|
+
node_modules/@amzn/react-native-worklets_1/src/bundleUnpacker.ts:6a9818d606734fb8416e
|
|
24
|
+
node_modules/@amzn/react-native-worklets_1/src/synchronizableUnpacker.ts:57ccf9652fbf59f79c4c
|
|
25
|
+
node_modules/@amzn/react-native-worklets_1/src/errors.ts:5d1c55fd565874fe9e81
|
|
26
|
+
node_modules/@amzn/react-native-worklets_1/src/callGuard.ts:230af24ef4079adb05d7
|
|
27
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/uiRuntime/requestAnimationFrame.ts:5aeb6347f6febeb18aef
|
|
28
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/uiRuntime/setTimeoutPolyfill.ts:9c04cddeca5fcd2c7198
|
|
29
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/common/setImmediatePolyfill.ts:4d73e3d5ecf23f11ffa4
|
|
30
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/common/setIntervalPolyfill.ts:f0e787d0a0a9a2c35fcd
|
|
31
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/workletRuntime/index.ts:d07e735ad5410f41845d
|
|
32
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/workletRuntime/taskQueue.ts:70fb444782abd8166215
|
|
33
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/workletRuntime/queueMicrotask.ts:db789b4a6b8711586dd7
|
|
34
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/workletRuntime/setTimeout.ts:edf6238aaab78ba17e71
|
|
35
|
+
node_modules/@amzn/react-native-worklets_1/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts:9a1bd7cba70f58b1b662
|
|
36
|
+
node_modules/@amzn/react-native-worklets_1/src/featureFlags/index.ts:2317d96aabfc07d73724
|
|
37
|
+
node_modules/@amzn/react-native-worklets_1/src/deprecated.ts:cec2482e114cab853b83
|
|
38
|
+
node_modules/@amzn/react-native-worklets_1/src/publicGlobals.ts:f984eca71d566323835c
|
|
39
|
+
node_modules/@amzn/react-native-worklets_1/src/workletRuntimeEntry.ts:693a19bd3e7620854352
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
node_modules/@babel/runtime_7.28.6/helpers/interopRequireDefault.js:1658e9d806cecc7d513f
|
|
2
|
+
node_modules/@babel/runtime_7.28.6/helpers/classCallCheck.js:058f50a76315fc88ad5c
|
|
3
|
+
node_modules/@babel/runtime_7.28.6/helpers/createClass.js:0d1487bbdd0385fe6673
|
|
4
|
+
node_modules/@babel/runtime_7.28.6/helpers/toPropertyKey.js:48405da1a82590964a03
|
|
5
|
+
node_modules/@babel/runtime_7.28.6/helpers/toPrimitive.js:0f8abf3c8b18480a6d47
|
|
6
|
+
node_modules/@babel/runtime_7.28.6/helpers/typeof.js:13ae0d75f4934933ecaf
|
|
7
|
+
node_modules/@babel/runtime_7.28.6/helpers/possibleConstructorReturn.js:4aa94a74d7bb7221b923
|
|
8
|
+
node_modules/@babel/runtime_7.28.6/helpers/assertThisInitialized.js:25fb38428dda46d6800f
|
|
9
|
+
node_modules/@babel/runtime_7.28.6/helpers/getPrototypeOf.js:d2ca1962320a7fc595a6
|
|
10
|
+
node_modules/@babel/runtime_7.28.6/helpers/get.js:d8dcd13dae0a344bbc4a
|
|
11
|
+
node_modules/@babel/runtime_7.28.6/helpers/superPropBase.js:1f15365ae02704dfefe4
|
|
12
|
+
node_modules/@babel/runtime_7.28.6/helpers/inherits.js:c3969dfc5dcf704d89df
|
|
13
|
+
node_modules/@babel/runtime_7.28.6/helpers/setPrototypeOf.js:8b411d7eeb55832922af
|
|
14
|
+
node_modules/@babel/runtime_7.28.6/helpers/classPrivateFieldLooseBase.js:84b970236b4776e847c4
|
|
15
|
+
node_modules/@babel/runtime_7.28.6/helpers/classPrivateFieldLooseKey.js:c408e8c609dabd10913e
|
|
16
|
+
node_modules/invariant_2.2.4/browser.js:fd099686726b2dfb6f66
|
|
17
|
+
node_modules/@babel/runtime_7.28.6/helpers/slicedToArray.js:b5c3a0dfb06038f36d1a
|
|
18
|
+
node_modules/@babel/runtime_7.28.6/helpers/arrayWithHoles.js:3e4d5f17df2fc26aca06
|
|
19
|
+
node_modules/@babel/runtime_7.28.6/helpers/iterableToArrayLimit.js:7c9be9833a5bd1bcfc84
|
|
20
|
+
node_modules/@babel/runtime_7.28.6/helpers/unsupportedIterableToArray.js:41618dd1a0cab1d4d4b6
|
|
21
|
+
node_modules/@babel/runtime_7.28.6/helpers/arrayLikeToArray.js:b23f086000fa770c51b1
|
|
22
|
+
node_modules/@babel/runtime_7.28.6/helpers/nonIterableRest.js:7fc60d42dbf0dbb04c4b
|
|
23
|
+
node_modules/@react-native/normalize-colors_0.83.0/index.js:e8e087936fed8afe0814
|
|
24
|
+
node_modules/@babel/runtime_7.28.6/helpers/objectWithoutProperties.js:c4820e134611e601fe3c
|
|
25
|
+
node_modules/@babel/runtime_7.28.6/helpers/objectWithoutPropertiesLoose.js:2819355eb1660a78a270
|
|
26
|
+
node_modules/nullthrows_1.1.1/nullthrows.js:afd4874b36ccd4e13961
|
|
27
|
+
node_modules/@react-native/assets-registry_0.83.0/registry.js:5ff9e23a9ba5a1a1e0ac
|
|
28
|
+
node_modules/@react-native/assets-registry_0.83.0/path-support.js:fb4eb45d6b2fc494317c
|
|
29
|
+
node_modules/@babel/runtime_7.28.6/helpers/wrapNativeSuper.js:583997f8f86d03f2b30d
|
|
30
|
+
node_modules/@babel/runtime_7.28.6/helpers/isNativeFunction.js:251a25cb216e38430b20
|
|
31
|
+
node_modules/@babel/runtime_7.28.6/helpers/construct.js:594614f416b5f1160b89
|
|
32
|
+
node_modules/@babel/runtime_7.28.6/helpers/isNativeReflectConstruct.js:f3459bbdfb4afe15ce21
|
|
33
|
+
node_modules/promise_8.3.0/setimmediate/es6-extensions.js:a7846fdeffeb1ebf6241
|
|
34
|
+
node_modules/promise_8.3.0/setimmediate/core.js:890f60fa94d3f6854a19
|
|
35
|
+
node_modules/promise_8.3.0/setimmediate/finally.js:15bc4ccb25fc2d0c4428
|
|
36
|
+
node_modules/stacktrace-parser_0.1.11/dist/stack-trace-parser.cjs.js:aa725aa4c0b37e1add33
|
|
37
|
+
node_modules/regenerator-runtime_0.13.11/runtime.js:af823d9710c534173a4d
|
|
38
|
+
node_modules/base64-js_1.5.1/index.js:71af70f51435e3e1b37b
|
|
39
|
+
node_modules/whatwg-fetch_3.6.20/dist/fetch.umd.js:ca4b0363146267ef3e77
|
|
40
|
+
node_modules/abort-controller_3.0.0/dist/abort-controller.js:ea8fcbd647aab1cfcdaa
|
|
41
|
+
node_modules/event-target-shim_5.0.1/dist/event-target-shim.js:2bd3f165b1ed6b916de7
|
|
42
|
+
node_modules/scheduler_0.27.0/index.native.js:ec9ec59f48073ee6e9f5
|
|
43
|
+
node_modules/scheduler_0.27.0/cjs/scheduler.native.production.js:d8f1930d0c79328207a3
|
|
44
|
+
node_modules/@babel/runtime_7.28.6/helpers/readOnlyError.js:09c040dc0dcec28a54ae
|
|
45
|
+
node_modules/@react-native/virtualized-lists_0.83.0/index.js:a7726730afdc356adbe4
|
|
46
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizeUtils.js:d0ff6d3d1f2c9580ab13
|
|
47
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizedList.js:8d139349672eea405ffb
|
|
48
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Utilities/clamp.js:a78a6606e498a2fdbf2d
|
|
49
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Utilities/infoLog.js:017b2813127d2e7f4d70
|
|
50
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/ChildListCollection.js:9c3630060e6e634bfb8b
|
|
51
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/FillRateHelper.js:c1e83141f045b25e26fc
|
|
52
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/ListMetricsAggregator.js:480fcd792bed2eb457f3
|
|
53
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/StateSafePureComponent.js:fd4823cbe6aa108a7d62
|
|
54
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/ViewabilityHelper.js:a44a41089be71f9f7b1e
|
|
55
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizedListCellRenderer.js:8aa7cf31c704a4a85db2
|
|
56
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizedListContext.js:4b89f56515b0628d3446
|
|
57
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizedListProps.js:516cf3cf4ecb4e256407
|
|
58
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/CellRenderMask.js:95aa36c0870d6d5cfdb1
|
|
59
|
+
node_modules/@react-native/virtualized-lists_0.83.0/Lists/VirtualizedSectionList.js:cb8631f113fda0d4a92c
|
|
60
|
+
node_modules/memoize-one_5.2.1/dist/memoize-one.cjs.js:d381691ed29bec5a2050
|
|
61
|
+
node_modules/@babel/runtime_7.28.6/helpers/asyncToGenerator.js:949e187ecf57bddc8118
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
project(Worklets)
|
|
2
|
+
cmake_minimum_required(VERSION 3.8)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
5
|
+
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# default CMAKE_CXX_FLAGS: "-g -DANDROID -fdata-sections -ffunction-sections
|
|
9
|
+
# -funwind-tables -fstack-protector-strong -no-canonical-prefixes
|
|
10
|
+
# -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-protector-all"
|
|
11
|
+
include("${REACT_NATIVE_DIR}/ReactAndroid/cmake-utils/folly-flags.cmake")
|
|
12
|
+
add_compile_options(${folly_FLAGS})
|
|
13
|
+
|
|
14
|
+
string(
|
|
15
|
+
APPEND
|
|
16
|
+
CMAKE_CXX_FLAGS
|
|
17
|
+
" -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}\
|
|
18
|
+
-DWORKLETS_VERSION=${WORKLETS_VERSION}\
|
|
19
|
+
-DWORKLETS_FEATURE_FLAGS=\"${WORKLETS_FEATURE_FLAGS}\"")
|
|
20
|
+
|
|
21
|
+
string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer -fstack-protector-all")
|
|
22
|
+
|
|
23
|
+
if(${IS_REANIMATED_EXAMPLE_APP})
|
|
24
|
+
string(APPEND CMAKE_CXX_FLAGS " -DIS_REANIMATED_EXAMPLE_APP -Wpedantic")
|
|
25
|
+
endif()
|
|
26
|
+
if(${WORKLETS_BUNDLE_MODE})
|
|
27
|
+
string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_BUNDLE_MODE")
|
|
28
|
+
endif()
|
|
29
|
+
|
|
30
|
+
if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
31
|
+
string(APPEND CMAKE_CXX_FLAGS " -DNDEBUG")
|
|
32
|
+
endif()
|
|
33
|
+
|
|
34
|
+
if(${JS_RUNTIME} STREQUAL "hermes")
|
|
35
|
+
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
|
|
36
|
+
elseif(${JS_RUNTIME} STREQUAL "jsc")
|
|
37
|
+
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
|
|
38
|
+
else()
|
|
39
|
+
message(FATAL_ERROR "Unknown JS runtime ${JS_RUNTIME}.")
|
|
40
|
+
endif()
|
|
41
|
+
|
|
42
|
+
set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build")
|
|
43
|
+
set(ANDROID_CPP_DIR "${CMAKE_SOURCE_DIR}/src/main/cpp")
|
|
44
|
+
set(COMMON_CPP_DIR "${CMAKE_SOURCE_DIR}/../Common/cpp")
|
|
45
|
+
|
|
46
|
+
file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS
|
|
47
|
+
"${COMMON_CPP_DIR}/worklets/*.cpp")
|
|
48
|
+
file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS
|
|
49
|
+
"${ANDROID_CPP_DIR}/worklets/*.cpp")
|
|
50
|
+
|
|
51
|
+
# Consume shared libraries and headers from prefabs
|
|
52
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
53
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
54
|
+
|
|
55
|
+
if(${JS_RUNTIME} STREQUAL "hermes")
|
|
56
|
+
find_package(hermes-engine REQUIRED CONFIG)
|
|
57
|
+
endif()
|
|
58
|
+
|
|
59
|
+
add_library(worklets SHARED ${WORKLETS_COMMON_CPP_SOURCES}
|
|
60
|
+
${WORKLETS_ANDROID_CPP_SOURCES})
|
|
61
|
+
|
|
62
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 80)
|
|
63
|
+
include(
|
|
64
|
+
"${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
|
|
65
|
+
target_compile_reactnative_options(worklets PUBLIC)
|
|
66
|
+
else()
|
|
67
|
+
string(APPEND CMAKE_CXX_FLAGS
|
|
68
|
+
" -fexceptions -frtti -std=c++${CMAKE_CXX_STANDARD} -Wall -Werror")
|
|
69
|
+
endif()
|
|
70
|
+
|
|
71
|
+
# includes
|
|
72
|
+
target_include_directories(worklets PUBLIC "${COMMON_CPP_DIR}"
|
|
73
|
+
"${ANDROID_CPP_DIR}")
|
|
74
|
+
|
|
75
|
+
target_include_directories(
|
|
76
|
+
worklets
|
|
77
|
+
PRIVATE "${REACT_NATIVE_DIR}/ReactCommon"
|
|
78
|
+
"${REACT_NATIVE_DIR}/ReactCommon/yoga"
|
|
79
|
+
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
|
|
80
|
+
"${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon"
|
|
81
|
+
"${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
|
|
82
|
+
"${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
|
|
83
|
+
"${REACT_NATIVE_DIR}/ReactCommon/jsiexecutor"
|
|
84
|
+
"${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
if(ReactAndroid_VERSION_MINOR LESS 76)
|
|
88
|
+
target_link_libraries(
|
|
89
|
+
worklets ReactAndroid::fabricjni ReactAndroid::react_debug
|
|
90
|
+
ReactAndroid::react_render_core
|
|
91
|
+
ReactAndroid::react_render_componentregistry ReactAndroid::rrc_view)
|
|
92
|
+
endif()
|
|
93
|
+
|
|
94
|
+
# build shared lib
|
|
95
|
+
set_target_properties(worklets PROPERTIES LINKER_LANGUAGE CXX)
|
|
96
|
+
|
|
97
|
+
target_link_libraries(worklets log ReactAndroid::jsi fbjni::fbjni)
|
|
98
|
+
|
|
99
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
100
|
+
target_link_libraries(worklets ReactAndroid::reactnative)
|
|
101
|
+
else()
|
|
102
|
+
target_link_libraries(
|
|
103
|
+
worklets ReactAndroid::react_nativemodule_core ReactAndroid::folly_runtime
|
|
104
|
+
ReactAndroid::glog ReactAndroid::reactnativejni)
|
|
105
|
+
endif()
|
|
106
|
+
|
|
107
|
+
if(${JS_RUNTIME} STREQUAL "hermes")
|
|
108
|
+
target_link_libraries(worklets hermes-engine::libhermes)
|
|
109
|
+
|
|
110
|
+
if(${HERMES_ENABLE_DEBUGGER})
|
|
111
|
+
string(APPEND CMAKE_CXX_FLAGS " -DHERMES_ENABLE_DEBUGGER=1")
|
|
112
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
113
|
+
target_link_libraries(worklets ReactAndroid::hermestooling)
|
|
114
|
+
else()
|
|
115
|
+
target_link_libraries(worklets ReactAndroid::hermes_executor)
|
|
116
|
+
endif()
|
|
117
|
+
endif()
|
|
118
|
+
elseif(${JS_RUNTIME} STREQUAL "jsc")
|
|
119
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
120
|
+
target_link_libraries(worklets ReactAndroid::jsctooling)
|
|
121
|
+
else()
|
|
122
|
+
target_link_libraries(worklets ReactAndroid::jscexecutor)
|
|
123
|
+
endif()
|
|
124
|
+
endif()
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import com.android.build.gradle.tasks.ExternalNativeBuildJsonTask
|
|
2
|
+
import groovy.json.JsonSlurper
|
|
3
|
+
import java.nio.file.Paths
|
|
4
|
+
import org.apache.tools.ant.taskdefs.condition.Os
|
|
5
|
+
|
|
6
|
+
def safeExtGet(prop, fallback) {
|
|
7
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
def safeAppExtGet(prop, fallback) {
|
|
11
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
12
|
+
appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
def isNewArchitectureEnabled() {
|
|
16
|
+
// To opt-in for the New Architecture, you can either:
|
|
17
|
+
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
18
|
+
// - Invoke gradle with `-newArchEnabled=true`
|
|
19
|
+
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
20
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def resolveReactNativeDirectory() {
|
|
24
|
+
def reactNativeLocation = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
|
|
25
|
+
if (reactNativeLocation != null) {
|
|
26
|
+
return file(reactNativeLocation)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Fallback to node resolver for custom directory structures like monorepos.
|
|
30
|
+
def reactNativePackage = file(
|
|
31
|
+
providers.exec {
|
|
32
|
+
workingDir(rootDir)
|
|
33
|
+
commandLine("node", "--print", "require.resolve('react-native/package.json')")
|
|
34
|
+
}.standardOutput.asText.get().trim()
|
|
35
|
+
)
|
|
36
|
+
if (reactNativePackage.exists()) {
|
|
37
|
+
return reactNativePackage.parentFile
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new GradleException(
|
|
41
|
+
"[Worklets] Unable to resolve react-native location in node_modules. You should set project extension property (in `app/build.gradle`) named `REACT_NATIVE_NODE_MODULES_DIR` with the path to react-native in node_modules."
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def getReactNativeVersion() {
|
|
46
|
+
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
47
|
+
def reactProperties = new Properties()
|
|
48
|
+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
49
|
+
return reactProperties.getProperty("VERSION_NAME")
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
def getReactNativeMinorVersion() {
|
|
53
|
+
def reactNativeVersion = getReactNativeVersion()
|
|
54
|
+
return reactNativeVersion.startsWith("0.0.0-") ? 1000 : reactNativeVersion.split("\\.")[1].toInteger()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
def getWorkletsVersion() {
|
|
58
|
+
def inputFile = file(projectDir.path + '/../package.json')
|
|
59
|
+
def json = new JsonSlurper().parseText(inputFile.text)
|
|
60
|
+
return json.version
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
def toPlatformFileString(String path) {
|
|
64
|
+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
65
|
+
path = path.replace(File.separatorChar, '/' as char)
|
|
66
|
+
}
|
|
67
|
+
return path
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
def getStaticFeatureFlags() {
|
|
71
|
+
def featureFlags = new HashMap<String, String>()
|
|
72
|
+
|
|
73
|
+
def staticFeatureFlagsFile = file(projectDir.path + "/../src/featureFlags/staticFlags.json")
|
|
74
|
+
if (!staticFeatureFlagsFile.exists()) {
|
|
75
|
+
throw new GradleException("[Worklets] Feature flags file not found at ${staticFeatureFlagsFile.absolutePath}.")
|
|
76
|
+
}
|
|
77
|
+
new JsonSlurper().parseText(staticFeatureFlagsFile.text).each { key, value ->
|
|
78
|
+
featureFlags[key] = value.toString()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
def packageJsonFile = file(rootDir.path + "/../package.json")
|
|
82
|
+
if (packageJsonFile.exists()) {
|
|
83
|
+
def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
|
|
84
|
+
packageJson.worklets?.staticFeatureFlags?.each { key, value ->
|
|
85
|
+
featureFlags[key] = value.toString()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return featureFlags.collect { key, value -> "[${key}:${value}]" }.join("")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (isNewArchitectureEnabled()) {
|
|
93
|
+
apply plugin: "com.facebook.react"
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
def packageDir = project.projectDir.parentFile
|
|
97
|
+
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
98
|
+
def REACT_NATIVE_MINOR_VERSION = getReactNativeMinorVersion()
|
|
99
|
+
def REACT_NATIVE_VERSION = getReactNativeVersion()
|
|
100
|
+
def WORKLETS_VERSION = getWorkletsVersion()
|
|
101
|
+
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
|
|
102
|
+
def IS_REANIMATED_EXAMPLE_APP = safeAppExtGet("isReanimatedExampleApp", false)
|
|
103
|
+
def BUNDLE_MODE = safeAppExtGet("workletsBundleMode", false)
|
|
104
|
+
def WORKLETS_FEATURE_FLAGS = getStaticFeatureFlags()
|
|
105
|
+
|
|
106
|
+
// Set version for prefab
|
|
107
|
+
version WORKLETS_VERSION
|
|
108
|
+
|
|
109
|
+
def workletsPrefabHeadersDir = project.file("$buildDir/prefab-headers/worklets")
|
|
110
|
+
|
|
111
|
+
def JS_RUNTIME = {
|
|
112
|
+
// Override JS runtime with environment variable
|
|
113
|
+
if (System.getenv("JS_RUNTIME")) {
|
|
114
|
+
return System.getenv("JS_RUNTIME")
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Check if Hermes is enabled in app setup
|
|
118
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
119
|
+
if (appProject?.hermesEnabled?.toBoolean() || appProject?.ext?.react?.enableHermes?.toBoolean()) {
|
|
120
|
+
return "hermes"
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Use JavaScriptCore (JSC) by default
|
|
124
|
+
return "jsc"
|
|
125
|
+
}.call()
|
|
126
|
+
|
|
127
|
+
def reactNativeArchitectures() {
|
|
128
|
+
def value = project.getProperties().get("reactNativeArchitectures")
|
|
129
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
buildscript {
|
|
133
|
+
repositories {
|
|
134
|
+
google()
|
|
135
|
+
mavenCentral()
|
|
136
|
+
}
|
|
137
|
+
dependencies {
|
|
138
|
+
classpath "com.android.tools.build:gradle:8.2.1"
|
|
139
|
+
classpath "de.undercouch:gradle-download-task:5.6.0"
|
|
140
|
+
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (project == rootProject) {
|
|
145
|
+
apply from: "spotless.gradle"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
apply plugin: "com.android.library"
|
|
149
|
+
apply plugin: "maven-publish"
|
|
150
|
+
apply plugin: "de.undercouch.download"
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
android {
|
|
154
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
155
|
+
|
|
156
|
+
namespace "com.swmansion.worklets"
|
|
157
|
+
|
|
158
|
+
if (rootProject.hasProperty("ndkPath")) {
|
|
159
|
+
ndkPath rootProject.ext.ndkPath
|
|
160
|
+
}
|
|
161
|
+
if (rootProject.hasProperty("ndkVersion")) {
|
|
162
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
buildFeatures {
|
|
166
|
+
prefab true
|
|
167
|
+
prefabPublishing true
|
|
168
|
+
buildConfig true
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
prefab {
|
|
172
|
+
worklets {
|
|
173
|
+
headers workletsPrefabHeadersDir.absolutePath
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
defaultConfig {
|
|
178
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
179
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
180
|
+
versionCode 1
|
|
181
|
+
versionName WORKLETS_VERSION
|
|
182
|
+
|
|
183
|
+
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
|
|
184
|
+
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
|
|
185
|
+
buildConfigField("int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString())
|
|
186
|
+
buildConfigField("boolean", "BUNDLE_MODE", BUNDLE_MODE.toString())
|
|
187
|
+
|
|
188
|
+
externalNativeBuild {
|
|
189
|
+
cmake {
|
|
190
|
+
arguments "-DANDROID_STL=c++_shared",
|
|
191
|
+
"-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}",
|
|
192
|
+
"-DANDROID_TOOLCHAIN=clang",
|
|
193
|
+
"-DREACT_NATIVE_DIR=${toPlatformFileString(reactNativeRootDir.path)}",
|
|
194
|
+
"-DJS_RUNTIME=${JS_RUNTIME}",
|
|
195
|
+
"-DIS_REANIMATED_EXAMPLE_APP=${IS_REANIMATED_EXAMPLE_APP}",
|
|
196
|
+
"-DWORKLETS_BUNDLE_MODE=${BUNDLE_MODE}",
|
|
197
|
+
"-DWORKLETS_VERSION=${WORKLETS_VERSION}",
|
|
198
|
+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
|
199
|
+
"-DWORKLETS_FEATURE_FLAGS=${WORKLETS_FEATURE_FLAGS}"
|
|
200
|
+
abiFilters (*reactNativeArchitectures())
|
|
201
|
+
targets("worklets")
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
206
|
+
}
|
|
207
|
+
externalNativeBuild {
|
|
208
|
+
cmake {
|
|
209
|
+
version = System.getenv("CMAKE_VERSION") ?: "3.22.1"
|
|
210
|
+
path "CMakeLists.txt"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
buildTypes {
|
|
214
|
+
debug {
|
|
215
|
+
externalNativeBuild {
|
|
216
|
+
cmake {
|
|
217
|
+
if (JS_RUNTIME == "hermes") {
|
|
218
|
+
// React Native doesn't expose these flags, but not having them
|
|
219
|
+
// can lead to runtime errors due to ABI mismatches.
|
|
220
|
+
// There's also
|
|
221
|
+
// HERMESVM_PROFILER_OPCODE
|
|
222
|
+
// HERMESVM_PROFILER_BB
|
|
223
|
+
// which shouldn't be defined in standard setups.
|
|
224
|
+
arguments "-DHERMES_ENABLE_DEBUGGER=1"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
packagingOptions {
|
|
229
|
+
doNotStrip "**/**/*.so"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
lintOptions {
|
|
234
|
+
abortOnError false
|
|
235
|
+
}
|
|
236
|
+
packagingOptions {
|
|
237
|
+
// For some reason gradle only complains about the duplicated version of librrc_root and libreact_render libraries
|
|
238
|
+
// while there are more libraries copied in intermediates folder of the lib build directory, we exclude
|
|
239
|
+
// only the ones that make the build fail (ideally we should only include libreanimated but we
|
|
240
|
+
// are only allowed to specify exclude patterns)
|
|
241
|
+
excludes = [
|
|
242
|
+
"META-INF",
|
|
243
|
+
"META-INF/**",
|
|
244
|
+
"**/libc++_shared.so",
|
|
245
|
+
"**/libfbjni.so",
|
|
246
|
+
"**/libjsi.so",
|
|
247
|
+
"**/libfolly_json.so",
|
|
248
|
+
"**/libfolly_runtime.so",
|
|
249
|
+
"**/libglog.so",
|
|
250
|
+
"**/libhermes.so",
|
|
251
|
+
"**/libhermes-executor-debug.so",
|
|
252
|
+
"**/libhermes_executor.so",
|
|
253
|
+
"**/libhermestooling.so",
|
|
254
|
+
"**/libreactnativejni.so",
|
|
255
|
+
"**/libturbomodulejsijni.so",
|
|
256
|
+
"**/libreactnative.so",
|
|
257
|
+
"**/libreact_nativemodule_core.so",
|
|
258
|
+
"**/libreact_render*.so",
|
|
259
|
+
"**/librrc_root.so",
|
|
260
|
+
"**/libjscexecutor.so",
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
compileOptions {
|
|
264
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
265
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
266
|
+
}
|
|
267
|
+
sourceSets {
|
|
268
|
+
main {
|
|
269
|
+
java {
|
|
270
|
+
if (BUNDLE_MODE) {
|
|
271
|
+
srcDirs += "src/experimentalBundling"
|
|
272
|
+
} else {
|
|
273
|
+
srcDirs += "src/legacyBundling"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
tasks.withType(ExternalNativeBuildJsonTask) {
|
|
279
|
+
compileTask ->
|
|
280
|
+
compileTask.doLast {
|
|
281
|
+
if (!IS_REANIMATED_EXAMPLE_APP) {
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
def generated = new File("${compileTask.abi.getCxxBuildFolder()}/compile_commands.json")
|
|
286
|
+
def output = new File("${packageDir}/compile_commands.json")
|
|
287
|
+
|
|
288
|
+
output.text = generated.text
|
|
289
|
+
|
|
290
|
+
println("Generated clangd metadata.")
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
def validateReactNativeVersionResult = providers.exec {
|
|
296
|
+
workingDir(projectDir.path)
|
|
297
|
+
commandLine("node", "./../scripts/validate-react-native-version.js", REACT_NATIVE_VERSION.toString())
|
|
298
|
+
ignoreExitValue = true
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
task assertMinimalReactNativeVersionTask {
|
|
302
|
+
doFirst {
|
|
303
|
+
if (validateReactNativeVersionResult.getResult().get().exitValue != 0) {
|
|
304
|
+
throw new GradleException(validateReactNativeVersionResult.getStandardError().getAsText().get().trim())
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
preBuild.dependsOn(assertMinimalReactNativeVersionTask)
|
|
310
|
+
|
|
311
|
+
task assertNewArchitectureEnabledTask {
|
|
312
|
+
onlyIf { !IS_NEW_ARCHITECTURE_ENABLED }
|
|
313
|
+
doFirst {
|
|
314
|
+
throw new GradleException("[Worklets] Worklets require new architecture to be enabled. Please enable it by setting `newArchEnabled` to `true` in `gradle.properties`.")
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
preBuild.dependsOn(assertNewArchitectureEnabledTask)
|
|
319
|
+
|
|
320
|
+
task prepareWorkletsHeadersForPrefabs(type: Copy) {
|
|
321
|
+
from("$projectDir/src/main/cpp")
|
|
322
|
+
from("$projectDir/../Common/cpp")
|
|
323
|
+
include("worklets/**/*.h")
|
|
324
|
+
into(workletsPrefabHeadersDir)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
task cleanCmakeCache() {
|
|
328
|
+
tasks.getByName("clean").dependsOn(cleanCmakeCache)
|
|
329
|
+
doFirst {
|
|
330
|
+
delete "${projectDir}/.cxx"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
repositories {
|
|
335
|
+
mavenCentral()
|
|
336
|
+
google()
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
dependencies {
|
|
340
|
+
implementation "com.facebook.yoga:proguard-annotations:1.19.0"
|
|
341
|
+
implementation "androidx.transition:transition:1.1.0"
|
|
342
|
+
implementation "androidx.core:core:1.6.0"
|
|
343
|
+
|
|
344
|
+
implementation "com.facebook.react:react-android" // version substituted by RNGP
|
|
345
|
+
if (JS_RUNTIME == "hermes") {
|
|
346
|
+
implementation "com.facebook.react:hermes-android" // version substituted by RNGP
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
preBuild.dependsOn(prepareWorkletsHeadersForPrefabs)
|