@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.
Files changed (348) hide show
  1. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +71 -0
  2. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
  3. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +712 -0
  4. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +88 -0
  5. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +89 -0
  6. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +80 -0
  7. package/Common/cpp/worklets/Public/AsyncQueue.h +14 -0
  8. package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -0
  9. package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +51 -0
  10. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -0
  11. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +40 -0
  12. package/Common/cpp/worklets/Resources/SynchronizableUnpacker.cpp +49 -0
  13. package/Common/cpp/worklets/Resources/Unpackers.h +6 -0
  14. package/Common/cpp/worklets/Resources/ValueUnpacker.cpp +53 -0
  15. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +62 -0
  16. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +46 -0
  17. package/Common/cpp/worklets/RunLoop/EventLoop.cpp +112 -0
  18. package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
  19. package/Common/cpp/worklets/SharedItems/Serializable.cpp +545 -0
  20. package/Common/cpp/worklets/SharedItems/Serializable.h +473 -0
  21. package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +67 -0
  22. package/Common/cpp/worklets/SharedItems/Synchronizable.h +59 -0
  23. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +81 -0
  24. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
  25. package/Common/cpp/worklets/Tools/Defs.h +10 -0
  26. package/Common/cpp/worklets/Tools/FeatureFlags.cpp +15 -0
  27. package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
  28. package/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -0
  29. package/Common/cpp/worklets/Tools/JSISerializer.h +51 -0
  30. package/Common/cpp/worklets/Tools/JSLogger.cpp +68 -0
  31. package/Common/cpp/worklets/Tools/JSLogger.h +37 -0
  32. package/Common/cpp/worklets/Tools/JSScheduler.cpp +24 -0
  33. package/Common/cpp/worklets/Tools/JSScheduler.h +39 -0
  34. package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
  35. package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +82 -0
  36. package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
  37. package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
  38. package/Common/cpp/worklets/Tools/UIScheduler.h +26 -0
  39. package/Common/cpp/worklets/Tools/VersionUtils.cpp +75 -0
  40. package/Common/cpp/worklets/Tools/VersionUtils.h +28 -0
  41. package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -0
  42. package/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -0
  43. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +46 -0
  44. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +208 -0
  45. package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +161 -0
  46. package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +54 -0
  47. package/Common/cpp/worklets/Tools/WorkletsVersion.h +20 -0
  48. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +38 -0
  49. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +21 -0
  50. package/Common/cpp/worklets/WorkletRuntime/RuntimeData.cpp +3 -0
  51. package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +12 -0
  52. package/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -0
  53. package/Common/cpp/worklets/WorkletRuntime/RuntimeKind.h +16 -0
  54. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +105 -0
  55. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +63 -0
  56. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +23 -0
  57. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +16 -0
  58. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +119 -0
  59. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +134 -0
  60. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +244 -0
  61. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +102 -0
  62. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
  63. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +308 -0
  64. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +26 -0
  65. package/LICENSE +7 -0
  66. package/README.md +31 -0
  67. package/RNWorklets.podspec +94 -0
  68. package/SystemBundles/cc12deac6e91c435b76698c8445aed85612f2f88e733218d14f88a35d06fb0f4.bundle +10512 -0
  69. package/SystemBundles/cc12deac6e91c435b76698c8445aed85612f2f88e733218d14f88a35d06fb0f4.map +3771 -0
  70. package/SystemModules/amzn__react-native-worklets-1.modules.txt +39 -0
  71. package/SystemModules/amzn__react-native-worklets-1.private.modules.txt +61 -0
  72. package/SystemModules/keplerscript-system-bundle-config.json +7 -0
  73. package/android/CMakeLists.txt +124 -0
  74. package/android/build.gradle +350 -0
  75. package/android/gradle.properties +5 -0
  76. package/android/proguard-rules.pro +3 -0
  77. package/android/spotless.gradle +9 -0
  78. package/android/src/experimentalBundling/com/swmansion/worklets/WorkletsModule.java +149 -0
  79. package/android/src/legacyBundling/com/swmansion/worklets/WorkletsModule.java +122 -0
  80. package/android/src/main/AndroidManifest.xml +2 -0
  81. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +63 -0
  82. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +43 -0
  83. package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +34 -0
  84. package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +29 -0
  85. package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +115 -0
  86. package/android/src/main/cpp/worklets/android/WorkletsModule.h +78 -0
  87. package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +13 -0
  88. package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.java +60 -0
  89. package/android/src/main/java/com/swmansion/worklets/JSCallInvokerResolver.java +27 -0
  90. package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThread.java +16 -0
  91. package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThreadBase.java +73 -0
  92. package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.java +48 -0
  93. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.java +19 -0
  94. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.java +113 -0
  95. package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
  96. package/apple/worklets/apple/AnimationFrameQueue.mm +135 -0
  97. package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
  98. package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +16 -0
  99. package/apple/worklets/apple/IOSUIScheduler.h +15 -0
  100. package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
  101. package/apple/worklets/apple/PlatformLogger.mm +31 -0
  102. package/apple/worklets/apple/SlowAnimations.h +8 -0
  103. package/apple/worklets/apple/SlowAnimations.mm +45 -0
  104. package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
  105. package/apple/worklets/apple/WorkletsMessageThread.h +16 -0
  106. package/apple/worklets/apple/WorkletsMessageThread.mm +31 -0
  107. package/apple/worklets/apple/WorkletsModule.h +28 -0
  108. package/apple/worklets/apple/WorkletsModule.mm +121 -0
  109. package/bundleMode/index.d.ts +3 -0
  110. package/bundleMode/index.js +59 -0
  111. package/compatibility.json +11 -0
  112. package/kepler-compatibility.json +5 -0
  113. package/kepler-transformed-package-info.json +3 -0
  114. package/lib/module/PlatformChecker/PlatformChecker.js +8 -0
  115. package/lib/module/PlatformChecker/PlatformChecker.js.map +1 -0
  116. package/lib/module/PlatformChecker/index.js +18 -0
  117. package/lib/module/PlatformChecker/index.js.map +1 -0
  118. package/lib/module/WorkletsError.js +29 -0
  119. package/lib/module/WorkletsError.js.map +1 -0
  120. package/lib/module/WorkletsModule/JSWorklets.js +111 -0
  121. package/lib/module/WorkletsModule/JSWorklets.js.map +1 -0
  122. package/lib/module/WorkletsModule/NativeWorklets.js +126 -0
  123. package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
  124. package/lib/module/WorkletsModule/index.js +4 -0
  125. package/lib/module/WorkletsModule/index.js.map +1 -0
  126. package/lib/module/WorkletsModule/workletsModuleInstance.js +7 -0
  127. package/lib/module/WorkletsModule/workletsModuleInstance.js.map +1 -0
  128. package/lib/module/WorkletsModule/workletsModuleInstance.web.js +5 -0
  129. package/lib/module/WorkletsModule/workletsModuleInstance.web.js.map +1 -0
  130. package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
  131. package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
  132. package/lib/module/bundleUnpacker.js +47 -0
  133. package/lib/module/bundleUnpacker.js.map +1 -0
  134. package/lib/module/callGuard.js +30 -0
  135. package/lib/module/callGuard.js.map +1 -0
  136. package/lib/module/deprecated.js +20 -0
  137. package/lib/module/deprecated.js.map +1 -0
  138. package/lib/module/errors.js +69 -0
  139. package/lib/module/errors.js.map +1 -0
  140. package/lib/module/featureFlags/index.js +48 -0
  141. package/lib/module/featureFlags/index.js.map +1 -0
  142. package/lib/module/featureFlags/staticFlags.json +4 -0
  143. package/lib/module/index.js +26 -0
  144. package/lib/module/index.js.map +1 -0
  145. package/lib/module/initializers.js +221 -0
  146. package/lib/module/initializers.js.map +1 -0
  147. package/lib/module/isSynchronizable.js +6 -0
  148. package/lib/module/isSynchronizable.js.map +1 -0
  149. package/lib/module/logger.js +15 -0
  150. package/lib/module/logger.js.map +1 -0
  151. package/lib/module/privateGlobals.d.js +7 -0
  152. package/lib/module/privateGlobals.d.js.map +1 -0
  153. package/lib/module/publicGlobals.js +6 -0
  154. package/lib/module/publicGlobals.js.map +1 -0
  155. package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
  156. package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
  157. package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
  158. package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
  159. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
  160. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
  161. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +52 -0
  162. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
  163. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
  164. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
  165. package/lib/module/runLoop/workletRuntime/index.js +19 -0
  166. package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
  167. package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
  168. package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
  169. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
  170. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
  171. package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
  172. package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
  173. package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
  174. package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
  175. package/lib/module/runtimeKind.js +39 -0
  176. package/lib/module/runtimeKind.js.map +1 -0
  177. package/lib/module/runtimes.js +100 -0
  178. package/lib/module/runtimes.js.map +1 -0
  179. package/lib/module/serializable.js +568 -0
  180. package/lib/module/serializable.js.map +1 -0
  181. package/lib/module/serializableMappingCache.js +37 -0
  182. package/lib/module/serializableMappingCache.js.map +1 -0
  183. package/lib/module/specs/NativeWorkletsModule.js +5 -0
  184. package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
  185. package/lib/module/specs/NativeWorkletsModule.kepler.js +7 -0
  186. package/lib/module/specs/NativeWorkletsModule.kepler.js.map +1 -0
  187. package/lib/module/specs/index.js +10 -0
  188. package/lib/module/specs/index.js.map +1 -0
  189. package/lib/module/synchronizable.js +9 -0
  190. package/lib/module/synchronizable.js.map +1 -0
  191. package/lib/module/synchronizableUnpacker.js +42 -0
  192. package/lib/module/synchronizableUnpacker.js.map +1 -0
  193. package/lib/module/threads.js +347 -0
  194. package/lib/module/threads.js.map +1 -0
  195. package/lib/module/utils/checkCppVersion.js +30 -0
  196. package/lib/module/utils/checkCppVersion.js.map +1 -0
  197. package/lib/module/utils/jsVersion.js +9 -0
  198. package/lib/module/utils/jsVersion.js.map +1 -0
  199. package/lib/module/valueUnpacker.js +60 -0
  200. package/lib/module/valueUnpacker.js.map +1 -0
  201. package/lib/module/workletFunction.js +37 -0
  202. package/lib/module/workletFunction.js.map +1 -0
  203. package/lib/module/workletRuntimeEntry.js +32 -0
  204. package/lib/module/workletRuntimeEntry.js.map +1 -0
  205. package/lib/module/workletTypes.js +12 -0
  206. package/lib/module/workletTypes.js.map +1 -0
  207. package/lib/typescript/PlatformChecker/PlatformChecker.d.ts +5 -0
  208. package/lib/typescript/PlatformChecker/PlatformChecker.d.ts.map +1 -0
  209. package/lib/typescript/PlatformChecker/index.d.ts +10 -0
  210. package/lib/typescript/PlatformChecker/index.d.ts.map +1 -0
  211. package/lib/typescript/WorkletsError.d.ts +15 -0
  212. package/lib/typescript/WorkletsError.d.ts.map +1 -0
  213. package/lib/typescript/WorkletsModule/JSWorklets.d.ts +3 -0
  214. package/lib/typescript/WorkletsModule/JSWorklets.d.ts.map +1 -0
  215. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
  216. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
  217. package/lib/typescript/WorkletsModule/index.d.ts +3 -0
  218. package/lib/typescript/WorkletsModule/index.d.ts.map +1 -0
  219. package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts +2 -0
  220. package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts.map +1 -0
  221. package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts +2 -0
  222. package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts.map +1 -0
  223. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +37 -0
  224. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
  225. package/lib/typescript/bundleUnpacker.d.ts +7 -0
  226. package/lib/typescript/bundleUnpacker.d.ts.map +1 -0
  227. package/lib/typescript/callGuard.d.ts +4 -0
  228. package/lib/typescript/callGuard.d.ts.map +1 -0
  229. package/lib/typescript/deprecated.d.ts +20 -0
  230. package/lib/typescript/deprecated.d.ts.map +1 -0
  231. package/lib/typescript/errors.d.ts +16 -0
  232. package/lib/typescript/errors.d.ts.map +1 -0
  233. package/lib/typescript/featureFlags/index.d.ts +23 -0
  234. package/lib/typescript/featureFlags/index.d.ts.map +1 -0
  235. package/lib/typescript/index.d.ts +17 -0
  236. package/lib/typescript/index.d.ts.map +1 -0
  237. package/lib/typescript/initializers.d.ts +17 -0
  238. package/lib/typescript/initializers.d.ts.map +1 -0
  239. package/lib/typescript/isSynchronizable.d.ts +3 -0
  240. package/lib/typescript/isSynchronizable.d.ts.map +1 -0
  241. package/lib/typescript/logger.d.ts +5 -0
  242. package/lib/typescript/logger.d.ts.map +1 -0
  243. package/lib/typescript/publicGlobals.d.ts +31 -0
  244. package/lib/typescript/publicGlobals.d.ts.map +1 -0
  245. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
  246. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
  247. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
  248. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
  249. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
  250. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
  251. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
  252. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
  253. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
  254. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
  255. package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
  256. package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
  257. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
  258. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
  259. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
  260. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
  261. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
  262. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
  263. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
  264. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
  265. package/lib/typescript/runtimeKind.d.ts +25 -0
  266. package/lib/typescript/runtimeKind.d.ts.map +1 -0
  267. package/lib/typescript/runtimes.d.ts +77 -0
  268. package/lib/typescript/runtimes.d.ts.map +1 -0
  269. package/lib/typescript/serializable.d.ts +20 -0
  270. package/lib/typescript/serializable.d.ts.map +1 -0
  271. package/lib/typescript/serializableMappingCache.d.ts +16 -0
  272. package/lib/typescript/serializableMappingCache.d.ts.map +1 -0
  273. package/lib/typescript/specs/NativeWorkletsModule.d.ts +7 -0
  274. package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
  275. package/lib/typescript/specs/NativeWorkletsModule.kepler.d.ts +7 -0
  276. package/lib/typescript/specs/NativeWorkletsModule.kepler.d.ts.map +1 -0
  277. package/lib/typescript/specs/index.d.ts +3 -0
  278. package/lib/typescript/specs/index.d.ts.map +1 -0
  279. package/lib/typescript/synchronizable.d.ts +15 -0
  280. package/lib/typescript/synchronizable.d.ts.map +1 -0
  281. package/lib/typescript/synchronizableUnpacker.d.ts +4 -0
  282. package/lib/typescript/synchronizableUnpacker.d.ts.map +1 -0
  283. package/lib/typescript/threads.d.ts +138 -0
  284. package/lib/typescript/threads.d.ts.map +1 -0
  285. package/lib/typescript/utils/checkCppVersion.d.ts +3 -0
  286. package/lib/typescript/utils/checkCppVersion.d.ts.map +1 -0
  287. package/lib/typescript/utils/jsVersion.d.ts +7 -0
  288. package/lib/typescript/utils/jsVersion.d.ts.map +1 -0
  289. package/lib/typescript/valueUnpacker.d.ts +6 -0
  290. package/lib/typescript/valueUnpacker.d.ts.map +1 -0
  291. package/lib/typescript/workletFunction.d.ts +27 -0
  292. package/lib/typescript/workletFunction.d.ts.map +1 -0
  293. package/lib/typescript/workletRuntimeEntry.d.ts +14 -0
  294. package/lib/typescript/workletRuntimeEntry.d.ts.map +1 -0
  295. package/lib/typescript/workletTypes.d.ts +61 -0
  296. package/lib/typescript/workletTypes.d.ts.map +1 -0
  297. package/package.json +153 -0
  298. package/plugin/index.js +1761 -0
  299. package/react-native.config.js +21 -0
  300. package/scripts/validate-react-native-version.js +43 -0
  301. package/scripts/worklets_utils.rb +94 -0
  302. package/src/PlatformChecker/PlatformChecker.ts +7 -0
  303. package/src/PlatformChecker/index.ts +30 -0
  304. package/src/WorkletsError.ts +36 -0
  305. package/src/WorkletsModule/JSWorklets.ts +200 -0
  306. package/src/WorkletsModule/NativeWorklets.ts +256 -0
  307. package/src/WorkletsModule/index.ts +7 -0
  308. package/src/WorkletsModule/workletsModuleInstance.ts +9 -0
  309. package/src/WorkletsModule/workletsModuleInstance.web.ts +5 -0
  310. package/src/WorkletsModule/workletsModuleProxy.ts +126 -0
  311. package/src/bundleUnpacker.ts +75 -0
  312. package/src/callGuard.ts +33 -0
  313. package/src/deprecated.ts +32 -0
  314. package/src/errors.ts +80 -0
  315. package/src/featureFlags/index.ts +72 -0
  316. package/src/featureFlags/staticFlags.json +4 -0
  317. package/src/index.ts +53 -0
  318. package/src/initializers.ts +262 -0
  319. package/src/isSynchronizable.ts +13 -0
  320. package/src/logger.ts +16 -0
  321. package/src/privateGlobals.d.ts +79 -0
  322. package/src/publicGlobals.ts +39 -0
  323. package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
  324. package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
  325. package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
  326. package/src/runLoop/uiRuntime/requestAnimationFrame.ts +66 -0
  327. package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
  328. package/src/runLoop/workletRuntime/index.ts +18 -0
  329. package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
  330. package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
  331. package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
  332. package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
  333. package/src/runtimeKind.ts +37 -0
  334. package/src/runtimes.ts +193 -0
  335. package/src/serializable.ts +801 -0
  336. package/src/serializableMappingCache.ts +42 -0
  337. package/src/specs/NativeWorkletsModule.kepler.ts +11 -0
  338. package/src/specs/NativeWorkletsModule.ts +9 -0
  339. package/src/specs/index.ts +13 -0
  340. package/src/synchronizable.ts +32 -0
  341. package/src/synchronizableUnpacker.ts +67 -0
  342. package/src/threads.ts +452 -0
  343. package/src/utils/checkCppVersion.ts +34 -0
  344. package/src/utils/jsVersion.ts +7 -0
  345. package/src/valueUnpacker.ts +90 -0
  346. package/src/workletFunction.ts +42 -0
  347. package/src/workletRuntimeEntry.ts +35 -0
  348. package/src/workletTypes.ts +81 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeWorkletsModule.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeWorkletsModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,kBAAkB,EAAE,MAAM,OAAO,CAAC;CACnC;;AAED,wBAA+D"}
