@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.
- package/.worklets/dummy.md +1 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +64 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
- package/Common/cpp/worklets/Compat/Holders.h +25 -0
- package/Common/cpp/worklets/Compat/StableApi.cpp +145 -0
- package/Common/cpp/worklets/Compat/StableApi.h +128 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +729 -0
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +126 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +81 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +76 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +95 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +44 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +10 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +43 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueue.h +14 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +69 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +48 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.cpp +103 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
- package/Common/cpp/worklets/SharedItems/MemoryManager.cpp +60 -0
- package/Common/cpp/worklets/SharedItems/MemoryManager.h +29 -0
- package/Common/cpp/worklets/SharedItems/Serializable.cpp +373 -0
- package/Common/cpp/worklets/SharedItems/Serializable.h +413 -0
- package/Common/cpp/worklets/SharedItems/SerializableFactory.cpp +172 -0
- package/Common/cpp/worklets/SharedItems/SerializableFactory.h +85 -0
- package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.cpp +71 -0
- package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.h +75 -0
- package/Common/cpp/worklets/SharedItems/Shareable.cpp +84 -0
- package/Common/cpp/worklets/SharedItems/Shareable.h +43 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +59 -0
- package/Common/cpp/worklets/SharedItems/Synchronizable.h +57 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +78 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
- package/Common/cpp/worklets/SharedItems/UnpackerLoader.h +78 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.cpp +18 -0
- package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
- package/Common/cpp/worklets/Tools/JSISerializer.cpp +312 -0
- package/Common/cpp/worklets/Tools/JSISerializer.h +42 -0
- package/Common/cpp/worklets/Tools/JSLogger.cpp +92 -0
- package/Common/cpp/worklets/Tools/JSLogger.h +48 -0
- package/Common/cpp/worklets/Tools/JSScheduler.cpp +21 -0
- package/Common/cpp/worklets/Tools/JSScheduler.h +35 -0
- package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
- package/Common/cpp/worklets/Tools/RNRuntimeStatus.h +27 -0
- package/Common/cpp/worklets/Tools/ScriptBuffer.h +56 -0
- package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +75 -0
- package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
- package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
- package/Common/cpp/worklets/Tools/UIScheduler.h +22 -0
- package/Common/cpp/worklets/Tools/VersionUtils.cpp +61 -0
- package/Common/cpp/worklets/Tools/VersionUtils.h +24 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +34 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.h +44 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +30 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +222 -0
- package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +116 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +46 -0
- package/Common/cpp/worklets/Tools/WorkletsVersion.h +18 -0
- package/Common/cpp/worklets/WorkletRuntime/BundleModeConfig.h +17 -0
- package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.cpp +45 -0
- package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.h +12 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +68 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +24 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeBindings.h +59 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +38 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeHolder.h +19 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +122 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +75 -0
- package/Common/cpp/worklets/WorkletRuntime/ScriptLoader.h +116 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +14 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +15 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +58 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +100 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +327 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +256 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +320 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +36 -0
- package/LICENSE +20 -0
- package/README.md +43 -0
- package/RNWorklets.podspec +94 -0
- package/android/CMakeLists.txt +108 -0
- package/android/build.gradle.kts +369 -0
- package/android/fix-prefab.gradle.kts +56 -0
- package/android/generate-stub-pch.gradle.kts +84 -0
- package/android/gradle.properties +25 -0
- package/android/proguard-rules.pro +3 -0
- package/android/settings.gradle.kts +21 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/WorkletsPCH.h +26 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +66 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +38 -0
- package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +30 -0
- package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.cpp +66 -0
- package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.h +48 -0
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.cpp +51 -0
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.h +43 -0
- package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +31 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +203 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.h +75 -0
- package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +19 -0
- package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.kt +56 -0
- package/android/src/main/java/com/swmansion/worklets/ScriptBufferWrapper.kt +103 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.kt +42 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.kt +14 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.kt +112 -0
- package/android/src/networking/com/swmansion/worklets/WorkletRuntimeWrapper.kt +27 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsHeaderUtil.kt +30 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsModule.kt +187 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworkEventUtil.kt +272 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworking.kt +1124 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsOkHttpCallUtil.kt +40 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressListener.kt +13 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressRequestBody.kt +98 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressResponseBody.kt +60 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressiveStringDecoder.kt +87 -0
- package/android/src/networking/com/swmansion/worklets/WorkletsRequestBodyUtil.kt +181 -0
- package/android/src/no-networking/com/swmansion/worklets/WorkletsModule.kt +143 -0
- package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
- package/apple/worklets/apple/AnimationFrameQueue.mm +145 -0
- package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
- package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +12 -0
- package/apple/worklets/apple/IOSUIScheduler.h +14 -0
- package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
- package/apple/worklets/apple/Networking/WorkletsNetworking.h +25 -0
- package/apple/worklets/apple/Networking/WorkletsNetworking.mm +707 -0
- package/apple/worklets/apple/PlatformLogger.mm +31 -0
- package/apple/worklets/apple/SlowAnimations.h +8 -0
- package/apple/worklets/apple/SlowAnimations.mm +45 -0
- package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
- package/apple/worklets/apple/WorkletsModule.h +28 -0
- package/apple/worklets/apple/WorkletsModule.mm +177 -0
- package/bundleMode/index.d.ts +6 -0
- package/bundleMode/index.js +182 -0
- package/bundleMode/shims/reactNativeShim.js +21 -0
- package/bundleMode/shims/turboModuleRegistryShim.js +47 -0
- package/changes.json +58 -0
- package/compatibility.json +29 -0
- package/jest/pluginTestUtils.ts +16 -0
- package/jest/resolver.js +18 -0
- package/lib/module/WorkletsModule/NativeWorklets.js +4 -0
- package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js +199 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
- package/lib/module/bundleMode/metroOverrides.native.js +26 -0
- package/lib/module/bundleMode/metroOverrides.native.js.map +1 -0
- package/lib/module/bundleMode/network.native.js +44 -0
- package/lib/module/bundleMode/network.native.js.map +1 -0
- package/lib/module/debug/bundleMode.js +6 -0
- package/lib/module/debug/bundleMode.js.map +1 -0
- package/lib/module/debug/bundleMode.native.js +11 -0
- package/lib/module/debug/bundleMode.native.js.map +1 -0
- package/lib/module/debug/checkCppVersion.js +29 -0
- package/lib/module/debug/checkCppVersion.js.map +1 -0
- package/lib/module/debug/errors.native.js +67 -0
- package/lib/module/debug/errors.native.js.map +1 -0
- package/lib/module/debug/jsVersion.js +9 -0
- package/lib/module/debug/jsVersion.js.map +1 -0
- package/lib/module/debug/logger.js +15 -0
- package/lib/module/debug/logger.js.map +1 -0
- package/lib/module/debug/slowAnimations.js +7 -0
- package/lib/module/debug/slowAnimations.js.map +1 -0
- package/lib/module/debug/slowAnimations.native.js +17 -0
- package/lib/module/debug/slowAnimations.native.js.map +1 -0
- package/lib/module/deprecated.js +27 -0
- package/lib/module/deprecated.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.js +12 -0
- package/lib/module/featureFlags/featureFlags.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.native.js +51 -0
- package/lib/module/featureFlags/featureFlags.native.js.map +1 -0
- package/lib/module/featureFlags/staticFlags.json +6 -0
- package/lib/module/featureFlags/types.js +16 -0
- package/lib/module/featureFlags/types.js.map +1 -0
- package/lib/module/guardImplementation.native.js +17 -0
- package/lib/module/guardImplementation.native.js.map +1 -0
- package/lib/module/index.js +26 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initializers/initializers.js +24 -0
- package/lib/module/initializers/initializers.js.map +1 -0
- package/lib/module/initializers/initializers.native.js +195 -0
- package/lib/module/initializers/initializers.native.js.map +1 -0
- package/lib/module/memory/bundleUnpacker.native.js +38 -0
- package/lib/module/memory/bundleUnpacker.native.js.map +1 -0
- package/lib/module/memory/customSerializableUnpacker.native.js +20 -0
- package/lib/module/memory/customSerializableUnpacker.native.js.map +1 -0
- package/lib/module/memory/isShareable.js +8 -0
- package/lib/module/memory/isShareable.js.map +1 -0
- package/lib/module/memory/isSynchronizable.js +8 -0
- package/lib/module/memory/isSynchronizable.js.map +1 -0
- package/lib/module/memory/remoteFunctionUnpacker.native.js +18 -0
- package/lib/module/memory/remoteFunctionUnpacker.native.js.map +1 -0
- package/lib/module/memory/serializable.js +18 -0
- package/lib/module/memory/serializable.js.map +1 -0
- package/lib/module/memory/serializable.native.js +619 -0
- package/lib/module/memory/serializable.native.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.js +11 -0
- package/lib/module/memory/serializableMappingCache.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.native.js +29 -0
- package/lib/module/memory/serializableMappingCache.native.js.map +1 -0
- package/lib/module/memory/shareable.js +18 -0
- package/lib/module/memory/shareable.js.map +1 -0
- package/lib/module/memory/shareable.native.js +42 -0
- package/lib/module/memory/shareable.native.js.map +1 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js +105 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js.map +1 -0
- package/lib/module/memory/shareableHostUnpacker.native.js +20 -0
- package/lib/module/memory/shareableHostUnpacker.native.js.map +1 -0
- package/lib/module/memory/synchronizable.js +6 -0
- package/lib/module/memory/synchronizable.js.map +1 -0
- package/lib/module/memory/synchronizable.native.js +9 -0
- package/lib/module/memory/synchronizable.native.js.map +1 -0
- package/lib/module/memory/synchronizableUnpacker.native.js +47 -0
- package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -0
- package/lib/module/memory/types.js +12 -0
- package/lib/module/memory/types.js.map +1 -0
- package/lib/module/memory/valueUnpacker.native.js +52 -0
- package/lib/module/memory/valueUnpacker.native.js.map +1 -0
- package/lib/module/mock.js +85 -0
- package/lib/module/mock.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/platformChecker.js +4 -0
- package/lib/module/platformChecker.js.map +1 -0
- package/lib/module/platformChecker.native.js +4 -0
- package/lib/module/platformChecker.native.js.map +1 -0
- package/lib/module/privateGlobals.d.js +7 -0
- package/lib/module/privateGlobals.d.js.map +1 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +71 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/index.js +19 -0
- package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
- package/lib/module/runtimeKind.js +92 -0
- package/lib/module/runtimeKind.js.map +1 -0
- package/lib/module/runtimes.js +36 -0
- package/lib/module/runtimes.js.map +1 -0
- package/lib/module/runtimes.native.js +379 -0
- package/lib/module/runtimes.native.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.js +5 -0
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
- package/lib/module/specs/index.js +10 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/threads.js +60 -0
- package/lib/module/threads.js.map +1 -0
- package/lib/module/threads.native.js +295 -0
- package/lib/module/threads.native.js.map +1 -0
- package/lib/module/types.js +5 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/workletFunction.js +36 -0
- package/lib/module/workletFunction.js.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +59 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts +9 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts.map +1 -0
- package/lib/typescript/bundleMode/network.native.d.ts +7 -0
- package/lib/typescript/bundleMode/network.native.d.ts.map +1 -0
- package/lib/typescript/debug/bundleMode.d.ts +2 -0
- package/lib/typescript/debug/bundleMode.d.ts.map +1 -0
- package/lib/typescript/debug/bundleMode.native.d.ts +2 -0
- package/lib/typescript/debug/bundleMode.native.d.ts.map +1 -0
- package/lib/typescript/debug/checkCppVersion.d.ts +3 -0
- package/lib/typescript/debug/checkCppVersion.d.ts.map +1 -0
- package/lib/typescript/debug/errors.native.d.ts +13 -0
- package/lib/typescript/debug/errors.native.d.ts.map +1 -0
- package/lib/typescript/debug/jsVersion.d.ts +7 -0
- package/lib/typescript/debug/jsVersion.d.ts.map +1 -0
- package/lib/typescript/debug/logger.d.ts +5 -0
- package/lib/typescript/debug/logger.d.ts.map +1 -0
- package/lib/typescript/debug/slowAnimations.d.ts +2 -0
- package/lib/typescript/debug/slowAnimations.d.ts.map +1 -0
- package/lib/typescript/debug/slowAnimations.native.d.ts +11 -0
- package/lib/typescript/debug/slowAnimations.native.d.ts.map +1 -0
- package/lib/typescript/deprecated.d.ts +19 -0
- package/lib/typescript/deprecated.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts +5 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts +6 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts.map +1 -0
- package/lib/typescript/featureFlags/types.d.ts +23 -0
- package/lib/typescript/featureFlags/types.d.ts.map +1 -0
- package/lib/typescript/guardImplementation.native.d.ts +3 -0
- package/lib/typescript/guardImplementation.native.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +19 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.d.ts +2 -0
- package/lib/typescript/initializers/initializers.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.native.d.ts +19 -0
- package/lib/typescript/initializers/initializers.native.d.ts.map +1 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts +7 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts +3 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/isShareable.d.ts +3 -0
- package/lib/typescript/memory/isShareable.d.ts.map +1 -0
- package/lib/typescript/memory/isSynchronizable.d.ts +3 -0
- package/lib/typescript/memory/isSynchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts +3 -0
- package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.d.ts +7 -0
- package/lib/typescript/memory/serializable.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.native.d.ts +37 -0
- package/lib/typescript/memory/serializable.native.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts +6 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts +13 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.d.ts +15 -0
- package/lib/typescript/memory/shareable.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.native.d.ts +15 -0
- package/lib/typescript/memory/shareable.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.native.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/types.d.ts +136 -0
- package/lib/typescript/memory/types.d.ts.map +1 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts +7 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/mock.d.ts +2 -0
- package/lib/typescript/mock.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/platformChecker.d.ts +2 -0
- package/lib/typescript/platformChecker.d.ts.map +1 -0
- package/lib/typescript/platformChecker.native.d.ts +2 -0
- package/lib/typescript/platformChecker.native.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
- package/lib/typescript/runtimeKind.d.ts +56 -0
- package/lib/typescript/runtimeKind.d.ts.map +1 -0
- package/lib/typescript/runtimes.d.ts +15 -0
- package/lib/typescript/runtimes.d.ts.map +1 -0
- package/lib/typescript/runtimes.native.d.ts +155 -0
- package/lib/typescript/runtimes.native.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +9 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
- package/lib/typescript/specs/index.d.ts +3 -0
- package/lib/typescript/specs/index.d.ts.map +1 -0
- package/lib/typescript/threads.d.ts +8 -0
- package/lib/typescript/threads.d.ts.map +1 -0
- package/lib/typescript/threads.native.d.ts +125 -0
- package/lib/typescript/threads.native.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +136 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/workletFunction.d.ts +26 -0
- package/lib/typescript/workletFunction.d.ts.map +1 -0
- package/package.json +220 -0
- package/plugin/index.d.ts +168 -0
- package/plugin/index.js +2188 -0
- package/scripts/validate-react-native-version.js +43 -0
- package/scripts/worklets_utils.rb +94 -0
- package/src/WorkletsModule/NativeWorklets.native.ts +461 -0
- package/src/WorkletsModule/NativeWorklets.ts +5 -0
- package/src/WorkletsModule/workletsModuleProxy.ts +247 -0
- package/src/bundleMode/metroOverrides.native.ts +33 -0
- package/src/bundleMode/network.native.ts +63 -0
- package/src/debug/bundleMode.native.ts +18 -0
- package/src/debug/bundleMode.ts +5 -0
- package/src/debug/checkCppVersion.ts +34 -0
- package/src/debug/errors.native.ts +74 -0
- package/src/debug/jsVersion.ts +8 -0
- package/src/debug/logger.ts +16 -0
- package/src/debug/slowAnimations.native.ts +15 -0
- package/src/debug/slowAnimations.ts +6 -0
- package/src/deprecated.ts +38 -0
- package/src/featureFlags/featureFlags.native.ts +70 -0
- package/src/featureFlags/featureFlags.ts +20 -0
- package/src/featureFlags/staticFlags.json +6 -0
- package/src/featureFlags/types.ts +32 -0
- package/src/guardImplementation.native.ts +26 -0
- package/src/index.ts +95 -0
- package/src/initializers/initializers.native.ts +218 -0
- package/src/initializers/initializers.ts +24 -0
- package/src/memory/bundleUnpacker.native.ts +59 -0
- package/src/memory/customSerializableUnpacker.native.ts +30 -0
- package/src/memory/isShareable.ts +16 -0
- package/src/memory/isSynchronizable.ts +14 -0
- package/src/memory/remoteFunctionUnpacker.native.ts +27 -0
- package/src/memory/serializable.native.ts +889 -0
- package/src/memory/serializable.ts +36 -0
- package/src/memory/serializableMappingCache.native.ts +37 -0
- package/src/memory/serializableMappingCache.ts +12 -0
- package/src/memory/shareable.native.ts +68 -0
- package/src/memory/shareable.ts +27 -0
- package/src/memory/shareableGuestUnpacker.native.ts +168 -0
- package/src/memory/shareableHostUnpacker.native.ts +31 -0
- package/src/memory/synchronizable.native.ts +17 -0
- package/src/memory/synchronizable.ts +9 -0
- package/src/memory/synchronizableUnpacker.native.ts +65 -0
- package/src/memory/types.ts +191 -0
- package/src/memory/valueUnpacker.native.ts +79 -0
- package/src/mock.ts +111 -0
- package/src/platformChecker.native.ts +3 -0
- package/src/platformChecker.ts +4 -0
- package/src/privateGlobals.d.ts +127 -0
- package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
- package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
- package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
- package/src/runLoop/uiRuntime/requestAnimationFrame.ts +87 -0
- package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
- package/src/runLoop/workletRuntime/index.ts +18 -0
- package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
- package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
- package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
- package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
- package/src/runtimeKind.ts +85 -0
- package/src/runtimes.native.ts +572 -0
- package/src/runtimes.ts +107 -0
- package/src/specs/NativeWorkletsModule.ts +11 -0
- package/src/specs/index.ts +13 -0
- package/src/threads.native.ts +408 -0
- package/src/threads.ts +110 -0
- package/src/types.ts +164 -0
- package/src/workletFunction.ts +41 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <worklets/Tools/PlatformLogger.h>
|
|
3
|
+
|
|
4
|
+
namespace worklets {
|
|
5
|
+
|
|
6
|
+
void PlatformLogger::log(const char *str)
|
|
7
|
+
{
|
|
8
|
+
NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
void PlatformLogger::log(const std::string &str)
|
|
12
|
+
{
|
|
13
|
+
log(str.c_str());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
void PlatformLogger::log(const double d)
|
|
17
|
+
{
|
|
18
|
+
NSLog(@"%lf", d);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void PlatformLogger::log(const int i)
|
|
22
|
+
{
|
|
23
|
+
NSLog(@"%i", i);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void PlatformLogger::log(const bool b)
|
|
27
|
+
{
|
|
28
|
+
log(b ? "true" : "false");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
} // namespace worklets
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#import <QuartzCore/QuartzCore.h>
|
|
2
|
+
|
|
3
|
+
#import <worklets/apple/SlowAnimations.h>
|
|
4
|
+
|
|
5
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
6
|
+
#import <dlfcn.h>
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
namespace worklets {
|
|
10
|
+
|
|
11
|
+
CGFloat getUIAnimationDragCoefficient(void)
|
|
12
|
+
{
|
|
13
|
+
static float (*UIAnimationDragCoefficient)(void) = NULL;
|
|
14
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
15
|
+
static dispatch_once_t onceToken;
|
|
16
|
+
dispatch_once(&onceToken, ^{
|
|
17
|
+
UIAnimationDragCoefficient = reinterpret_cast<float (*)(void)>(dlsym(RTLD_DEFAULT, "UIAnimationDragCoefficient"));
|
|
18
|
+
});
|
|
19
|
+
#endif
|
|
20
|
+
return UIAnimationDragCoefficient ? UIAnimationDragCoefficient() : 1.f;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
CFTimeInterval calculateTimestampWithSlowAnimations(CFTimeInterval currentTimestamp)
|
|
24
|
+
{
|
|
25
|
+
static const auto MILLISECONDS_IN_SECOND = 1000;
|
|
26
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
27
|
+
static CFTimeInterval dragCoefChangedTimestamp = CACurrentMediaTime();
|
|
28
|
+
static CGFloat previousDragCoef = getUIAnimationDragCoefficient();
|
|
29
|
+
|
|
30
|
+
const CGFloat dragCoef = getUIAnimationDragCoefficient();
|
|
31
|
+
if (previousDragCoef != dragCoef) {
|
|
32
|
+
previousDragCoef = dragCoef;
|
|
33
|
+
dragCoefChangedTimestamp = CACurrentMediaTime();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const bool areSlowAnimationsEnabled = dragCoef != 1.f;
|
|
37
|
+
if (areSlowAnimationsEnabled) {
|
|
38
|
+
currentTimestamp = (dragCoefChangedTimestamp + (currentTimestamp - dragCoefChangedTimestamp) / dragCoef);
|
|
39
|
+
}
|
|
40
|
+
#endif // TARGET_IPHONE_SIMULATOR
|
|
41
|
+
currentTimestamp *= MILLISECONDS_IN_SECOND;
|
|
42
|
+
return currentTimestamp;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
} // namespace worklets
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#if TARGET_OS_OSX
|
|
2
|
+
|
|
3
|
+
#ifdef __cplusplus
|
|
4
|
+
extern "C" {
|
|
5
|
+
#endif // __cplusplus
|
|
6
|
+
|
|
7
|
+
#import <React/RCTPlatformDisplayLink.h>
|
|
8
|
+
|
|
9
|
+
#ifdef __cplusplus
|
|
10
|
+
}
|
|
11
|
+
#endif // __cplusplus
|
|
12
|
+
|
|
13
|
+
typedef RCTPlatformDisplayLink WorkletsDisplayLink;
|
|
14
|
+
|
|
15
|
+
#else // TARGET_OS_OSX
|
|
16
|
+
|
|
17
|
+
#import <QuartzCore/CADisplayLink.h>
|
|
18
|
+
|
|
19
|
+
typedef CADisplayLink WorkletsDisplayLink;
|
|
20
|
+
|
|
21
|
+
#endif // TARGET_OS_OSX
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#import <React/RCTCallInvokerModule.h>
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
|
+
#import <React/RCTInvalidating.h>
|
|
4
|
+
|
|
5
|
+
#import <rnworklets/rnworklets.h>
|
|
6
|
+
|
|
7
|
+
#import <worklets/NativeModules/WorkletsModuleProxy.h>
|
|
8
|
+
|
|
9
|
+
#if __has_include(<React/RCTBundleConsumer.h>)
|
|
10
|
+
// Bundle mode
|
|
11
|
+
#import <React/NSBigStringBuffer.h>
|
|
12
|
+
#import <React/RCTBundleConsumer.h>
|
|
13
|
+
#endif // __has_include(<React/RCTBundleConsumer.h>)
|
|
14
|
+
|
|
15
|
+
@interface WorkletsModule : RCTEventEmitter <
|
|
16
|
+
NativeWorkletsModuleSpec,
|
|
17
|
+
RCTCallInvokerModule,
|
|
18
|
+
RCTInvalidating
|
|
19
|
+
#if __has_include(<React/RCTBundleConsumer.h>)
|
|
20
|
+
// Bundle mode
|
|
21
|
+
,
|
|
22
|
+
RCTBundleConsumer
|
|
23
|
+
#endif // __has_include(<React/RCTBundleConsumer.h>)
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
- (std::shared_ptr<worklets::WorkletsModuleProxy>)getWorkletsModuleProxy;
|
|
27
|
+
|
|
28
|
+
@end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#import <worklets/NativeModules/JSIWorkletsModuleProxy.h>
|
|
2
|
+
#import <worklets/Tools/RNRuntimeStatus.h>
|
|
3
|
+
#import <worklets/Tools/ScriptBuffer.h>
|
|
4
|
+
#import <worklets/Tools/SingleInstanceChecker.h>
|
|
5
|
+
#import <worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h>
|
|
6
|
+
#import <worklets/apple/AnimationFrameQueue.h>
|
|
7
|
+
#import <worklets/apple/AssertJavaScriptQueue.h>
|
|
8
|
+
#import <worklets/apple/AssertTurboModuleManagerQueue.h>
|
|
9
|
+
#import <worklets/apple/IOSUIScheduler.h>
|
|
10
|
+
#import <worklets/apple/WorkletsModule.h>
|
|
11
|
+
|
|
12
|
+
#import <React/RCTBridge+Private.h>
|
|
13
|
+
#import <React/RCTCallInvoker.h>
|
|
14
|
+
|
|
15
|
+
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
16
|
+
#import <React/RCTNetworking.h>
|
|
17
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
18
|
+
#import <worklets/apple/Networking/WorkletsNetworking.h>
|
|
19
|
+
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
20
|
+
|
|
21
|
+
using namespace worklets;
|
|
22
|
+
|
|
23
|
+
@interface RCTBridge (JSIRuntime)
|
|
24
|
+
- (void *)runtime;
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
@implementation WorkletsModule {
|
|
28
|
+
AnimationFrameQueue *animationFrameQueue_;
|
|
29
|
+
std::shared_ptr<WorkletsModuleProxy> workletsModuleProxy_;
|
|
30
|
+
std::shared_ptr<RNRuntimeStatus> rnRuntimeStatus_;
|
|
31
|
+
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
32
|
+
WorkletsNetworking *workletsNetworking_;
|
|
33
|
+
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
34
|
+
#ifndef NDEBUG
|
|
35
|
+
SingleInstanceChecker<WorkletsModule> singleInstanceChecker_;
|
|
36
|
+
#endif // NDEBUG
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (std::shared_ptr<WorkletsModuleProxy>)getWorkletsModuleProxy
|
|
40
|
+
{
|
|
41
|
+
AssertJavaScriptQueue();
|
|
42
|
+
return workletsModuleProxy_;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@synthesize bundleManager = bundleManager_;
|
|
46
|
+
@synthesize callInvoker = callInvoker_;
|
|
47
|
+
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
48
|
+
@synthesize moduleRegistry = moduleRegistry_;
|
|
49
|
+
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_MODULE(WorkletsModule);
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(installTurboModule : (BOOL)bundleModeEnabled)
|
|
54
|
+
{
|
|
55
|
+
react_native_assert(self.bridge != nullptr);
|
|
56
|
+
react_native_assert(self.bridge.runtime != nullptr);
|
|
57
|
+
|
|
58
|
+
AssertJavaScriptQueue();
|
|
59
|
+
|
|
60
|
+
jsi::Runtime &rnRuntime = *reinterpret_cast<facebook::jsi::Runtime *>(self.bridge.runtime);
|
|
61
|
+
|
|
62
|
+
std::string sourceURL = "";
|
|
63
|
+
std::shared_ptr<const ScriptBuffer> script = nullptr;
|
|
64
|
+
|
|
65
|
+
if (bundleModeEnabled) {
|
|
66
|
+
NSURL *url = bundleManager_.bundleURL;
|
|
67
|
+
script = [self getScript:url];
|
|
68
|
+
sourceURL = [[url absoluteString] UTF8String];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
72
|
+
id networkingModule = [moduleRegistry_ moduleForClass:RCTNetworking.class];
|
|
73
|
+
workletsNetworking_ = [[WorkletsNetworking alloc] init:networkingModule];
|
|
74
|
+
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
75
|
+
|
|
76
|
+
auto jsCallInvoker = callInvoker_.callInvoker;
|
|
77
|
+
auto uiScheduler = std::make_shared<IOSUIScheduler>();
|
|
78
|
+
auto isJavaScriptQueue = []() -> bool {
|
|
79
|
+
return IsJavaScriptQueue();
|
|
80
|
+
};
|
|
81
|
+
animationFrameQueue_ = [AnimationFrameQueue new];
|
|
82
|
+
auto runtimeBindings = [self getRuntimeBindings:rnRuntime bundleModeEnabled:bundleModeEnabled];
|
|
83
|
+
rnRuntimeStatus_ = std::make_shared<RNRuntimeStatus>();
|
|
84
|
+
|
|
85
|
+
workletsModuleProxy_ = std::make_shared<WorkletsModuleProxy>(
|
|
86
|
+
rnRuntime,
|
|
87
|
+
jsCallInvoker,
|
|
88
|
+
uiScheduler,
|
|
89
|
+
std::move(isJavaScriptQueue),
|
|
90
|
+
runtimeBindings,
|
|
91
|
+
BundleModeConfig{.enabled = static_cast<bool>(bundleModeEnabled), .script = script, .sourceURL = sourceURL},
|
|
92
|
+
rnRuntimeStatus_);
|
|
93
|
+
|
|
94
|
+
return @YES;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(start)
|
|
98
|
+
{
|
|
99
|
+
AssertJavaScriptQueue();
|
|
100
|
+
workletsModuleProxy_->start();
|
|
101
|
+
return @YES;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(toggleSlowAnimationsOnUIRuntime)
|
|
105
|
+
{
|
|
106
|
+
throw std::runtime_error("[Worklets] toggleSlowAnimationsOnUIRuntime is not supported on iOS.");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
- (void)invalidate
|
|
110
|
+
{
|
|
111
|
+
AssertTurboModuleManagerQueue();
|
|
112
|
+
|
|
113
|
+
[animationFrameQueue_ invalidate];
|
|
114
|
+
|
|
115
|
+
if (rnRuntimeStatus_) {
|
|
116
|
+
rnRuntimeStatus_->setDead();
|
|
117
|
+
}
|
|
118
|
+
workletsModuleProxy_.reset();
|
|
119
|
+
|
|
120
|
+
[super invalidate];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
124
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
125
|
+
{
|
|
126
|
+
AssertJavaScriptQueue();
|
|
127
|
+
return std::make_shared<facebook::react::NativeWorkletsModuleSpecJSI>(params);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (std::shared_ptr<const ScriptBuffer>)getScript:(NSURL *)url
|
|
131
|
+
{
|
|
132
|
+
NSData *data = [NSData dataWithContentsOfURL:url];
|
|
133
|
+
|
|
134
|
+
if (!data) [[unlikely]] {
|
|
135
|
+
NSString *errorMsg = [NSString stringWithFormat:@"[Worklets] Failed to load worklets bundle from URL: %@", url];
|
|
136
|
+
NSLog(@"%@", errorMsg);
|
|
137
|
+
throw std::runtime_error([errorMsg UTF8String]);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
auto str = std::string(reinterpret_cast<const char *>([data bytes]), [data length]);
|
|
141
|
+
auto bigString = std::make_shared<const JSBigStdString>(str);
|
|
142
|
+
return std::make_shared<const ScriptBuffer>(bigString);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
- (std::shared_ptr<RuntimeBindings>)getRuntimeBindings:(jsi::Runtime &)rnRuntime
|
|
146
|
+
bundleModeEnabled:(BOOL)bundleModeEnabled
|
|
147
|
+
{
|
|
148
|
+
return std::make_shared<RuntimeBindings>(RuntimeBindings{
|
|
149
|
+
.requestAnimationFrame = [animationFrameQueue =
|
|
150
|
+
animationFrameQueue_](std::function<void(const double)> &&callback) -> void {
|
|
151
|
+
[animationFrameQueue requestAnimationFrame:callback];
|
|
152
|
+
},
|
|
153
|
+
.nativeLoggingHook =
|
|
154
|
+
bundleModeEnabled ? extractNativeLoggingHookFromRNRuntime(rnRuntime) : RuntimeBindings::NativeLoggingHook{}
|
|
155
|
+
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
156
|
+
,
|
|
157
|
+
.abortRequest =
|
|
158
|
+
[workletsNetworking = workletsNetworking_](jsi::Runtime &rt, const jsi::Value &requestID) {
|
|
159
|
+
[workletsNetworking jsiAbortRequest:requestID.asNumber()];
|
|
160
|
+
return jsi::Value::undefined();
|
|
161
|
+
},
|
|
162
|
+
.clearCookies =
|
|
163
|
+
[workletsNetworking = workletsNetworking_](jsi::Runtime &rt, jsi::Function &&responseSender) {
|
|
164
|
+
[workletsNetworking jsiClearCookies:rt responseSender:(std::move(responseSender))];
|
|
165
|
+
return jsi::Value::undefined();
|
|
166
|
+
},
|
|
167
|
+
.sendRequest =
|
|
168
|
+
[workletsNetworking = workletsNetworking_](
|
|
169
|
+
jsi::Runtime &rt, const jsi::Value &query, jsi::Function &&responseSender) {
|
|
170
|
+
[workletsNetworking jsiSendRequest:rt jquery:query responseSender:(std::move(responseSender))];
|
|
171
|
+
return jsi::Value::undefined();
|
|
172
|
+
}
|
|
173
|
+
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@end
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const workletsPackageParentDir = path.resolve(__dirname, '../..');
|
|
4
|
+
const reactNativeShimPath = path.join(__dirname, 'shims', 'reactNativeShim.js');
|
|
5
|
+
const turboModuleRegistryShimPath = path.join(
|
|
6
|
+
__dirname,
|
|
7
|
+
'shims',
|
|
8
|
+
'turboModuleRegistryShim.js'
|
|
9
|
+
);
|
|
10
|
+
const turboModuleRegistryModuleName =
|
|
11
|
+
'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
12
|
+
const turboModuleRegistryFileSuffix = path.join(
|
|
13
|
+
'react-native',
|
|
14
|
+
'Libraries',
|
|
15
|
+
'TurboModule',
|
|
16
|
+
'TurboModuleRegistry.js'
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
function isResolvedTurboModuleRegistry(/** @type {any} */ result) {
|
|
20
|
+
return (
|
|
21
|
+
result?.type === 'sourceFile' &&
|
|
22
|
+
typeof result.filePath === 'string' &&
|
|
23
|
+
result.filePath.endsWith(turboModuleRegistryFileSuffix)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const workletsPackageName = 'react-native-worklets';
|
|
28
|
+
const workletsDirPath = path.posix.join(workletsPackageName, '.worklets');
|
|
29
|
+
const workletsSrcEntryPath = path.posix.join(
|
|
30
|
+
workletsPackageName,
|
|
31
|
+
'src',
|
|
32
|
+
'index.ts'
|
|
33
|
+
);
|
|
34
|
+
const workletsLibEntryPath = path.posix.join(
|
|
35
|
+
workletsPackageName,
|
|
36
|
+
'lib',
|
|
37
|
+
'module',
|
|
38
|
+
'index.js'
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
function bundleModeResolveRequest(
|
|
42
|
+
/** @type {any} */ context,
|
|
43
|
+
/** @type {string} */ moduleName,
|
|
44
|
+
/** @type {any} */ platform,
|
|
45
|
+
/** @type {any} */ userConfigResolveRequest
|
|
46
|
+
) {
|
|
47
|
+
if (moduleName.startsWith(workletsDirPath)) {
|
|
48
|
+
const fullModuleName = path.join(workletsPackageParentDir, moduleName);
|
|
49
|
+
return { type: 'sourceFile', filePath: fullModuleName };
|
|
50
|
+
}
|
|
51
|
+
if (
|
|
52
|
+
moduleName === 'react-native' &&
|
|
53
|
+
context.originModulePath !== reactNativeShimPath
|
|
54
|
+
) {
|
|
55
|
+
return { type: 'sourceFile', filePath: reactNativeShimPath };
|
|
56
|
+
}
|
|
57
|
+
if (
|
|
58
|
+
moduleName === turboModuleRegistryModuleName &&
|
|
59
|
+
context.originModulePath !== turboModuleRegistryShimPath
|
|
60
|
+
) {
|
|
61
|
+
return { type: 'sourceFile', filePath: turboModuleRegistryShimPath };
|
|
62
|
+
}
|
|
63
|
+
const resolved = (userConfigResolveRequest || context.resolveRequest)(
|
|
64
|
+
context,
|
|
65
|
+
moduleName,
|
|
66
|
+
platform
|
|
67
|
+
);
|
|
68
|
+
if (
|
|
69
|
+
context.originModulePath !== turboModuleRegistryShimPath &&
|
|
70
|
+
isResolvedTurboModuleRegistry(resolved)
|
|
71
|
+
) {
|
|
72
|
+
return { type: 'sourceFile', filePath: turboModuleRegistryShimPath };
|
|
73
|
+
}
|
|
74
|
+
return resolved;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Use in React Native Community projects. */
|
|
78
|
+
const bundleModeMetroConfig = {
|
|
79
|
+
serializer: {
|
|
80
|
+
createModuleIdFactory: bundleModeCreateModuleIdFactory,
|
|
81
|
+
},
|
|
82
|
+
resolver: {
|
|
83
|
+
resolveRequest: (
|
|
84
|
+
/** @type {any} */ context,
|
|
85
|
+
/** @type {string} */ moduleName,
|
|
86
|
+
/** @type {any} */ platform
|
|
87
|
+
) => {
|
|
88
|
+
if (moduleName.startsWith(workletsDirPath)) {
|
|
89
|
+
const fullModuleName = path.join(workletsPackageParentDir, moduleName);
|
|
90
|
+
return { type: 'sourceFile', filePath: fullModuleName };
|
|
91
|
+
}
|
|
92
|
+
if (
|
|
93
|
+
moduleName === 'react-native' &&
|
|
94
|
+
context.originModulePath !== reactNativeShimPath
|
|
95
|
+
) {
|
|
96
|
+
return { type: 'sourceFile', filePath: reactNativeShimPath };
|
|
97
|
+
}
|
|
98
|
+
if (
|
|
99
|
+
moduleName === turboModuleRegistryModuleName &&
|
|
100
|
+
context.originModulePath !== turboModuleRegistryShimPath
|
|
101
|
+
) {
|
|
102
|
+
return { type: 'sourceFile', filePath: turboModuleRegistryShimPath };
|
|
103
|
+
}
|
|
104
|
+
const resolved = context.resolveRequest(context, moduleName, platform);
|
|
105
|
+
if (
|
|
106
|
+
context.originModulePath !== turboModuleRegistryShimPath &&
|
|
107
|
+
isResolvedTurboModuleRegistry(resolved)
|
|
108
|
+
) {
|
|
109
|
+
return { type: 'sourceFile', filePath: turboModuleRegistryShimPath };
|
|
110
|
+
}
|
|
111
|
+
return resolved;
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns
|
|
117
|
+
/** Use in Expo projects. */
|
|
118
|
+
function getBundleModeMetroConfig(/** @type {any} */ config) {
|
|
119
|
+
config.serializer.createModuleIdFactory = bundleModeCreateModuleIdFactory;
|
|
120
|
+
|
|
121
|
+
const currentResolveRequest = config?.resolver?.resolveRequest;
|
|
122
|
+
config.resolver.resolveRequest = (
|
|
123
|
+
/** @type {any} */ context,
|
|
124
|
+
/** @type {string} */ moduleName,
|
|
125
|
+
/** @type {any} */ platform
|
|
126
|
+
) =>
|
|
127
|
+
bundleModeResolveRequest(
|
|
128
|
+
context,
|
|
129
|
+
moduleName,
|
|
130
|
+
platform,
|
|
131
|
+
currentResolveRequest
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const currentGetTransformOptions = config?.transformer?.getTransformOptions;
|
|
135
|
+
config.transformer.getTransformOptions = async (...args) => {
|
|
136
|
+
const options = currentGetTransformOptions
|
|
137
|
+
? await currentGetTransformOptions(...args)
|
|
138
|
+
: {};
|
|
139
|
+
return {
|
|
140
|
+
...options,
|
|
141
|
+
transform: {
|
|
142
|
+
...options.transform,
|
|
143
|
+
inlineRequires: true,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return config;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function bundleModeCreateModuleIdFactory() {
|
|
152
|
+
let nextId = 0;
|
|
153
|
+
const idFileMap = new Map();
|
|
154
|
+
return (/** @type {string} */ moduleNameRaw) => {
|
|
155
|
+
const moduleName = moduleNameRaw.replace(/\\/g, '/');
|
|
156
|
+
if (idFileMap.has(moduleName)) {
|
|
157
|
+
return idFileMap.get(moduleName);
|
|
158
|
+
}
|
|
159
|
+
if (moduleName.includes(workletsPackageName)) {
|
|
160
|
+
if (
|
|
161
|
+
moduleName.endsWith(workletsSrcEntryPath) ||
|
|
162
|
+
moduleName.endsWith(workletsLibEntryPath)
|
|
163
|
+
) {
|
|
164
|
+
const entryPointId = -2;
|
|
165
|
+
idFileMap.set(moduleName, entryPointId);
|
|
166
|
+
return entryPointId;
|
|
167
|
+
} else if (moduleName.includes(workletsDirPath)) {
|
|
168
|
+
const base = path.basename(moduleName, '.js');
|
|
169
|
+
const id = Number(base);
|
|
170
|
+
idFileMap.set(moduleName, id);
|
|
171
|
+
return id;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
idFileMap.set(moduleName, nextId++);
|
|
175
|
+
return idFileMap.get(moduleName);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
module.exports = {
|
|
180
|
+
getBundleModeMetroConfig,
|
|
181
|
+
bundleModeMetroConfig,
|
|
182
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
if (
|
|
4
|
+
globalThis.__RUNTIME_KIND === undefined ||
|
|
5
|
+
globalThis.__RUNTIME_KIND === 1
|
|
6
|
+
) {
|
|
7
|
+
globalThis.__RUNTIME_KIND = 1;
|
|
8
|
+
} else if (__DEV__) {
|
|
9
|
+
globalThis.__fbBatchedBridgeConfig = new Proxy(
|
|
10
|
+
{},
|
|
11
|
+
{
|
|
12
|
+
get() {
|
|
13
|
+
throw new Error(
|
|
14
|
+
'[Worklets] Accessing __fbBatchedBridgeConfig is not allowed on Worklet Runtimes. Perhaps you tried to access a Turbo Module?'
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = require('react-native');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** @type {((name: string) => unknown) | undefined} */
|
|
4
|
+
let get;
|
|
5
|
+
/** @type {((name: string) => unknown) | undefined} */
|
|
6
|
+
let getEnforcing;
|
|
7
|
+
|
|
8
|
+
if (
|
|
9
|
+
globalThis.__RUNTIME_KIND === undefined ||
|
|
10
|
+
globalThis.__RUNTIME_KIND === 1
|
|
11
|
+
) {
|
|
12
|
+
globalThis.__RUNTIME_KIND = 1;
|
|
13
|
+
|
|
14
|
+
const TurboModuleRegistry = require('react-native/Libraries/TurboModule/TurboModuleRegistry');
|
|
15
|
+
|
|
16
|
+
get = TurboModuleRegistry.get;
|
|
17
|
+
getEnforcing = TurboModuleRegistry.getEnforcing;
|
|
18
|
+
} else {
|
|
19
|
+
/** @type {Map<string, unknown> | undefined} */
|
|
20
|
+
let TurboModulesPolyfill;
|
|
21
|
+
|
|
22
|
+
if (
|
|
23
|
+
globalThis.__workletsModuleProxy.getStaticFeatureFlag(
|
|
24
|
+
'FETCH_PREVIEW_ENABLED'
|
|
25
|
+
)
|
|
26
|
+
) {
|
|
27
|
+
TurboModulesPolyfill = new Map();
|
|
28
|
+
TurboModulesPolyfill.set('Networking', {});
|
|
29
|
+
|
|
30
|
+
globalThis.TurboModules = TurboModulesPolyfill;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getPolyfill(/** @type {string} */ name) {
|
|
34
|
+
if (__DEV__ && !TurboModulesPolyfill?.has(name)) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`[Worklets] Accessing TurboModules is not allowed on Worklet Runtimes. Requested: "${String(name)}".`
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
return TurboModulesPolyfill?.get(name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get = getPolyfill;
|
|
44
|
+
getEnforcing = getPolyfill;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { get, getEnforcing };
|
package/changes.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bumped": {
|
|
3
|
+
"@babel/generator": {
|
|
4
|
+
"from": "^7.27.1",
|
|
5
|
+
"to": "^8.0.0"
|
|
6
|
+
},
|
|
7
|
+
"@babel/plugin-transform-arrow-functions": {
|
|
8
|
+
"from": "^7.27.1",
|
|
9
|
+
"to": "^8.0.1"
|
|
10
|
+
},
|
|
11
|
+
"@babel/plugin-transform-class-properties": {
|
|
12
|
+
"from": "^7.28.6",
|
|
13
|
+
"to": "^8.0.1"
|
|
14
|
+
},
|
|
15
|
+
"@babel/plugin-transform-classes": {
|
|
16
|
+
"from": "^7.28.6",
|
|
17
|
+
"to": "^8.0.1"
|
|
18
|
+
},
|
|
19
|
+
"@babel/plugin-transform-nullish-coalescing-operator": {
|
|
20
|
+
"from": "^7.28.6",
|
|
21
|
+
"to": "^8.0.1"
|
|
22
|
+
},
|
|
23
|
+
"@babel/plugin-transform-optional-chaining": {
|
|
24
|
+
"from": "^7.28.6",
|
|
25
|
+
"to": "^8.0.1"
|
|
26
|
+
},
|
|
27
|
+
"@babel/plugin-transform-shorthand-properties": {
|
|
28
|
+
"from": "^7.27.1",
|
|
29
|
+
"to": "^8.0.1"
|
|
30
|
+
},
|
|
31
|
+
"@babel/plugin-transform-template-literals": {
|
|
32
|
+
"from": "^7.27.1",
|
|
33
|
+
"to": "^8.0.1"
|
|
34
|
+
},
|
|
35
|
+
"@babel/plugin-transform-unicode-regex": {
|
|
36
|
+
"from": "^7.27.1",
|
|
37
|
+
"to": "^8.0.1"
|
|
38
|
+
},
|
|
39
|
+
"@babel/preset-typescript": {
|
|
40
|
+
"from": "^7.28.5",
|
|
41
|
+
"to": "^8.0.1"
|
|
42
|
+
},
|
|
43
|
+
"@babel/traverse": {
|
|
44
|
+
"from": "^7.27.1",
|
|
45
|
+
"to": "^8.0.4"
|
|
46
|
+
},
|
|
47
|
+
"@babel/types": {
|
|
48
|
+
"from": "^7.27.1",
|
|
49
|
+
"to": "^8.0.4"
|
|
50
|
+
},
|
|
51
|
+
"semver": {
|
|
52
|
+
"from": "^7.7.4",
|
|
53
|
+
"to": "^7.8.5"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"timestamp": "2026-07-26T00:57:50.717Z",
|
|
57
|
+
"totalUpdated": 13
|
|
58
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nightly": {
|
|
3
|
+
"react-native": ["0.83", "0.84", "0.85", "0.86"]
|
|
4
|
+
},
|
|
5
|
+
"0.11.x": {
|
|
6
|
+
"react-native": ["0.83", "0.84", "0.85", "0.86"]
|
|
7
|
+
},
|
|
8
|
+
"0.10.x": {
|
|
9
|
+
"react-native": ["0.83", "0.84", "0.85", "0.86"]
|
|
10
|
+
},
|
|
11
|
+
"0.9.x": {
|
|
12
|
+
"react-native": ["0.83", "0.84", "0.85", "0.86"]
|
|
13
|
+
},
|
|
14
|
+
"0.8.x": {
|
|
15
|
+
"react-native": ["0.81", "0.82", "0.83", "0.84", "0.85"]
|
|
16
|
+
},
|
|
17
|
+
"0.7.x": {
|
|
18
|
+
"react-native": ["0.79", "0.80", "0.81", "0.82", "0.83", "0.84"]
|
|
19
|
+
},
|
|
20
|
+
"0.6.x": {
|
|
21
|
+
"react-native": ["0.78", "0.79", "0.80", "0.81", "0.82"]
|
|
22
|
+
},
|
|
23
|
+
"0.5.x": {
|
|
24
|
+
"react-native": ["0.78", "0.79", "0.80", "0.81"]
|
|
25
|
+
},
|
|
26
|
+
"0.4.x": {
|
|
27
|
+
"react-native": ["0.78", "0.79", "0.80", "0.81"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function countOccurrences(haystack: string, needle: string): number {
|
|
2
|
+
if (!needle) {
|
|
3
|
+
return 0;
|
|
4
|
+
}
|
|
5
|
+
let count = 0;
|
|
6
|
+
let from = 0;
|
|
7
|
+
while (true) {
|
|
8
|
+
const idx = haystack.indexOf(needle, from);
|
|
9
|
+
if (idx === -1) {
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
count++;
|
|
13
|
+
from = idx + needle.length;
|
|
14
|
+
}
|
|
15
|
+
return count;
|
|
16
|
+
}
|