@depup/react-native-worklets 0.11.3-depup.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.
Files changed (457) hide show
  1. package/.worklets/dummy.md +1 -0
  2. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +64 -0
  3. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
  4. package/Common/cpp/worklets/Compat/Holders.h +25 -0
  5. package/Common/cpp/worklets/Compat/StableApi.cpp +145 -0
  6. package/Common/cpp/worklets/Compat/StableApi.h +128 -0
  7. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +729 -0
  8. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +126 -0
  9. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +81 -0
  10. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +76 -0
  11. package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +95 -0
  12. package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +44 -0
  13. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +10 -0
  14. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +43 -0
  15. package/Common/cpp/worklets/RunLoop/AsyncQueue.h +14 -0
  16. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +69 -0
  17. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +48 -0
  18. package/Common/cpp/worklets/RunLoop/EventLoop.cpp +103 -0
  19. package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
  20. package/Common/cpp/worklets/SharedItems/MemoryManager.cpp +60 -0
  21. package/Common/cpp/worklets/SharedItems/MemoryManager.h +29 -0
  22. package/Common/cpp/worklets/SharedItems/Serializable.cpp +373 -0
  23. package/Common/cpp/worklets/SharedItems/Serializable.h +413 -0
  24. package/Common/cpp/worklets/SharedItems/SerializableFactory.cpp +172 -0
  25. package/Common/cpp/worklets/SharedItems/SerializableFactory.h +85 -0
  26. package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.cpp +71 -0
  27. package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.h +75 -0
  28. package/Common/cpp/worklets/SharedItems/Shareable.cpp +84 -0
  29. package/Common/cpp/worklets/SharedItems/Shareable.h +43 -0
  30. package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +59 -0
  31. package/Common/cpp/worklets/SharedItems/Synchronizable.h +57 -0
  32. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +78 -0
  33. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
  34. package/Common/cpp/worklets/SharedItems/UnpackerLoader.h +78 -0
  35. package/Common/cpp/worklets/Tools/FeatureFlags.cpp +18 -0
  36. package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
  37. package/Common/cpp/worklets/Tools/JSISerializer.cpp +312 -0
  38. package/Common/cpp/worklets/Tools/JSISerializer.h +42 -0
  39. package/Common/cpp/worklets/Tools/JSLogger.cpp +92 -0
  40. package/Common/cpp/worklets/Tools/JSLogger.h +48 -0
  41. package/Common/cpp/worklets/Tools/JSScheduler.cpp +21 -0
  42. package/Common/cpp/worklets/Tools/JSScheduler.h +35 -0
  43. package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
  44. package/Common/cpp/worklets/Tools/RNRuntimeStatus.h +27 -0
  45. package/Common/cpp/worklets/Tools/ScriptBuffer.h +56 -0
  46. package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +75 -0
  47. package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
  48. package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
  49. package/Common/cpp/worklets/Tools/UIScheduler.h +22 -0
  50. package/Common/cpp/worklets/Tools/VersionUtils.cpp +61 -0
  51. package/Common/cpp/worklets/Tools/VersionUtils.h +24 -0
  52. package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +34 -0
  53. package/Common/cpp/worklets/Tools/WorkletEventHandler.h +44 -0
  54. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +30 -0
  55. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +222 -0
  56. package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +116 -0
  57. package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +46 -0
  58. package/Common/cpp/worklets/Tools/WorkletsVersion.h +18 -0
  59. package/Common/cpp/worklets/WorkletRuntime/BundleModeConfig.h +17 -0
  60. package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.cpp +45 -0
  61. package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.h +12 -0
  62. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +68 -0
  63. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +24 -0
  64. package/Common/cpp/worklets/WorkletRuntime/RuntimeBindings.h +59 -0
  65. package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +38 -0
  66. package/Common/cpp/worklets/WorkletRuntime/RuntimeHolder.h +19 -0
  67. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +122 -0
  68. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +75 -0
  69. package/Common/cpp/worklets/WorkletRuntime/ScriptLoader.h +116 -0
  70. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +14 -0
  71. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +15 -0
  72. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +58 -0
  73. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +100 -0
  74. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +327 -0
  75. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +256 -0
  76. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
  77. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +320 -0
  78. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +36 -0
  79. package/LICENSE +20 -0
  80. package/README.md +43 -0
  81. package/RNWorklets.podspec +94 -0
  82. package/android/CMakeLists.txt +108 -0
  83. package/android/build.gradle.kts +369 -0
  84. package/android/fix-prefab.gradle.kts +56 -0
  85. package/android/generate-stub-pch.gradle.kts +84 -0
  86. package/android/gradle.properties +25 -0
  87. package/android/proguard-rules.pro +3 -0
  88. package/android/settings.gradle.kts +21 -0
  89. package/android/src/main/AndroidManifest.xml +2 -0
  90. package/android/src/main/cpp/WorkletsPCH.h +26 -0
  91. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +66 -0
  92. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +38 -0
  93. package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +30 -0
  94. package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.cpp +66 -0
  95. package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.h +48 -0
  96. package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.cpp +51 -0
  97. package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.h +43 -0
  98. package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +31 -0
  99. package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +203 -0
  100. package/android/src/main/cpp/worklets/android/WorkletsModule.h +75 -0
  101. package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +19 -0
  102. package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.kt +56 -0
  103. package/android/src/main/java/com/swmansion/worklets/ScriptBufferWrapper.kt +103 -0
  104. package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.kt +42 -0
  105. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.kt +14 -0
  106. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.kt +112 -0
  107. package/android/src/networking/com/swmansion/worklets/WorkletRuntimeWrapper.kt +27 -0
  108. package/android/src/networking/com/swmansion/worklets/WorkletsHeaderUtil.kt +30 -0
  109. package/android/src/networking/com/swmansion/worklets/WorkletsModule.kt +187 -0
  110. package/android/src/networking/com/swmansion/worklets/WorkletsNetworkEventUtil.kt +272 -0
  111. package/android/src/networking/com/swmansion/worklets/WorkletsNetworking.kt +1124 -0
  112. package/android/src/networking/com/swmansion/worklets/WorkletsOkHttpCallUtil.kt +40 -0
  113. package/android/src/networking/com/swmansion/worklets/WorkletsProgressListener.kt +13 -0
  114. package/android/src/networking/com/swmansion/worklets/WorkletsProgressRequestBody.kt +98 -0
  115. package/android/src/networking/com/swmansion/worklets/WorkletsProgressResponseBody.kt +60 -0
  116. package/android/src/networking/com/swmansion/worklets/WorkletsProgressiveStringDecoder.kt +87 -0
  117. package/android/src/networking/com/swmansion/worklets/WorkletsRequestBodyUtil.kt +181 -0
  118. package/android/src/no-networking/com/swmansion/worklets/WorkletsModule.kt +143 -0
  119. package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
  120. package/apple/worklets/apple/AnimationFrameQueue.mm +145 -0
  121. package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
  122. package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +12 -0
  123. package/apple/worklets/apple/IOSUIScheduler.h +14 -0
  124. package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
  125. package/apple/worklets/apple/Networking/WorkletsNetworking.h +25 -0
  126. package/apple/worklets/apple/Networking/WorkletsNetworking.mm +707 -0
  127. package/apple/worklets/apple/PlatformLogger.mm +31 -0
  128. package/apple/worklets/apple/SlowAnimations.h +8 -0
  129. package/apple/worklets/apple/SlowAnimations.mm +45 -0
  130. package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
  131. package/apple/worklets/apple/WorkletsModule.h +28 -0
  132. package/apple/worklets/apple/WorkletsModule.mm +177 -0
  133. package/bundleMode/index.d.ts +6 -0
  134. package/bundleMode/index.js +182 -0
  135. package/bundleMode/shims/reactNativeShim.js +21 -0
  136. package/bundleMode/shims/turboModuleRegistryShim.js +47 -0
  137. package/changes.json +58 -0
  138. package/compatibility.json +29 -0
  139. package/jest/pluginTestUtils.ts +16 -0
  140. package/jest/resolver.js +18 -0
  141. package/lib/module/WorkletsModule/NativeWorklets.js +4 -0
  142. package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
  143. package/lib/module/WorkletsModule/NativeWorklets.native.js +199 -0
  144. package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -0
  145. package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
  146. package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
  147. package/lib/module/bundleMode/metroOverrides.native.js +26 -0
  148. package/lib/module/bundleMode/metroOverrides.native.js.map +1 -0
  149. package/lib/module/bundleMode/network.native.js +44 -0
  150. package/lib/module/bundleMode/network.native.js.map +1 -0
  151. package/lib/module/debug/bundleMode.js +6 -0
  152. package/lib/module/debug/bundleMode.js.map +1 -0
  153. package/lib/module/debug/bundleMode.native.js +11 -0
  154. package/lib/module/debug/bundleMode.native.js.map +1 -0
  155. package/lib/module/debug/checkCppVersion.js +29 -0
  156. package/lib/module/debug/checkCppVersion.js.map +1 -0
  157. package/lib/module/debug/errors.native.js +67 -0
  158. package/lib/module/debug/errors.native.js.map +1 -0
  159. package/lib/module/debug/jsVersion.js +9 -0
  160. package/lib/module/debug/jsVersion.js.map +1 -0
  161. package/lib/module/debug/logger.js +15 -0
  162. package/lib/module/debug/logger.js.map +1 -0
  163. package/lib/module/debug/slowAnimations.js +7 -0
  164. package/lib/module/debug/slowAnimations.js.map +1 -0
  165. package/lib/module/debug/slowAnimations.native.js +17 -0
  166. package/lib/module/debug/slowAnimations.native.js.map +1 -0
  167. package/lib/module/deprecated.js +27 -0
  168. package/lib/module/deprecated.js.map +1 -0
  169. package/lib/module/featureFlags/featureFlags.js +12 -0
  170. package/lib/module/featureFlags/featureFlags.js.map +1 -0
  171. package/lib/module/featureFlags/featureFlags.native.js +51 -0
  172. package/lib/module/featureFlags/featureFlags.native.js.map +1 -0
  173. package/lib/module/featureFlags/staticFlags.json +6 -0
  174. package/lib/module/featureFlags/types.js +16 -0
  175. package/lib/module/featureFlags/types.js.map +1 -0
  176. package/lib/module/guardImplementation.native.js +17 -0
  177. package/lib/module/guardImplementation.native.js.map +1 -0
  178. package/lib/module/index.js +26 -0
  179. package/lib/module/index.js.map +1 -0
  180. package/lib/module/initializers/initializers.js +24 -0
  181. package/lib/module/initializers/initializers.js.map +1 -0
  182. package/lib/module/initializers/initializers.native.js +195 -0
  183. package/lib/module/initializers/initializers.native.js.map +1 -0
  184. package/lib/module/memory/bundleUnpacker.native.js +38 -0
  185. package/lib/module/memory/bundleUnpacker.native.js.map +1 -0
  186. package/lib/module/memory/customSerializableUnpacker.native.js +20 -0
  187. package/lib/module/memory/customSerializableUnpacker.native.js.map +1 -0
  188. package/lib/module/memory/isShareable.js +8 -0
  189. package/lib/module/memory/isShareable.js.map +1 -0
  190. package/lib/module/memory/isSynchronizable.js +8 -0
  191. package/lib/module/memory/isSynchronizable.js.map +1 -0
  192. package/lib/module/memory/remoteFunctionUnpacker.native.js +18 -0
  193. package/lib/module/memory/remoteFunctionUnpacker.native.js.map +1 -0
  194. package/lib/module/memory/serializable.js +18 -0
  195. package/lib/module/memory/serializable.js.map +1 -0
  196. package/lib/module/memory/serializable.native.js +619 -0
  197. package/lib/module/memory/serializable.native.js.map +1 -0
  198. package/lib/module/memory/serializableMappingCache.js +11 -0
  199. package/lib/module/memory/serializableMappingCache.js.map +1 -0
  200. package/lib/module/memory/serializableMappingCache.native.js +29 -0
  201. package/lib/module/memory/serializableMappingCache.native.js.map +1 -0
  202. package/lib/module/memory/shareable.js +18 -0
  203. package/lib/module/memory/shareable.js.map +1 -0
  204. package/lib/module/memory/shareable.native.js +42 -0
  205. package/lib/module/memory/shareable.native.js.map +1 -0
  206. package/lib/module/memory/shareableGuestUnpacker.native.js +105 -0
  207. package/lib/module/memory/shareableGuestUnpacker.native.js.map +1 -0
  208. package/lib/module/memory/shareableHostUnpacker.native.js +20 -0
  209. package/lib/module/memory/shareableHostUnpacker.native.js.map +1 -0
  210. package/lib/module/memory/synchronizable.js +6 -0
  211. package/lib/module/memory/synchronizable.js.map +1 -0
  212. package/lib/module/memory/synchronizable.native.js +9 -0
  213. package/lib/module/memory/synchronizable.native.js.map +1 -0
  214. package/lib/module/memory/synchronizableUnpacker.native.js +47 -0
  215. package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -0
  216. package/lib/module/memory/types.js +12 -0
  217. package/lib/module/memory/types.js.map +1 -0
  218. package/lib/module/memory/valueUnpacker.native.js +52 -0
  219. package/lib/module/memory/valueUnpacker.native.js.map +1 -0
  220. package/lib/module/mock.js +85 -0
  221. package/lib/module/mock.js.map +1 -0
  222. package/lib/module/package.json +1 -0
  223. package/lib/module/platformChecker.js +4 -0
  224. package/lib/module/platformChecker.js.map +1 -0
  225. package/lib/module/platformChecker.native.js +4 -0
  226. package/lib/module/platformChecker.native.js.map +1 -0
  227. package/lib/module/privateGlobals.d.js +7 -0
  228. package/lib/module/privateGlobals.d.js.map +1 -0
  229. package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
  230. package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
  231. package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
  232. package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
  233. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
  234. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
  235. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +71 -0
  236. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
  237. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
  238. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
  239. package/lib/module/runLoop/workletRuntime/index.js +19 -0
  240. package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
  241. package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
  242. package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
  243. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
  244. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
  245. package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
  246. package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
  247. package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
  248. package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
  249. package/lib/module/runtimeKind.js +92 -0
  250. package/lib/module/runtimeKind.js.map +1 -0
  251. package/lib/module/runtimes.js +36 -0
  252. package/lib/module/runtimes.js.map +1 -0
  253. package/lib/module/runtimes.native.js +379 -0
  254. package/lib/module/runtimes.native.js.map +1 -0
  255. package/lib/module/specs/NativeWorkletsModule.js +5 -0
  256. package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
  257. package/lib/module/specs/index.js +10 -0
  258. package/lib/module/specs/index.js.map +1 -0
  259. package/lib/module/threads.js +60 -0
  260. package/lib/module/threads.js.map +1 -0
  261. package/lib/module/threads.native.js +295 -0
  262. package/lib/module/threads.native.js.map +1 -0
  263. package/lib/module/types.js +5 -0
  264. package/lib/module/types.js.map +1 -0
  265. package/lib/module/workletFunction.js +36 -0
  266. package/lib/module/workletFunction.js.map +1 -0
  267. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
  268. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
  269. package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts +3 -0
  270. package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -0
  271. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +59 -0
  272. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
  273. package/lib/typescript/bundleMode/metroOverrides.native.d.ts +9 -0
  274. package/lib/typescript/bundleMode/metroOverrides.native.d.ts.map +1 -0
  275. package/lib/typescript/bundleMode/network.native.d.ts +7 -0
  276. package/lib/typescript/bundleMode/network.native.d.ts.map +1 -0
  277. package/lib/typescript/debug/bundleMode.d.ts +2 -0
  278. package/lib/typescript/debug/bundleMode.d.ts.map +1 -0
  279. package/lib/typescript/debug/bundleMode.native.d.ts +2 -0
  280. package/lib/typescript/debug/bundleMode.native.d.ts.map +1 -0
  281. package/lib/typescript/debug/checkCppVersion.d.ts +3 -0
  282. package/lib/typescript/debug/checkCppVersion.d.ts.map +1 -0
  283. package/lib/typescript/debug/errors.native.d.ts +13 -0
  284. package/lib/typescript/debug/errors.native.d.ts.map +1 -0
  285. package/lib/typescript/debug/jsVersion.d.ts +7 -0
  286. package/lib/typescript/debug/jsVersion.d.ts.map +1 -0
  287. package/lib/typescript/debug/logger.d.ts +5 -0
  288. package/lib/typescript/debug/logger.d.ts.map +1 -0
  289. package/lib/typescript/debug/slowAnimations.d.ts +2 -0
  290. package/lib/typescript/debug/slowAnimations.d.ts.map +1 -0
  291. package/lib/typescript/debug/slowAnimations.native.d.ts +11 -0
  292. package/lib/typescript/debug/slowAnimations.native.d.ts.map +1 -0
  293. package/lib/typescript/deprecated.d.ts +19 -0
  294. package/lib/typescript/deprecated.d.ts.map +1 -0
  295. package/lib/typescript/featureFlags/featureFlags.d.ts +5 -0
  296. package/lib/typescript/featureFlags/featureFlags.d.ts.map +1 -0
  297. package/lib/typescript/featureFlags/featureFlags.native.d.ts +6 -0
  298. package/lib/typescript/featureFlags/featureFlags.native.d.ts.map +1 -0
  299. package/lib/typescript/featureFlags/types.d.ts +23 -0
  300. package/lib/typescript/featureFlags/types.d.ts.map +1 -0
  301. package/lib/typescript/guardImplementation.native.d.ts +3 -0
  302. package/lib/typescript/guardImplementation.native.d.ts.map +1 -0
  303. package/lib/typescript/index.d.ts +19 -0
  304. package/lib/typescript/index.d.ts.map +1 -0
  305. package/lib/typescript/initializers/initializers.d.ts +2 -0
  306. package/lib/typescript/initializers/initializers.d.ts.map +1 -0
  307. package/lib/typescript/initializers/initializers.native.d.ts +19 -0
  308. package/lib/typescript/initializers/initializers.native.d.ts.map +1 -0
  309. package/lib/typescript/memory/bundleUnpacker.native.d.ts +7 -0
  310. package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -0
  311. package/lib/typescript/memory/customSerializableUnpacker.native.d.ts +3 -0
  312. package/lib/typescript/memory/customSerializableUnpacker.native.d.ts.map +1 -0
  313. package/lib/typescript/memory/isShareable.d.ts +3 -0
  314. package/lib/typescript/memory/isShareable.d.ts.map +1 -0
  315. package/lib/typescript/memory/isSynchronizable.d.ts +3 -0
  316. package/lib/typescript/memory/isSynchronizable.d.ts.map +1 -0
  317. package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts +3 -0
  318. package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts.map +1 -0
  319. package/lib/typescript/memory/serializable.d.ts +7 -0
  320. package/lib/typescript/memory/serializable.d.ts.map +1 -0
  321. package/lib/typescript/memory/serializable.native.d.ts +37 -0
  322. package/lib/typescript/memory/serializable.native.d.ts.map +1 -0
  323. package/lib/typescript/memory/serializableMappingCache.d.ts +6 -0
  324. package/lib/typescript/memory/serializableMappingCache.d.ts.map +1 -0
  325. package/lib/typescript/memory/serializableMappingCache.native.d.ts +13 -0
  326. package/lib/typescript/memory/serializableMappingCache.native.d.ts.map +1 -0
  327. package/lib/typescript/memory/shareable.d.ts +15 -0
  328. package/lib/typescript/memory/shareable.d.ts.map +1 -0
  329. package/lib/typescript/memory/shareable.native.d.ts +15 -0
  330. package/lib/typescript/memory/shareable.native.d.ts.map +1 -0
  331. package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts +4 -0
  332. package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts.map +1 -0
  333. package/lib/typescript/memory/shareableHostUnpacker.native.d.ts +4 -0
  334. package/lib/typescript/memory/shareableHostUnpacker.native.d.ts.map +1 -0
  335. package/lib/typescript/memory/synchronizable.d.ts +3 -0
  336. package/lib/typescript/memory/synchronizable.d.ts.map +1 -0
  337. package/lib/typescript/memory/synchronizable.native.d.ts +3 -0
  338. package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -0
  339. package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +4 -0
  340. package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -0
  341. package/lib/typescript/memory/types.d.ts +136 -0
  342. package/lib/typescript/memory/types.d.ts.map +1 -0
  343. package/lib/typescript/memory/valueUnpacker.native.d.ts +7 -0
  344. package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -0
  345. package/lib/typescript/mock.d.ts +2 -0
  346. package/lib/typescript/mock.d.ts.map +1 -0
  347. package/lib/typescript/package.json +1 -0
  348. package/lib/typescript/platformChecker.d.ts +2 -0
  349. package/lib/typescript/platformChecker.d.ts.map +1 -0
  350. package/lib/typescript/platformChecker.native.d.ts +2 -0
  351. package/lib/typescript/platformChecker.native.d.ts.map +1 -0
  352. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
  353. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
  354. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
  355. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
  356. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
  357. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
  358. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
  359. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
  360. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
  361. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
  362. package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
  363. package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
  364. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
  365. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
  366. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
  367. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
  368. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
  369. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
  370. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
  371. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
  372. package/lib/typescript/runtimeKind.d.ts +56 -0
  373. package/lib/typescript/runtimeKind.d.ts.map +1 -0
  374. package/lib/typescript/runtimes.d.ts +15 -0
  375. package/lib/typescript/runtimes.d.ts.map +1 -0
  376. package/lib/typescript/runtimes.native.d.ts +155 -0
  377. package/lib/typescript/runtimes.native.d.ts.map +1 -0
  378. package/lib/typescript/specs/NativeWorkletsModule.d.ts +9 -0
  379. package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
  380. package/lib/typescript/specs/index.d.ts +3 -0
  381. package/lib/typescript/specs/index.d.ts.map +1 -0
  382. package/lib/typescript/threads.d.ts +8 -0
  383. package/lib/typescript/threads.d.ts.map +1 -0
  384. package/lib/typescript/threads.native.d.ts +125 -0
  385. package/lib/typescript/threads.native.d.ts.map +1 -0
  386. package/lib/typescript/types.d.ts +136 -0
  387. package/lib/typescript/types.d.ts.map +1 -0
  388. package/lib/typescript/workletFunction.d.ts +26 -0
  389. package/lib/typescript/workletFunction.d.ts.map +1 -0
  390. package/package.json +220 -0
  391. package/plugin/index.d.ts +168 -0
  392. package/plugin/index.js +2188 -0
  393. package/scripts/validate-react-native-version.js +43 -0
  394. package/scripts/worklets_utils.rb +94 -0
  395. package/src/WorkletsModule/NativeWorklets.native.ts +461 -0
  396. package/src/WorkletsModule/NativeWorklets.ts +5 -0
  397. package/src/WorkletsModule/workletsModuleProxy.ts +247 -0
  398. package/src/bundleMode/metroOverrides.native.ts +33 -0
  399. package/src/bundleMode/network.native.ts +63 -0
  400. package/src/debug/bundleMode.native.ts +18 -0
  401. package/src/debug/bundleMode.ts +5 -0
  402. package/src/debug/checkCppVersion.ts +34 -0
  403. package/src/debug/errors.native.ts +74 -0
  404. package/src/debug/jsVersion.ts +8 -0
  405. package/src/debug/logger.ts +16 -0
  406. package/src/debug/slowAnimations.native.ts +15 -0
  407. package/src/debug/slowAnimations.ts +6 -0
  408. package/src/deprecated.ts +38 -0
  409. package/src/featureFlags/featureFlags.native.ts +70 -0
  410. package/src/featureFlags/featureFlags.ts +20 -0
  411. package/src/featureFlags/staticFlags.json +6 -0
  412. package/src/featureFlags/types.ts +32 -0
  413. package/src/guardImplementation.native.ts +26 -0
  414. package/src/index.ts +95 -0
  415. package/src/initializers/initializers.native.ts +218 -0
  416. package/src/initializers/initializers.ts +24 -0
  417. package/src/memory/bundleUnpacker.native.ts +59 -0
  418. package/src/memory/customSerializableUnpacker.native.ts +30 -0
  419. package/src/memory/isShareable.ts +16 -0
  420. package/src/memory/isSynchronizable.ts +14 -0
  421. package/src/memory/remoteFunctionUnpacker.native.ts +27 -0
  422. package/src/memory/serializable.native.ts +889 -0
  423. package/src/memory/serializable.ts +36 -0
  424. package/src/memory/serializableMappingCache.native.ts +37 -0
  425. package/src/memory/serializableMappingCache.ts +12 -0
  426. package/src/memory/shareable.native.ts +68 -0
  427. package/src/memory/shareable.ts +27 -0
  428. package/src/memory/shareableGuestUnpacker.native.ts +168 -0
  429. package/src/memory/shareableHostUnpacker.native.ts +31 -0
  430. package/src/memory/synchronizable.native.ts +17 -0
  431. package/src/memory/synchronizable.ts +9 -0
  432. package/src/memory/synchronizableUnpacker.native.ts +65 -0
  433. package/src/memory/types.ts +191 -0
  434. package/src/memory/valueUnpacker.native.ts +79 -0
  435. package/src/mock.ts +111 -0
  436. package/src/platformChecker.native.ts +3 -0
  437. package/src/platformChecker.ts +4 -0
  438. package/src/privateGlobals.d.ts +127 -0
  439. package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
  440. package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
  441. package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
  442. package/src/runLoop/uiRuntime/requestAnimationFrame.ts +87 -0
  443. package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
  444. package/src/runLoop/workletRuntime/index.ts +18 -0
  445. package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
  446. package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
  447. package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
  448. package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
  449. package/src/runtimeKind.ts +85 -0
  450. package/src/runtimes.native.ts +572 -0
  451. package/src/runtimes.ts +107 -0
  452. package/src/specs/NativeWorkletsModule.ts +11 -0
  453. package/src/specs/index.ts +13 -0
  454. package/src/threads.native.ts +408 -0
  455. package/src/threads.ts +110 -0
  456. package/src/types.ts +164 -0
  457. package/src/workletFunction.ts +41 -0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @depup/react-native-worklets