@@ -0,0 +1,7 @@
1
+ import type { KeplerTurboModule } from '@amazon-devices/react-native-kepler/Libraries/TurboModule/KeplerTurboModule';
2
+ interface Spec extends KeplerTurboModule {
3
+ readonly installTurboModule: () => boolean;
4
+ }
5
+ declare const _default: Spec | null;
6
+ export default _default;
7
+ //# sourceMappingURL=NativeWorkletsModule.kepler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeWorkletsModule.kepler.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeWorkletsModule.kepler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mEAAmE,CAAC;AAI3G,UAAU,IAAK,SAAQ,iBAAiB;IACpC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC;CAC9C;;AAED,wBAA+D"}
@@ -0,0 +1,3 @@
1
+ import type { Spec } from './NativeWorkletsModule';
2
+ export declare const WorkletsTurboModule: Spec | null;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/specs/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,eAAO,MAAM,mBAAmB,EAAE,IAAI,GAAG,IAM/B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { SerializableRef } from './workletTypes';
2
+ export declare function createSynchronizable<TValue>(initialValue: TValue): Synchronizable<TValue>;
3
+ export type SynchronizableRef<TValue = unknown> = {
4
+ __synchronizableRef: true;
5
+ __nativeStateSynchronizableJSRef: TValue;
6
+ };
7
+ export type Synchronizable<TValue = unknown> = SerializableRef<TValue> & SynchronizableRef<TValue> & {
8
+ __synchronizableRef: true;
9
+ getDirty(): TValue;
10
+ getBlocking(): TValue;
11
+ setBlocking(value: TValue | ((prev: TValue) => TValue)): void;
12
+ lock(): void;
13
+ unlock(): void;
14
+ };
15
+ //# sourceMappingURL=synchronizable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synchronizable.d.ts","sourceRoot":"","sources":["../../src/synchronizable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,YAAY,EAAE,MAAM,GACnB,cAAc,CAAC,MAAM,CAAC,CAQxB;AAED,MAAM,MAAM,iBAAiB,CAAC,MAAM,GAAG,OAAO,IAAI;IAChD,mBAAmB,EAAE,IAAI,CAAC;IAC1B,gCAAgC,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,MAAM,GAAG,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,GACpE,iBAAiB,CAAC,MAAM,CAAC,GAAG;IAC1B,mBAAmB,EAAE,IAAI,CAAC;IAC1B,QAAQ,IAAI,MAAM,CAAC;IACnB,WAAW,IAAI,MAAM,CAAC;IACtB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,CAAC;IAC9D,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,IAAI,CAAC;CAChB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Synchronizable, SynchronizableRef } from './synchronizable';
2
+ export declare function __installUnpacker(): void;
3
+ export type SynchronizableUnpacker = <TValue>(synchronizableRef: SynchronizableRef<TValue>) => Synchronizable<TValue>;
4
+ //# sourceMappingURL=synchronizableUnpacker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synchronizableUnpacker.d.ts","sourceRoot":"","sources":["../../src/synchronizableUnpacker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,wBAAgB,iBAAiB,SAyDhC;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAC1C,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,KACzC,cAAc,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,138 @@
1
+ import type { WorkletFunction } from './workletTypes';
2
+ export declare function setupMicrotasks(): void;
3
+ export declare const callMicrotasks: () => void;
4
+ /**
5
+ * Lets you schedule a function to be executed on the [UI
6
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
7
+ *
8
+ * - The callback executes asynchronously and doesn't return a value.
9
+ * - Passed function and args are automatically
10
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
11
+ * and serialized.
12
+ * - This function cannot be called from the [UI
13
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime)
14
+ * or [Worker
15
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worker-worklet-runtime---worker-runtime),
16
+ * unless you have the [Bundle Mode](/docs/experimental/bundleMode) enabled.
17
+ *
18
+ * @param fun - A reference to a function you want to schedule on the [UI
19
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
20
+ * @param args - Arguments to pass to the function.
21
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnUI
22
+ */
23
+ export declare function scheduleOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): void;
24
+ /**
25
+ * Lets you asynchronously run
26
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
27
+ * functions on the [UI
28
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
29
+ *
30
+ * This method does not schedule the work immediately but instead waits for
31
+ * other worklets to be scheduled within the same JS loop. It uses
32
+ * queueMicrotask to schedule all the worklets at once making sure they will run
33
+ * within the same frame boundaries on the UI thread.
34
+ *
35
+ * @param fun - A reference to a function you want to execute on the [UI
36
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/)
37
+ * from the [JavaScript
38
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
39
+ * @returns A function that accepts arguments for the function passed as the
40
+ * first argument.
41
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI @deprecated Use `scheduleOnUI` instead.
42
+ */
43
+ export declare function runOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => void;
44
+ /**
45
+ * Lets you run a function synchronously on the [UI
46
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime)
47
+ * from the [RN
48
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#react-native-runtime-rn-runtime).
49
+ * Passed function and args are automatically
50
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
51
+ * and serialized.
52
+ *
53
+ * - This function cannot be called from the [UI
54
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
55
+ * - This function cannot be called from a [Worker
56
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worker-worklet-runtime---worker-runtime).
57
+ *
58
+ * @param fun - A reference to a function you want to execute on the [UI
59
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
60
+ * @param args - Arguments to pass to the function.
61
+ * @returns The return value of the function passed as the first argument.
62
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUISync
63
+ */
64
+ export declare function runOnUISync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
65
+ export declare function executeOnUIRuntimeSync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => ReturnValue;
66
+ type ReleaseRemoteFunction<Args extends unknown[], ReturnValue> = {
67
+ (...args: Args): ReturnValue;
68
+ };
69
+ type DevRemoteFunction<Args extends unknown[], ReturnValue> = {
70
+ __remoteFunction: (...args: Args) => ReturnValue;
71
+ };
72
+ type RemoteFunction<Args extends unknown[], ReturnValue> = ReleaseRemoteFunction<Args, ReturnValue> | DevRemoteFunction<Args, ReturnValue>;
73
+ /**
74
+ * Lets you asynchronously run
75
+ * non-[workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
76
+ * functions that couldn't otherwise run on the [UI
77
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-thread).
78
+ * This applies to most external libraries as they don't have their functions
79
+ * marked with "worklet"; directive.
80
+ *
81
+ * @param fun - A reference to a function you want to execute on the JavaScript
82
+ * thread from the UI thread.
83
+ * @returns A function that accepts arguments for the function passed as the
84
+ * first argument.
85
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnJS
86
+ */
87
+ /** @deprecated Use `scheduleOnRN` instead. */
88
+ export declare function runOnJS<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction<Args, ReturnValue> | WorkletFunction<Args, ReturnValue>): (...args: Args) => void;
89
+ /**
90
+ * Lets you schedule a function to be executed on the RN runtime from any
91
+ * runtime. Check
92
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
93
+ * for more information about the different runtime kinds.
94
+ *
95
+ * Scheduling function from the RN Runtime (we are already on RN Runtime) simply
96
+ * uses `queueMicrotask`.
97
+ *
98
+ * When functions need to be scheduled from the UI Runtime, first function and
99
+ * args are serialized and then the system passes the scheduling responsibility
100
+ * to the JSScheduler. The JSScheduler then uses the RN CallInvoker to schedule
101
+ * the function asynchronously on the JavaScript thread by calling
102
+ * `jsCallInvoker_->invokeAsync()`.
103
+ *
104
+ * When called from a Worker Runtime, it uses the same JSScheduler mechanism.
105
+ *
106
+ * @param fun - A function you want to schedule on the RN runtime. A function
107
+ * can be a worklet, a remote function or a regular function.
108
+ * @param args - Arguments to pass to the function.
109
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnRN
110
+ */
111
+ export declare function scheduleOnRN<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction<Args, ReturnValue> | WorkletFunction<Args, ReturnValue>, ...args: Args): void;
112
+ /**
113
+ * Lets you asynchronously run
114
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
115
+ * functions on the [UI
116
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
117
+ *
118
+ * This method does not schedule the work immediately but instead waits for
119
+ * other worklets to be scheduled within the same JS loop. It uses
120
+ * queueMicrotask to schedule all the worklets at once making sure they will run
121
+ * within the same frame boundaries on the UI thread.
122
+ *
123
+ * @param fun - A reference to a function you want to execute on the [UI
124
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-runtime).
125
+ * from the [JavaScript
126
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#javascript-runtime).
127
+ * @returns A promise that resolves to the return value of the function passed
128
+ * as the first argument.
129
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUIAsync
130
+ */
131
+ export declare function runOnUIAsync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => Promise<ReturnValue>;
132
+ /**
133
+ * Added temporarily for integration with `react-native-audio-api`. Don't depend
134
+ * on this API as it may change without notice.
135
+ */
136
+ export declare function unstable_eventLoopTask<TArgs extends unknown[], TRet>(worklet: (...args: TArgs) => TRet): (...args: TArgs) => void;
137
+ export {};
138
+ //# sourceMappingURL=threads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/threads.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AAUrE,wBAAgB,eAAe,SA0B9B;AAOD,eAAO,MAAM,cAAc,YAIC,CAAC;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;AA0D3B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC7D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAEb;AAGD,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;AAgBlC,KAAK,qBAAqB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IAAI;IAChE,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CAC9B,CAAC;AAEF,KAAK,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IAAI;IAC5D,gBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;CAClD,CAAC;AAEF,KAAK,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IACnD,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,GACxC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAUzC;;;;;;;;;;;;;GAaG;AACH,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,GACjC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CA8CzB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,GACjC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EACtC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAGN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,WAAW,CAAC,CAqCzC;AA8CD;;;GAGG;AAEH,wBAAgB,sBAAsB,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,IAAI,EAClE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,IAEzB,GAAG,MAAM,KAAK,UAKvB"}
@@ -0,0 +1,3 @@
1
+ export declare function checkCppVersion(): void;
2
+ export declare function matchVersion(version1: string, version2: string): boolean;
3
+ //# sourceMappingURL=checkCppVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkCppVersion.d.ts","sourceRoot":"","sources":["../../../src/utils/checkCppVersion.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,SAgB9B;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAU9D"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * We hardcode the version of Worklets here in order to compare it with the
3
+ * version used to build the native part of the library in runtime. Remember to
4
+ * keep this in sync with the version declared in `package.json`
5
+ */
6
+ export declare const jsVersion = "1.0.0+0.6.0";
7
+ //# sourceMappingURL=jsVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsVersion.d.ts","sourceRoot":"","sources":["../../../src/utils/jsVersion.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,SAAS,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare global {
2
+ var evalWithSourceMap: ((js: string, sourceURL: string, sourceMap: string) => () => unknown) | undefined;
3
+ var evalWithSourceUrl: ((js: string, sourceURL: string) => () => unknown) | undefined;
4
+ }
5
+ export {};
6
+ //# sourceMappingURL=valueUnpacker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valueUnpacker.d.ts","sourceRoot":"","sources":["../../src/valueUnpacker.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,iBAAiB,EACjB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,OAAO,CAAC,GACrE,SAAS,CAAC;IACd,IAAI,iBAAiB,EACjB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,OAAO,CAAC,GAClD,SAAS,CAAC;CACf"}
@@ -0,0 +1,27 @@
1
+ import type { WorkletFunction } from './workletTypes';
2
+ /**
3
+ * This function allows you to determine if a given function is a worklet. It
4
+ * only works with Reanimated Babel plugin enabled. Unless you are doing
5
+ * something with internals of Reanimated you shouldn't need to use this
6
+ * function.
7
+ *
8
+ * ### Note
9
+ *
10
+ * Do not call it before the worklet is declared, as it will always return false
11
+ * then. E.g.:
12
+ *
13
+ * ```ts
14
+ * isWorkletFunction(myWorklet); // Will always return false.
15
+ *
16
+ * function myWorklet() {
17
+ * 'worklet';
18
+ * }
19
+ * ```
20
+ *
21
+ * ### Maintainer note
22
+ *
23
+ * This function is supposed to be used only in the React Runtime. It always
24
+ * returns `false` in Worklet Runtimes.
25
+ */
26
+ export declare function isWorkletFunction<Args extends unknown[] = unknown[], ReturnValue = unknown>(value: unknown): value is WorkletFunction<Args, ReturnValue>;
27
+ //# sourceMappingURL=workletFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workletFunction.d.ts","sourceRoot":"","sources":["../../src/workletFunction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EAClC,WAAW,GAAG,OAAO,EACrB,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAU7D"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This function is an entry point for Worklet Runtimes. We can use it to setup
3
+ * necessary tools, like the ValueUnpacker.
4
+ *
5
+ * We must throw an error at the end of this function to prevent the bundle to
6
+ * continue executing. This is because the next module to be ran would be the
7
+ * React Native one, and it would break the Worklet Runtime if initialized. The
8
+ * error is caught in C++ code.
9
+ *
10
+ * This function has no effect on the RN Runtime beside setting the
11
+ * `_WORKLETS_BUNDLE_MODE` flag.
12
+ */
13
+ export declare function bundleModeInit(): void;
14
+ //# sourceMappingURL=workletRuntimeEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workletRuntimeEntry.d.ts","sourceRoot":"","sources":["../../src/workletRuntimeEntry.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,SAa7B"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The below type is used for HostObjects returned by the JSI API that don't
3
+ * have any accessible fields or methods but can carry data that is accessed
4
+ * from the c++ side. We add a field to the type to make it possible for
5
+ * typescript to recognize which JSI methods accept those types as arguments and
6
+ * to be able to correctly type check other methods that may use them. However,
7
+ * this field is not actually defined nor should be used for anything else as
8
+ * assigning any data to those objects will throw an error.
9
+ */
10
+ export type SerializableRef<T = unknown> = {
11
+ __serializableRef: true;
12
+ __nativeStateSerializableJSRef: T;
13
+ };
14
+ export type FlatSerializableRef<T> = T extends SerializableRef<infer U> ? SerializableRef<U> : SerializableRef<T>;
15
+ export type WorkletRuntime = {
16
+ __hostObjectWorkletRuntime: never;
17
+ readonly name: string;
18
+ };
19
+ export type WorkletStackDetails = [
20
+ error: Error,
21
+ lineOffset: number,
22
+ columnOffset: number
23
+ ];
24
+ export type WorkletClosure = Record<string, unknown>;
25
+ interface WorkletInitData {
26
+ code: string;
27
+ /** Only in dev builds. */
28
+ location?: string;
29
+ /** Only in dev builds. */
30
+ sourceMap?: string;
31
+ }
32
+ interface WorkletProps {
33
+ __closure: WorkletClosure;
34
+ __workletHash: number;
35
+ /** Only in Legacy Bundling. */
36
+ __initData?: WorkletInitData;
37
+ /** Only for Handles. */
38
+ __init?: () => unknown;
39
+ /** `__stackDetails` is removed after parsing. */
40
+ __stackDetails?: WorkletStackDetails;
41
+ /** Only in dev builds. */
42
+ __pluginVersion?: string;
43
+ }
44
+ export type WorkletFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> = ((...args: TArgs) => TReturn) & WorkletProps;
45
+ export interface WorkletFactory<TArgs extends unknown[] = unknown[], TReturn = unknown, TClosureVariables extends Record<string, unknown> = Record<string, unknown>> {
46
+ (closureVariables: TClosureVariables): WorkletFunction<TArgs, TReturn>;
47
+ }
48
+ export type ValueUnpacker = WorkletFunction<[
49
+ objectToUnpack: unknown,
50
+ category?: string
51
+ ], unknown>;
52
+ export interface WorkletImport {
53
+ __bundleData: {
54
+ /** Name of the module which is the source of the import. */
55
+ source: string;
56
+ /** The name of the imported value. */
57
+ imported: string;
58
+ };
59
+ }
60
+ export {};
61
+ //# sourceMappingURL=workletTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workletTypes.d.ts","sourceRoot":"","sources":["../../src/workletTypes.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI;IACzC,iBAAiB,EAAE,IAAI,CAAC;IACxB,8BAA8B,EAAE,CAAC,CAAC;CACnC,CAAC;AAIF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC/B,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,cAAc,GAAG;IAC3B,0BAA0B,EAAE,KAAK,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IACvB,iDAAiD;IACjD,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,0BAA0B;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,IACf,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc,CAC7B,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,EACjB,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3E,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CACxE;AAED,MAAM,MAAM,aAAa,GAAG,eAAe,CACzC;IAAC,cAAc,EAAE,OAAO;IAAE,QAAQ,CAAC,EAAE,MAAM;CAAC,EAC5C,OAAO,CACR,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE;QACZ,4DAA4D;QAC5D,MAAM,EAAE,MAAM,CAAC;QACf,sCAAsC;QACtC,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH"}
package/package.json ADDED
@@ -0,0 +1,153 @@
1
+ {
2
+ "//": "amzn_mod - update package name and build with yarn",
3
+ "name": "@amazon-devices/react-native-worklets",
4
+ "version": "1.0.0-rn-83",
5
+ "description": "The React Native multithreading library",
6
+ "keywords": [
7
+ "react-native",
8
+ "react",
9
+ "native",
10
+ "worklets"
11
+ ],
12
+ "scripts": {
13
+ "build": "yarn workspace @amazon-devices/babel-plugin-worklets build && bob build && yarn build:unpackers",
14
+ "build:unpackers": "node ./scripts/export-unpackers.js",
15
+ "circular-dependency-check": "yarn madge --extensions js,jsx --circular lib",
16
+ "find-unused-code:js": "knip",
17
+ "format": "yarn format:js && yarn format:plugin && yarn format:common && yarn format:android && yarn format:apple",
18
+ "format:android": "yarn format:android:java && yarn format:android:cpp && yarn format:android:cmake",
19
+ "format:android:cpp": "find android/src -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
20
+ "format:android:cmake": "find ./android -type d \\( -name build -o -name .cxx \\) -prune -o -type f -name 'CMakeLists.txt' -print | xargs ../../scripts/format-cmake.sh",
21
+ "format:android:java": "node ../../scripts/format-java.js",
22
+ "format:apple": "find apple -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
23
+ "format:common": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
24
+ "format:js": "prettier --write --list-different src",
25
+ "format:plugin": "yarn workspace babel-plugin-worklets format",
26
+ "lint": "yarn lint:js && yarn lint:common && yarn lint:plugin && yarn lint:android && yarn lint:apple",
27
+ "lint:android": "../../scripts/validate-android.sh && ./android/gradlew -p android spotlessCheck -q && ../../scripts/cpplint.sh android/src && yarn format:android:cpp --dry-run -Werror && yarn lint:cmake",
28
+ "lint:apple": "../../scripts/validate-apple.sh && yarn format:apple --dry-run -Werror",
29
+ "lint:common": "../../scripts/validate-common.sh && ../../scripts/cpplint.sh Common && yarn format:common --dry-run -Werror",
30
+ "lint:cmake": "find ./android -type d \\( -name build -o -name .cxx \\) -prune -o -type f -name 'CMakeLists.txt' -print | xargs ../../scripts/lint-cmake.sh",
31
+ "lint:clang-tidy": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs ../../scripts/clang-tidy-lint.sh",
32
+ "lint:js": "eslint src && yarn prettier --check src",
33
+ "lint:plugin": "yarn workspace babel-plugin-worklets lint",
34
+ "test": "jest",
35
+ "type:check": "yarn type:check:src && yarn type:check:plugin && yarn type:check:app && yarn type:check:tests",
36
+ "type:check:src": "yarn tsc --noEmit",
37
+ "type:check:app": "yarn workspace common-app type:check",
38
+ "type:check:plugin": "yarn workspace babel-plugin-worklets type:check",
39
+ "type:check:tests": "../../scripts/test-ts.sh __typetests__",
40
+ "use-strict-check": "node ../../scripts/validate-use-strict.js"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/software-mansion/react-native-reanimated.git",
45
+ "directory": "packages/react-native-worklets"
46
+ },
47
+ "license": "See license in LICENSE",
48
+ "readmeFilename": "README.md",
49
+ "bugs": {
50
+ "url": "https://github.com/software-mansion/react-native-reanimated/issues"
51
+ },
52
+ "homepage": "https://docs.swmansion.com/react-native-worklets",
53
+ "peerDependencies": {
54
+ "@babel/core": "^7.0.0-0",
55
+ "react": "*",
56
+ "react-native": "*"
57
+ },
58
+ "dependencies": {
59
+ "@babel/plugin-transform-arrow-functions": "^7.0.0-0",
60
+ "@babel/plugin-transform-class-properties": "^7.0.0-0",
61
+ "@babel/plugin-transform-classes": "^7.0.0-0",
62
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.0.0-0",
63
+ "@babel/plugin-transform-optional-chaining": "^7.0.0-0",
64
+ "@babel/plugin-transform-shorthand-properties": "^7.0.0-0",
65
+ "@babel/plugin-transform-template-literals": "^7.0.0-0",
66
+ "@babel/plugin-transform-unicode-regex": "^7.0.0-0",
67
+ "@babel/preset-typescript": "^7.16.7",
68
+ "convert-source-map": "^2.0.0",
69
+ "semver": "7.7.2"
70
+ },
71
+ "devDependencies": {
72
+ "@babel/cli": "^7.20.0",
73
+ "@babel/core": "^7.25.2",
74
+ "@react-native-community/cli": "20.0.0",
75
+ "@react-native/eslint-config": "0.81.0",
76
+ "@types/jest": "^29.5.5",
77
+ "@types/react": "^19.1.0",
78
+ "clang-format-node": "^1.3.1",
79
+ "eslint": "^9.29.0",
80
+ "jest": "^29.0.0",
81
+ "knip": "^5.61.3",
82
+ "madge": "^5.0.1",
83
+ "prettier": "^3.3.3",
84
+ "react": "19.1.0",
85
+ "react-native": "0.81.5",
86
+ "react-native-builder-bob": "0.40.13",
87
+ "@react-native/babel-preset": "0.81.0",
88
+ "typescript": "5.8.3"
89
+ },
90
+ "main": "./lib/module/index",
91
+ "module": "./lib/module/index",
92
+ "react-native": "./src/index",
93
+ "source": "./src/index",
94
+ "types": "lib/typescript/index.d.ts",
95
+ "files": [
96
+ "src",
97
+ "lib",
98
+ "android",
99
+ "apple",
100
+ "Common",
101
+ "compatibility.json",
102
+ "bundleMode/index.js",
103
+ "bundleMode/index.d.ts",
104
+ "scripts/worklets_utils.rb",
105
+ "scripts/validate-react-native-version.js",
106
+ "SystemModules",
107
+ "SystemBundles",
108
+ "plugin/index.js",
109
+ "*.podspec",
110
+ "react-native.config.js",
111
+ "kepler-compatibility.json",
112
+ "!apple/build",
113
+ "!android/build",
114
+ "!android/gradle",
115
+ "!android/gradlew",
116
+ "!android/gradlew.bat",
117
+ "!android/local.properties",
118
+ "!**/__tests__",
119
+ "!**/__fixtures__",
120
+ "!**/__mocks__",
121
+ "!**/.*",
122
+ "kepler-transformed-package-info.json"
123
+ ],
124
+ "react-native-builder-bob": {
125
+ "source": "src",
126
+ "output": "lib",
127
+ "targets": [
128
+ [
129
+ "module",
130
+ {
131
+ "esm": false,
132
+ "jsxRuntime": "automatic"
133
+ }
134
+ ],
135
+ "typescript"
136
+ ]
137
+ },
138
+ "codegenConfig": {
139
+ "name": "rnworklets",
140
+ "type": "modules",
141
+ "jsSrcsDir": "src/specs",
142
+ "android": {
143
+ "javaPackageName": "com.swmansion.worklets"
144
+ },
145
+ "ios": {
146
+ "modulesConformingToProtocol": {
147
+ "RCTBundleConsumer": [
148
+ "WorkletsModule"
149
+ ]
150
+ }
151
+ }
152
+ }
153
+ }