2
+
3
+ > Dependency-bumped version of [react-native-worklets](https://www.npmjs.com/package/react-native-worklets)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/react-native-worklets
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [react-native-worklets](https://www.npmjs.com/package/react-native-worklets) @ 0.11.3 |
17
+ | Processed | 2026-07-26 |
18
+ | Smoke test | failed |
19
+ | Deps updated | 13 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | @babel/generator | ^7.27.1 | ^8.0.0 |
26
+ | @babel/plugin-transform-arrow-functions | ^7.27.1 | ^8.0.1 |
27
+ | @babel/plugin-transform-class-properties | ^7.28.6 | ^8.0.1 |
28
+ | @babel/plugin-transform-classes | ^7.28.6 | ^8.0.1 |
29
+ | @babel/plugin-transform-nullish-coalescing-operator | ^7.28.6 | ^8.0.1 |
30
+ | @babel/plugin-transform-optional-chaining | ^7.28.6 | ^8.0.1 |
31
+ | @babel/plugin-transform-shorthand-properties | ^7.27.1 | ^8.0.1 |
32
+ | @babel/plugin-transform-template-literals | ^7.27.1 | ^8.0.1 |
33
+ | @babel/plugin-transform-unicode-regex | ^7.27.1 | ^8.0.1 |
34
+ | @babel/preset-typescript | ^7.28.5 | ^8.0.1 |
35
+ | @babel/traverse | ^7.27.1 | ^8.0.4 |
36
+ | @babel/types | ^7.27.1 | ^8.0.4 |
37
+ | semver | ^7.7.4 | ^7.8.5 |
38
+
39
+ ---
40
+
41
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/react-native-worklets
42
+
43
+ License inherited from the original package.
@@ -0,0 +1,94 @@
1
+ require "json"
2
+ require_relative './scripts/worklets_utils'
3
+
4
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+ worklets_config = WorkletsUtils.find_config()
6
+ WorkletsUtils.assert_minimal_react_native_version(worklets_config)
7
+
8
+ ios_min_version = '13.4'
9
+
10
+ # Directory in which data for further processing for clangd will be stored.
11
+ compilation_metadata_dir = "CompilationDatabase"
12
+ # We want generate the metadata only within the monorepo of Reanimated.
13
+ compilation_metadata_generation_flag = worklets_config[:is_reanimated_example_app] ? "-gen-cdb-fragment-path #{compilation_metadata_dir}" : ''
14
+
15
+
16
+ feature_flags = worklets_config[:feature_flags_flag]
17
+ version_flag = "-DWORKLETS_VERSION=#{package['version']}"
18
+ worklets_profiling_flag = ENV['IS_WORKLETS_PROFILING'] ? '-DWORKLETS_PROFILING' : ''
19
+ fetch_preview_flag = worklets_config[:fetch_preview_flag]
20
+ hermes_v1_flag = ENV['RCT_HERMES_V1_ENABLED'] == '1' ? '-DHERMES_V1_ENABLED' : ''
21
+
22
+ # React Native doesn't expose these flags, but not having them
23
+ # can lead to runtime errors due to ABI mismatches.
24
+ # There's also
25
+ # HERMESVM_PROFILER_OPCODE
26
+ # HERMESVM_PROFILER_BB
27
+ # which shouldn't be defined in standard setups.
28
+ hermes_debug_hidden_flags = 'HERMES_ENABLE_DEBUGGER=1'
29
+
30
+ Pod::Spec.new do |s|
31
+ s.name = "RNWorklets"
32
+ s.version = package["version"]
33
+ s.summary = package["description"]
34
+ s.homepage = "https://github.com/software-mansion/react-native-reanimated"
35
+ s.license = package["license"]
36
+ s.authors = { "author" => "author@domain.com" }
37
+ s.platforms = { :ios => ios_min_version, :tvos => "9.0", :osx => "10.14", :visionos => "1.0" }
38
+ s.source = { :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "#{s.version}" }
39
+
40
+ s.header_dir = "worklets"
41
+
42
+ s.subspec "common" do |ss|
43
+ ss.source_files = "Common/cpp/worklets/**/*.{cpp,h}"
44
+ ss.public_header_files = "Common/cpp/worklets/**/*.h"
45
+ ss.header_mappings_dir = "Common/cpp/worklets"
46
+ end
47
+
48
+ s.subspec "apple" do |ss|
49
+ ss.source_files = "apple/worklets/**/*.{mm,h,m}"
50
+ ss.public_header_files = "apple/worklets/**/*.h"
51
+ ss.header_mappings_dir = "apple/worklets"
52
+ end
53
+
54
+ # Use install_modules_dependencies helper to install the dependencies.
55
+ # See https://github.com/facebook/react-native/blob/c925872e72d2422be46670777bfa2111e13c9e4c/packages/react-native/scripts/cocoapods/new_architecture.rb#L71.
56
+ install_modules_dependencies(s)
57
+
58
+ s.dependency 'React-jsi'
59
+ s.dependency 'React-hermes'
60
+ s.pod_target_xcconfig = {
61
+ "USE_HEADERMAP" => "YES",
62
+ "DEFINES_MODULE" => "YES",
63
+ "HEADER_SEARCH_PATHS" => [
64
+ '"$(PODS_TARGET_SRCROOT)/ReactCommon"',
65
+ '"$(PODS_TARGET_SRCROOT)"',
66
+ '"$(PODS_ROOT)/RCT-Folly"',
67
+ '"$(PODS_ROOT)/boost"',
68
+ '"$(PODS_ROOT)/boost-for-react-native"',
69
+ '"$(PODS_ROOT)/DoubleConversion"',
70
+ '"$(PODS_ROOT)/Headers/Private/React-Core"',
71
+ '"$(PODS_ROOT)/Headers/Private/Yoga"',
72
+ '"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/react/utils/platform/ios"',
73
+ ].join(' '),
74
+ "FRAMEWORK_SEARCH_PATHS" => '"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes"',
75
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
76
+ "GCC_PREPROCESSOR_DEFINITIONS[config=*Debug*]" => "$(inherited) #{hermes_debug_hidden_flags}",
77
+ "GCC_PREPROCESSOR_DEFINITIONS[config=*Release*]" => "$(inherited)",
78
+ "OTHER_CFLAGS" => "$(inherited) #{feature_flags} #{version_flag} #{compilation_metadata_generation_flag} #{worklets_profiling_flag} #{fetch_preview_flag} #{hermes_v1_flag}",
79
+ }
80
+ s.xcconfig = {
81
+ "HEADER_SEARCH_PATHS" => [
82
+ '"$(PODS_ROOT)/boost"',
83
+ '"$(PODS_ROOT)/boost-for-react-native"',
84
+ '"$(PODS_ROOT)/glog"',
85
+ '"$(PODS_ROOT)/RCT-Folly"',
86
+ '"$(PODS_ROOT)/Headers/Public/React-hermes"',
87
+ '"$(PODS_ROOT)/Headers/Public/hermes-engine"',
88
+ # for static frameworks
89
+ "\"$(PODS_ROOT)/#{worklets_config[:react_native_common_dir]}\"",
90
+ "\"$(PODS_ROOT)/#{worklets_config[:react_native_common_dir]}/jsitooling\"",
91
+ ].join(' '),
92
+ }
93
+
94
+ end
@@ -0,0 +1,108 @@
1
+ project(Worklets)
2
+ cmake_minimum_required(VERSION 3.16)
3
+
4
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
5
+
6
+ set(CMAKE_CXX_STANDARD 20)
7
+
8
+ # Consume shared libraries and headers from prefabs
9
+ find_package(fbjni REQUIRED CONFIG)
10
+ find_package(ReactAndroid REQUIRED CONFIG)
11
+ find_package(hermes-engine REQUIRED CONFIG)
12
+
13
+ # default CMAKE_CXX_FLAGS: "-g -DANDROID -fdata-sections -ffunction-sections
14
+ # -funwind-tables -fstack-protector-strong -no-canonical-prefixes
15
+ # -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-protector-all"
16
+ include("${REACT_NATIVE_DIR}/ReactAndroid/cmake-utils/folly-flags.cmake")
17
+ add_compile_options(${folly_FLAGS})
18
+
19
+ string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_VERSION=${WORKLETS_VERSION}\
20
+ -DWORKLETS_FEATURE_FLAGS=\"${WORKLETS_FEATURE_FLAGS}\"")
21
+
22
+ # HERMES_V1_ENABLED is centralized in react-native-flags.cmake for RN >= 84.
23
+ # Only define manually for older versions to avoid macro redefinition error.
24
+ if(ReactAndroid_VERSION_MINOR LESS 84)
25
+ string(APPEND CMAKE_CXX_FLAGS " -DHERMES_V1_ENABLED=${HERMES_V1_ENABLED}")
26
+ else()
27
+ # Reference the value so CMake records it as used, otherwise it warns:
28
+ # "Manually-specified variables were not used by the project:
29
+ # HERMES_V1_ENABLED"
30
+ set(HERMES_V1_ENABLED "${HERMES_V1_ENABLED}")
31
+ endif()
32
+
33
+ string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer -fstack-protector-all")
34
+
35
+ if(${WORKLETS_PROFILING})
36
+ string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_PROFILING")
37
+ endif()
38
+ if(${IS_REANIMATED_EXAMPLE_APP})
39
+ string(APPEND CMAKE_CXX_FLAGS " -DIS_REANIMATED_EXAMPLE_APP -Wpedantic")
40
+ endif()
41
+ if(${WORKLETS_FETCH_PREVIEW_ENABLED})
42
+ string(APPEND CMAKE_CXX_FLAGS " -DWORKLETS_FETCH_PREVIEW_ENABLED")
43
+ endif()
44
+
45
+ if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
46
+ string(APPEND CMAKE_CXX_FLAGS " -DNDEBUG")
47
+ endif()
48
+
49
+ set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build")
50
+ set(ANDROID_CPP_DIR "${CMAKE_SOURCE_DIR}/src/main/cpp")
51
+ set(COMMON_CPP_DIR "${CMAKE_SOURCE_DIR}/../Common/cpp")
52
+
53
+ file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS
54
+ "${COMMON_CPP_DIR}/worklets/*.cpp")
55
+ file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS
56
+ "${ANDROID_CPP_DIR}/worklets/*.cpp")
57
+
58
+ add_library(worklets SHARED ${WORKLETS_COMMON_CPP_SOURCES}
59
+ ${WORKLETS_ANDROID_CPP_SOURCES})
60
+
61
+ target_precompile_headers(worklets PRIVATE "${ANDROID_CPP_DIR}/WorkletsPCH.h")
62
+
63
+ # Stop Clang from embedding a build timestamp in the .pch. Without this the PCH
64
+ # is non-reproducible across builds, so ccache can't reuse it and translation
65
+ # units reject a restored PCH as "modified since built".
66
+ target_compile_options(
67
+ worklets PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Xclang;-fno-pch-timestamp>")
68
+
69
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 80)
70
+ include(
71
+ "${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
72
+ target_compile_reactnative_options(worklets PUBLIC)
73
+ else()
74
+ string(APPEND CMAKE_CXX_FLAGS
75
+ " -fexceptions -frtti -std=c++${CMAKE_CXX_STANDARD} -Wall -Werror")
76
+ endif()
77
+
78
+ # includes
79
+ target_include_directories(worklets PUBLIC "${COMMON_CPP_DIR}"
80
+ "${ANDROID_CPP_DIR}")
81
+
82
+ target_include_directories(
83
+ worklets
84
+ PRIVATE "${REACT_NATIVE_DIR}/ReactCommon"
85
+ "${REACT_NATIVE_DIR}/ReactCommon/yoga"
86
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
87
+ "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon"
88
+ "${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
89
+ "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
90
+ "${REACT_NATIVE_DIR}/ReactCommon/jsiexecutor"
91
+ "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
92
+ )
93
+
94
+ # build shared lib
95
+ set_target_properties(worklets PROPERTIES LINKER_LANGUAGE CXX)
96
+
97
+ target_link_libraries(worklets android log ReactAndroid::reactnative
98
+ ReactAndroid::jsi fbjni::fbjni)
99
+
100
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 82)
101
+ target_link_libraries(worklets hermes-engine::hermesvm)
102
+ else()
103
+ target_link_libraries(worklets hermes-engine::libhermes)
104
+ endif()
105
+
106
+ if(${HERMES_ENABLE_DEBUGGER})
107
+ string(APPEND CMAKE_CXX_FLAGS " -DHERMES_ENABLE_DEBUGGER=1")
108
+ endif()
@@ -0,0 +1,369 @@
1
+ import groovy.json.JsonSlurper
2
+ import org.apache.tools.ant.taskdefs.condition.Os
3
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
+ import java.util.Properties
5
+ import javax.inject.Inject
6
+
7
+ plugins {
8
+ id("com.android.library")
9
+ id("maven-publish")
10
+ id("com.diffplug.spotless") version "8.1.0"
11
+ id("org.jetbrains.kotlin.android")
12
+ }
13
+
14
+ fun safeExtGet(prop: String, fallback: Any?): Any? =
15
+ if (rootProject.extensions.extraProperties.has(prop)) rootProject.extensions.extraProperties.get(prop) else fallback
16
+
17
+ fun safeAppExtGet(prop: String, fallback: Any?): Any? {
18
+ val appProject = rootProject.allprojects.find { it.plugins.hasPlugin("com.android.application") }
19
+ return if (appProject?.extensions?.extraProperties?.has(prop) == true)
20
+ appProject.extensions.extraProperties.get(prop)
21
+ else
22
+ fallback
23
+ }
24
+
25
+ fun resolveReactNativeDirectory(): File {
26
+ val reactNativeLocationProperty = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
27
+ if (reactNativeLocationProperty != null) {
28
+ return when (reactNativeLocationProperty) {
29
+ is File -> reactNativeLocationProperty
30
+ is String -> file(reactNativeLocationProperty)
31
+ else -> file(reactNativeLocationProperty.toString())
32
+ }
33
+ }
34
+
35
+ // Fallback to node resolver for custom directory structures like monorepos.
36
+ val reactNativePackage = file(
37
+ providers.exec {
38
+ workingDir(rootDir)
39
+ commandLine("node", "--print", "require.resolve('react-native/package.json')")
40
+ }.standardOutput.asText.get().trim()
41
+ )
42
+ if (reactNativePackage.exists()) {
43
+ return reactNativePackage.parentFile
44
+ }
45
+
46
+ throw GradleException(
47
+ "[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."
48
+ )
49
+ }
50
+
51
+ fun getReactNativeVersion(): String {
52
+ val reactNativeRootDir = resolveReactNativeDirectory()
53
+ val reactProperties = Properties()
54
+ file("$reactNativeRootDir/ReactAndroid/gradle.properties").inputStream().use { reactProperties.load(it) }
55
+ return reactProperties.getProperty("VERSION_NAME")
56
+ }
57
+
58
+ fun getReactNativeMinorVersion(): Int {
59
+ val reactNativeVersion = getReactNativeVersion()
60
+ return if (reactNativeVersion.startsWith("0.0.0-")) 1000 else reactNativeVersion.split(".")[1].toInt()
61
+ }
62
+
63
+ fun getHermesV1Enabled(): Boolean {
64
+ // Even though `HERMES_V1_ENABLED` is now centralized
65
+ // in `react-native-flags.cmake` for React Native >= 0.84
66
+ // that CMake file depends on definitions provided
67
+ // in local `externalNativeBuild` configuration of the LIBRARY.
68
+ // I hope this is only a temporary workaround.
69
+ return if (getReactNativeMinorVersion() >= 84) {
70
+ safeAppExtGet("hermesV1Enabled", true)?.toString()?.toBoolean() ?: true
71
+ } else {
72
+ safeAppExtGet("hermesV1Enabled", false)?.toString()?.toBoolean() ?: false
73
+ }
74
+ }
75
+
76
+ fun getWorkletsVersion(): String {
77
+ val inputFile = file("${projectDir.path}/../package.json")
78
+ val json = JsonSlurper().parseText(inputFile.readText()) as Map<*, *>
79
+ return json["version"]?.toString() ?: throw GradleException("[Worklets] Cannot find version in package.json")
80
+ }
81
+
82
+ fun toPlatformFileString(path: String): String {
83
+ var result = path
84
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
85
+ result = result.replace(File.separatorChar, '/')
86
+ }
87
+ return result
88
+ }
89
+
90
+ fun getStaticFeatureFlags(): Map<String, String> {
91
+ val featureFlags = HashMap<String, String>()
92
+
93
+ val staticFeatureFlagsFile = file("${projectDir.path}/../src/featureFlags/staticFlags.json")
94
+ if (!staticFeatureFlagsFile.exists()) {
95
+ throw GradleException("[Worklets] Feature flags file not found at ${staticFeatureFlagsFile.absolutePath}.")
96
+ }
97
+ (JsonSlurper().parseText(staticFeatureFlagsFile.readText()) as Map<*, *>).forEach { (key, value) ->
98
+ featureFlags[key.toString()] = value.toString()
99
+ }
100
+
101
+ val packageJsonFile = file("${rootDir.path}/../package.json")
102
+ if (packageJsonFile.exists()) {
103
+ val packageJson = JsonSlurper().parseText(packageJsonFile.readText()) as Map<*, *>
104
+ (packageJson["worklets"] as? Map<*, *>)
105
+ ?.get("staticFeatureFlags")
106
+ ?.let { it as? Map<*, *> }
107
+ ?.forEach { (key, value) -> featureFlags[key.toString()] = value.toString() }
108
+ }
109
+
110
+ return featureFlags
111
+ }
112
+
113
+ fun getStaticFeatureFlagsString(featureFlags: Map<String, String>): String =
114
+ featureFlags.entries.joinToString("") { (key, value) -> "[$key:$value]" }
115
+
116
+ fun isFlagEnabled(featureFlags: Map<String, String>, flagName: String): Boolean =
117
+ featureFlags.containsKey(flagName) && featureFlags[flagName] == "true"
118
+
119
+ if (project != rootProject) {
120
+ apply(plugin = "com.facebook.react")
121
+ }
122
+
123
+ val featureFlags = getStaticFeatureFlags()
124
+
125
+ val packageDir: File = project.projectDir.parentFile
126
+ val reactNativeRootDir: File = resolveReactNativeDirectory()
127
+ val REACT_NATIVE_VERSION: String = getReactNativeVersion()
128
+ val WORKLETS_VERSION: String = getWorkletsVersion()
129
+ val IS_REANIMATED_EXAMPLE_APP: Boolean = safeAppExtGet("isReanimatedExampleApp", false)?.toString()?.toBoolean() ?: false
130
+ val FETCH_PREVIEW_ENABLED: Boolean = isFlagEnabled(featureFlags, "FETCH_PREVIEW_ENABLED")
131
+ val WORKLETS_FEATURE_FLAGS: String = getStaticFeatureFlagsString(featureFlags)
132
+ val HERMES_V1_ENABLED: Boolean = getHermesV1Enabled()
133
+ val WORKLETS_PROFILING: Boolean = safeAppExtGet("enableWorkletsProfiling", false)?.toString()?.toBoolean() ?: false
134
+
135
+ // Set version for prefab
136
+ version = WORKLETS_VERSION
137
+
138
+ val workletsPrefabHeadersDir: File = project.file("${layout.buildDirectory.get().asFile.absolutePath}/prefab-headers/worklets")
139
+
140
+ fun reactNativeArchitectures(): List<String> {
141
+ val value = project.findProperty("reactNativeArchitectures") as String?
142
+ return value?.split(",")
143
+ ?.map { it.trim() }
144
+ ?.filter { it.isNotEmpty() }
145
+ ?.ifEmpty { null }
146
+ ?: listOf("armeabi-v7a", "x86", "x86_64", "arm64-v8a")
147
+ }
148
+
149
+ if (project == rootProject) {
150
+ spotless {
151
+ kotlin {
152
+ target("src/**/*.kt")
153
+ ktlint()
154
+ }
155
+ }
156
+ }
157
+
158
+ apply(from = "./fix-prefab.gradle.kts")
159
+ apply(from = "./generate-stub-pch.gradle.kts")
160
+
161
+ android {
162
+ compileSdk = safeExtGet("compileSdkVersion", 36) as Int
163
+
164
+ namespace = "com.swmansion.worklets"
165
+
166
+ val resolvedNdkPath = rootProject.findProperty("ndkPath") as? String
167
+ if (!resolvedNdkPath.isNullOrEmpty()) {
168
+ ndkPath = resolvedNdkPath
169
+ }
170
+
171
+ val resolvedNdkVersion = rootProject.findProperty("ndkVersion") as? String
172
+ if (!resolvedNdkVersion.isNullOrEmpty()) {
173
+ ndkVersion = resolvedNdkVersion
174
+ }
175
+
176
+ buildFeatures {
177
+ prefab = true
178
+ prefabPublishing = true
179
+ buildConfig = true
180
+ }
181
+
182
+ prefab {
183
+ create("worklets") {
184
+ headers = workletsPrefabHeadersDir.absolutePath
185
+ }
186
+ }
187
+
188
+ defaultConfig {
189
+ minSdk = safeExtGet("minSdkVersion", 24) as Int
190
+ testOptions.targetSdk = safeExtGet("targetSdkVersion", 36) as Int
191
+ lint.targetSdk = safeExtGet("targetSdkVersion", 36) as Int
192
+
193
+ buildConfigField("boolean", "WORKLETS_PROFILING", WORKLETS_PROFILING.toString())
194
+ buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
195
+ buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
196
+
197
+ @Suppress("UnstableApiUsage")
198
+ externalNativeBuild {
199
+ cmake {
200
+ arguments(
201
+ "-DANDROID_STL=c++_shared",
202
+ "-DANDROID_TOOLCHAIN=clang",
203
+ "-DREACT_NATIVE_DIR=${toPlatformFileString(reactNativeRootDir.path)}",
204
+ "-DIS_REANIMATED_EXAMPLE_APP=$IS_REANIMATED_EXAMPLE_APP",
205
+ "-DWORKLETS_FETCH_PREVIEW_ENABLED=$FETCH_PREVIEW_ENABLED",
206
+ "-DWORKLETS_PROFILING=$WORKLETS_PROFILING",
207
+ "-DWORKLETS_VERSION=$WORKLETS_VERSION",
208
+ "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
209
+ "-DWORKLETS_FEATURE_FLAGS=$WORKLETS_FEATURE_FLAGS",
210
+ "-DHERMES_V1_ENABLED=$HERMES_V1_ENABLED"
211
+ )
212
+ abiFilters.addAll(reactNativeArchitectures())
213
+ targets("worklets")
214
+ }
215
+ }
216
+
217
+ consumerProguardFiles("proguard-rules.pro")
218
+ }
219
+
220
+ externalNativeBuild {
221
+ cmake {
222
+ path = file("CMakeLists.txt")
223
+ }
224
+ }
225
+
226
+ buildTypes {
227
+ debug {
228
+ @Suppress("UnstableApiUsage")
229
+ externalNativeBuild {
230
+ cmake {
231
+ // React Native doesn't expose these flags, but not having them
232
+ // can lead to runtime errors due to ABI mismatches.
233
+ // There's also
234
+ // HERMESVM_PROFILER_OPCODE
235
+ // HERMESVM_PROFILER_BB
236
+ // which shouldn't be defined in standard setups.
237
+ arguments("-DHERMES_ENABLE_DEBUGGER=1")
238
+ }
239
+ }
240
+ }
241
+ }
242
+
243
+ lint {
244
+ abortOnError = false
245
+ }
246
+
247
+ packaging {
248
+ // For some reason gradle only complains about the duplicated version of librrc_root and libreact_render libraries
249
+ // while there are more libraries copied in intermediates folder of the lib build directory, we exclude
250
+ // only the ones that make the build fail (ideally we should only include libworklets but we
251
+ // are only allowed to specify exclude patterns)
252
+ resources {
253
+ excludes += setOf(
254
+ "META-INF",
255
+ "META-INF/**",
256
+ )
257
+ }
258
+ jniLibs {
259
+ excludes += setOf(
260
+ "**/libc++_shared.so",
261
+ "**/libfbjni.so",
262
+ "**/libjsi.so",
263
+ "**/libhermes.so",
264
+ "**/libhermesvm.so",
265
+ "**/libreactnative.so",
266
+ )
267
+ }
268
+ }
269
+
270
+ compileOptions {
271
+ sourceCompatibility = JavaVersion.VERSION_17
272
+ targetCompatibility = JavaVersion.VERSION_17
273
+ }
274
+
275
+ sourceSets {
276
+ getByName("main") {
277
+ java {
278
+ if (FETCH_PREVIEW_ENABLED) {
279
+ srcDir("src/networking")
280
+ } else {
281
+ srcDir("src/no-networking")
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ if (IS_REANIMATED_EXAMPLE_APP) {
288
+ apply(from = "../../../scripts/llvm-tools/android-hook.gradle.kts")
289
+ }
290
+ }
291
+
292
+ if (project != rootProject) {
293
+ kotlin {
294
+ compilerOptions {
295
+ jvmTarget = JvmTarget.fromTarget("17")
296
+ }
297
+ }
298
+ }
299
+
300
+ androidComponents {
301
+ onVariants(selector().withBuildType("debug")) {
302
+ it.packaging.jniLibs.keepDebugSymbols.add("**/**/*.so")
303
+ }
304
+ }
305
+
306
+ val validateReactNativeVersionResult = providers.exec {
307
+ workingDir(projectDir.path)
308
+ commandLine("node", "./../scripts/validate-react-native-version.js", REACT_NATIVE_VERSION)
309
+ isIgnoreExitValue = true
310
+ }
311
+
312
+ tasks.register("assertMinimalReactNativeVersionTask") {
313
+ val result = validateReactNativeVersionResult
314
+ doFirst {
315
+ if (result.result.get().exitValue != 0) {
316
+ throw GradleException(result.standardError.asText.get().trim())
317
+ }
318
+ }
319
+ }
320
+
321
+ tasks.named("preBuild") { dependsOn("assertMinimalReactNativeVersionTask") }
322
+
323
+ // Workaround for AGP 9 + Kotlin 2.x lint K2 UAST crash on .gradle.kts build scripts.
324
+ // See: https://issuetracker.google.com/issues/432144179
325
+ tasks.configureEach { if (name.startsWith("lintVital")) enabled = false }
326
+
327
+ tasks.register<Copy>("prepareWorkletsHeadersForPrefabs") {
328
+ from("$projectDir/src/main/cpp")
329
+ from("$projectDir/../Common/cpp")
330
+ include("worklets/**/*.h")
331
+ into(workletsPrefabHeadersDir.absolutePath)
332
+ }
333
+
334
+ interface FSService {
335
+ @get:Inject
336
+ val fs: FileSystemOperations
337
+ }
338
+
339
+ tasks.register("cleanCMakeCache") {
340
+ val fsProvider = project.objects.newInstance<FSService>()
341
+ val cxxDir = file("${projectDir}/.cxx")
342
+ doFirst {
343
+ fsProvider.fs.delete {
344
+ delete(cxxDir)
345
+ }
346
+ }
347
+ }
348
+
349
+ repositories {
350
+ mavenCentral()
351
+ google()
352
+ }
353
+
354
+ dependencies {
355
+ "implementation"("com.facebook.yoga:proguard-annotations:1.19.0")
356
+ "implementation"("androidx.transition:transition:1.6.0")
357
+ "implementation"("androidx.core:core:1.15.0")
358
+ "implementation"("com.facebook.react:react-android") // version substituted by RNGP
359
+ "implementation"("androidx.core:core-ktx:1.17.0")
360
+ "implementation"("com.facebook.react:hermes-android") // version substituted by RNGP
361
+ }
362
+
363
+ tasks.named("preBuild") { dependsOn("prepareWorkletsHeadersForPrefabs") }
364
+
365
+ afterEvaluate {
366
+ tasks.named("clean") {
367
+ finalizedBy("cleanCMakeCache")
368
+ }
369
+ }
@@ -0,0 +1,56 @@
1
+ fun reactNativeArchitectures(): List<String> {
2
+ val value = project.findProperty("reactNativeArchitectures") as String?
3
+ return value?.split(",")
4
+ ?.map { it.trim() }
5
+ ?.filter { it.isNotEmpty() }
6
+ ?.ifEmpty { null }
7
+ ?: listOf("armeabi-v7a", "x86", "x86_64", "arm64-v8a")
8
+ }
9
+
10
+ tasks.configureEach {
11
+ // Make sure that we generate our prefab publication file only after having built the native library
12
+ // so that not a header publication file, but a full configuration publication will be generated, which
13
+ // will include the .so file
14
+ val prefabConfigurePattern = Regex("^prefab(.+)ConfigurePackage$")
15
+ val matchResult = prefabConfigurePattern.matchEntire(name)
16
+ if (matchResult != null) {
17
+ val variantName = matchResult.groupValues[1]
18
+ outputs.upToDateWhen { false }
19
+ dependsOn("externalNativeBuild$variantName")
20
+ }
21
+ }
22
+
23
+ afterEvaluate {
24
+ val abis = reactNativeArchitectures()
25
+ rootProject.allprojects.forEach { proj ->
26
+ if (proj === rootProject) {
27
+ return@forEach
28
+ }
29
+
30
+ val dependsOnThisLib = proj.configurations.any { config ->
31
+ config.dependencies.any { dep ->
32
+ dep.group == project.group && dep.name == project.name
33
+ }
34
+ }
35
+ if (!dependsOnThisLib && proj != project) return@forEach
36
+
37
+ if (!proj.plugins.hasPlugin("com.android.application") && !proj.plugins.hasPlugin("com.android.library")) {
38
+ return@forEach
39
+ }
40
+
41
+ // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
42
+ // generate a libnameConfig.cmake file that will contain our native library (.so).
43
+ // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
44
+ val cxxDir = File(proj.projectDir, ".cxx")
45
+ if (!cxxDir.exists()) return@forEach
46
+ cxxDir.listFiles { dir -> dir.isDirectory }?.forEach { variantDir ->
47
+ val randomDirs = variantDir.listFiles { dir -> dir.isDirectory }
48
+ abis.forEach { abi ->
49
+ randomDirs?.forEach { randomDir ->
50
+ val prefabFile = File(randomDir, "$abi/prefab_config.json")
51
+ if (prefabFile.exists()) prefabFile.setLastModified(System.currentTimeMillis())
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }