expo-modules-core 56.0.5 → 56.0.7
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/CHANGELOG.md +12 -0
- package/android/build.gradle +2 -2
- package/android/src/main/cpp/Exceptions.cpp +0 -3
- package/android/src/main/cpp/Exceptions.h +1 -4
- package/android/src/main/cpp/ExpoHeader.pch +0 -2
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +1 -2
- package/android/src/main/cpp/ExpoModulesHostObject.h +1 -3
- package/android/src/main/cpp/JNIDeallocator.h +1 -1
- package/android/src/main/cpp/JNIFunctionBody.cpp +0 -1
- package/android/src/main/cpp/JNIFunctionBody.h +1 -2
- package/android/src/main/cpp/JNIInjector.cpp +1 -1
- package/android/src/main/cpp/JNIUtils.cpp +1 -1
- package/android/src/main/cpp/JNIUtils.h +1 -6
- package/android/src/main/cpp/JSIContext.cpp +1 -5
- package/android/src/main/cpp/JSIContext.h +1 -6
- package/android/src/main/cpp/JSITypeConverter.h +1 -5
- package/android/src/main/cpp/JSharedObject.h +1 -1
- package/android/src/main/cpp/JavaCallback.cpp +8 -13
- package/android/src/main/cpp/JavaCallback.h +1 -7
- package/android/src/main/cpp/JavaReferencesCache.cpp +1 -2
- package/android/src/main/cpp/JavaReferencesCache.h +1 -4
- package/android/src/main/cpp/JavaScriptArrayBuffer.h +1 -4
- package/android/src/main/cpp/JavaScriptFunction.h +1 -4
- package/android/src/main/cpp/JavaScriptModuleObject.h +1 -5
- package/android/src/main/cpp/JavaScriptObject.h +1 -5
- package/android/src/main/cpp/JavaScriptRuntime.cpp +0 -1
- package/android/src/main/cpp/JavaScriptRuntime.h +1 -2
- package/android/src/main/cpp/JavaScriptTypedArray.h +1 -4
- package/android/src/main/cpp/JavaScriptValue.h +1 -5
- package/android/src/main/cpp/JavaScriptWeakObject.h +1 -5
- package/android/src/main/cpp/MethodMetadata.cpp +1 -6
- package/android/src/main/cpp/MethodMetadata.h +1 -9
- package/android/src/main/cpp/NativeArrayBuffer.h +1 -4
- package/android/src/main/cpp/RuntimeHolder.h +1 -2
- package/android/src/main/cpp/ThreadSafeJNIGlobalRef.h +1 -1
- package/android/src/main/cpp/concepts/jni.h +4 -4
- package/android/src/main/cpp/concepts/jni_deref.h +1 -1
- package/android/src/main/cpp/concepts/jsi.h +1 -1
- package/android/src/main/cpp/decorators/JSClassesDecorator.h +1 -3
- package/android/src/main/cpp/decorators/JSConstantsDecorator.cpp +1 -4
- package/android/src/main/cpp/decorators/JSConstantsDecorator.h +1 -3
- package/android/src/main/cpp/decorators/JSDecorator.h +1 -2
- package/android/src/main/cpp/decorators/JSDecoratorsBridgingObject.h +1 -4
- package/android/src/main/cpp/decorators/JSFunctionsDecorator.cpp +1 -2
- package/android/src/main/cpp/decorators/JSFunctionsDecorator.h +1 -5
- package/android/src/main/cpp/decorators/JSObjectDecorator.h +1 -1
- package/android/src/main/cpp/decorators/JSPropertiesDecorator.cpp +1 -2
- package/android/src/main/cpp/decorators/JSPropertiesDecorator.h +1 -3
- package/android/src/main/cpp/fabric/AndroidExpoViewProps.h +1 -1
- package/android/src/main/cpp/fabric/AndroidExpoViewState.h +1 -3
- package/android/src/main/cpp/fabric/FabricComponentsRegistry.h +1 -1
- package/android/src/main/cpp/fabric/NativeStatePropsGetter.h +1 -2
- package/android/src/main/cpp/installers/MainRuntimeInstaller.h +1 -2
- package/android/src/main/cpp/installers/WorkletRuntimeInstaller.h +1 -2
- package/android/src/main/cpp/javaclasses/Collections.h +1 -1
- package/android/src/main/cpp/javaclasses/JSRunnable.h +1 -1
- package/android/src/main/cpp/types/AnyType.cpp +0 -1
- package/android/src/main/cpp/types/AnyType.h +1 -2
- package/android/src/main/cpp/types/ExpectedType.h +1 -1
- package/android/src/main/cpp/types/FrontendConverter.cpp +1 -1
- package/android/src/main/cpp/types/FrontendConverter.h +1 -3
- package/android/src/main/cpp/types/FrontendConverterProvider.h +1 -5
- package/android/src/main/cpp/types/JNIToJSIConverter.h +13 -16
- package/android/src/main/cpp/worklets/Serializable.h +2 -2
- package/android/src/main/cpp/worklets/Worklet.h +2 -5
- package/android/src/main/cpp/worklets/WorkletJSCallInvoker.h +2 -4
- package/android/src/main/cpp/worklets/WorkletNativeRuntime.h +2 -2
- package/ios/Core/AppContext.swift +26 -4
- package/ios/Core/DynamicTypes/DynamicEncodableType.swift +5 -4
- package/ios/Core/JSValueEncoder.swift +255 -96
- package/ios/JS/EXReactSchedulerDispatch.h +28 -0
- package/ios/JS/EXReactSchedulerDispatch.mm +19 -0
- package/package.json +3 -3
- package/prebuilds/output/debug/xcframeworks/ExpoModulesCore.tar.gz +0 -0
- package/prebuilds/output/debug/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoModulesCore.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright © 2021-present 650 Industries, Inc. (aka Expo)
|
|
2
2
|
|
|
3
|
+
#include "../ExpoHeader.pch"
|
|
3
4
|
#include "JSPropertiesDecorator.h"
|
|
4
5
|
#include "../JavaScriptObject.h"
|
|
5
6
|
#include "JSIUtils.h"
|
|
6
7
|
#include "JSFunctionsDecorator.h"
|
|
7
8
|
|
|
8
|
-
#include <jsi/jsi.h>
|
|
9
|
-
|
|
10
9
|
namespace jsi = facebook::jsi;
|
|
11
10
|
|
|
12
11
|
namespace expo {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright © 2021-present 650 Industries, Inc. (aka Expo)
|
|
2
2
|
|
|
3
|
+
#include "../ExpoHeader.pch"
|
|
3
4
|
#include "FrontendConverter.h"
|
|
4
5
|
#include "ExpectedType.h"
|
|
5
6
|
#include "FrontendConverterProvider.h"
|
|
@@ -17,7 +18,6 @@
|
|
|
17
18
|
|
|
18
19
|
#include "react/jni/ReadableNativeMap.h"
|
|
19
20
|
#include "react/jni/ReadableNativeArray.h"
|
|
20
|
-
#include <jsi/JSIDynamic.h>
|
|
21
21
|
|
|
22
22
|
#include <utility>
|
|
23
23
|
#include <algorithm>
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../ExpoHeader.pch"
|
|
5
6
|
#include "CppType.h"
|
|
6
7
|
#include "FrontendConverter.h"
|
|
7
8
|
#include "ExpectedType.h"
|
|
8
9
|
|
|
9
|
-
#include <fbjni/fbjni.h>
|
|
10
|
-
|
|
11
|
-
#include <memory>
|
|
12
|
-
#include <unordered_map>
|
|
13
|
-
|
|
14
10
|
namespace jni = facebook::jni;
|
|
15
11
|
|
|
16
12
|
namespace expo {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include "../ExpoHeader.pch"
|
|
5
6
|
#include "../JSIContext.h"
|
|
6
7
|
#include "../JSharedObject.h"
|
|
7
8
|
#include "../JNIUtils.h"
|
|
8
9
|
#include "ObjectDeallocator.h"
|
|
9
|
-
#include "../javaclasses/Collections.h"
|
|
10
10
|
#include "../JavaScriptArrayBuffer.h"
|
|
11
11
|
#include "../NativeArrayBuffer.h"
|
|
12
12
|
#include "../concepts/jni_deref.h"
|
|
@@ -14,17 +14,8 @@
|
|
|
14
14
|
#include "../concepts/jsi.h"
|
|
15
15
|
#include "ReturnType.h"
|
|
16
16
|
|
|
17
|
-
#include <fbjni/fbjni.h>
|
|
18
|
-
#include <jsi/jsi.h>
|
|
19
|
-
#include <optional>
|
|
20
17
|
#include <concepts>
|
|
21
18
|
|
|
22
|
-
#include <react/jni/ReadableNativeMap.h>
|
|
23
|
-
#include <react/jni/ReadableNativeArray.h>
|
|
24
|
-
#include <react/jni/WritableNativeArray.h>
|
|
25
|
-
#include <react/jni/WritableNativeMap.h>
|
|
26
|
-
#include <jsi/JSIDynamic.h>
|
|
27
|
-
|
|
28
19
|
namespace jni = facebook::jni;
|
|
29
20
|
namespace jsi = facebook::jsi;
|
|
30
21
|
namespace react = facebook::react;
|
|
@@ -63,11 +54,17 @@ struct RawArray {
|
|
|
63
54
|
};
|
|
64
55
|
|
|
65
56
|
template<typename T>
|
|
66
|
-
inline auto unwrapJNIRef(
|
|
57
|
+
inline auto unwrapJNIRef(
|
|
58
|
+
JNIEnv *env,
|
|
59
|
+
T &&value
|
|
60
|
+
) {
|
|
67
61
|
if constexpr (HasCthis<T>) {
|
|
68
62
|
return value->cthis();
|
|
69
|
-
} else if constexpr (
|
|
70
|
-
|
|
63
|
+
} else if constexpr (IsJString<T>) {
|
|
64
|
+
const char *rawValue = env->GetStringUTFChars(value.get(), nullptr);
|
|
65
|
+
std::string result = rawValue;
|
|
66
|
+
env->ReleaseStringUTFChars(value.get(), rawValue);
|
|
67
|
+
return result;
|
|
71
68
|
} else if constexpr (IsJBoolean<T>) {
|
|
72
69
|
return static_cast<bool>(value->value());
|
|
73
70
|
} else if constexpr (HasValue<T>) {
|
|
@@ -287,13 +284,13 @@ concept SimpleConversion = requires(JNIEnv *env, jsi::Runtime &rt, T value) {
|
|
|
287
284
|
|
|
288
285
|
template<typename T>
|
|
289
286
|
jsi::Value convertToJS(JNIEnv *env, jsi::Runtime &rt, T &&value) {
|
|
290
|
-
using UnwrappedType = decltype(unwrapJNIRef(std::declval<T>()));
|
|
287
|
+
using UnwrappedType = decltype(unwrapJNIRef(env, std::declval<T>()));
|
|
291
288
|
using Converter = JNIToJSIConverter<UnwrappedType>;
|
|
292
289
|
|
|
293
290
|
if constexpr (SimpleConversion<Converter, UnwrappedType>) {
|
|
294
|
-
return Converter::convert(env, rt, unwrapJNIRef(std::forward<T>(value)));
|
|
291
|
+
return Converter::convert(env, rt, unwrapJNIRef(env, std::forward<T>(value)));
|
|
295
292
|
} else {
|
|
296
|
-
return Converter::convert(env, rt, unwrapJNIRef(value), value);
|
|
293
|
+
return Converter::convert(env, rt, unwrapJNIRef(env, value), value);
|
|
297
294
|
}
|
|
298
295
|
}
|
|
299
296
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include "../ExpoHeader.pch"
|
|
4
|
+
|
|
3
5
|
#if WORKLETS_ENABLED
|
|
4
6
|
|
|
5
7
|
#include "../JSIContext.h"
|
|
6
8
|
#include "../JNIDeallocator.h"
|
|
7
|
-
#include "WorkletNativeRuntime.h"
|
|
8
9
|
|
|
9
|
-
#include <fbjni/fbjni.h>
|
|
10
10
|
#include <worklets/SharedItems/Serializable.h>
|
|
11
11
|
|
|
12
12
|
namespace jni = facebook::jni;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include "../ExpoHeader.pch"
|
|
4
|
+
|
|
3
5
|
#if WORKLETS_ENABLED
|
|
4
6
|
|
|
5
|
-
#include "../JSIContext.h"
|
|
6
|
-
#include "../JNIDeallocator.h"
|
|
7
7
|
#include "WorkletNativeRuntime.h"
|
|
8
8
|
#include "Serializable.h"
|
|
9
9
|
|
|
10
|
-
#include <fbjni/fbjni.h>
|
|
11
|
-
#include <worklets/SharedItems/Serializable.h>
|
|
12
|
-
|
|
13
10
|
namespace jni = facebook::jni;
|
|
14
11
|
|
|
15
12
|
namespace expo {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include "../ExpoHeader.pch"
|
|
4
|
+
|
|
3
5
|
#if WORKLETS_ENABLED
|
|
4
6
|
|
|
5
7
|
#include <ReactCommon/CallInvoker.h>
|
|
6
|
-
#include <ReactCommon/RuntimeExecutor.h>
|
|
7
8
|
|
|
8
9
|
#include <worklets/WorkletRuntime/WorkletRuntime.h>
|
|
9
10
|
|
|
10
|
-
#include <memory>
|
|
11
|
-
|
|
12
|
-
|
|
13
11
|
namespace jsi = facebook::jsi;
|
|
14
12
|
namespace react = facebook::react;
|
|
15
13
|
|
|
@@ -429,12 +429,34 @@ public final class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendab
|
|
|
429
429
|
// MARK: - Runtime
|
|
430
430
|
|
|
431
431
|
/**
|
|
432
|
-
Sets the JavaScript runtime from
|
|
433
|
-
|
|
432
|
+
Sets the JavaScript runtime from raw pointers. Called by `ExpoReactNativeFactory`
|
|
433
|
+
when React Native initializes the runtime. When `scheduler` and `dispatch`
|
|
434
|
+
are both provided, `JavaScriptRuntime.schedule(...)` / `.execute(...)` dispatch
|
|
435
|
+
onto the JS thread through them. When either is `nil`, the runtime falls back
|
|
436
|
+
to a synchronous no-op scheduler — callers can detect this via
|
|
437
|
+
`JavaScriptRuntime.supportsAsyncScheduling`.
|
|
438
|
+
|
|
439
|
+
`dispatch` is a raw pointer to a C function with signature
|
|
440
|
+
`void (*)(void *scheduler, int priority, void (^callback)())` — cast back
|
|
441
|
+
to the typed pointer inside `ExpoModulesJSI`. It's typed as `UnsafeRawPointer`
|
|
442
|
+
here rather than `@convention(c)` so the symbol can cross the Objective-C
|
|
443
|
+
bridge without needing a Swift-typed entry point.
|
|
434
444
|
*/
|
|
435
445
|
@objc
|
|
436
|
-
public func setRuntime(
|
|
437
|
-
|
|
446
|
+
public func setRuntime(
|
|
447
|
+
_ runtimePointer: UnsafeMutableRawPointer,
|
|
448
|
+
scheduler: UnsafeMutableRawPointer?,
|
|
449
|
+
dispatch: UnsafeRawPointer?
|
|
450
|
+
) {
|
|
451
|
+
if let scheduler, let dispatch {
|
|
452
|
+
_runtime = ExpoRuntime(
|
|
453
|
+
unsafePointer: runtimePointer,
|
|
454
|
+
scheduler: scheduler,
|
|
455
|
+
dispatch: dispatch
|
|
456
|
+
)
|
|
457
|
+
} else {
|
|
458
|
+
_runtime = ExpoRuntime(unsafePointer: runtimePointer)
|
|
459
|
+
}
|
|
438
460
|
}
|
|
439
461
|
|
|
440
462
|
@JavaScriptActor
|
|
@@ -29,15 +29,16 @@ internal struct DynamicEncodableType: AnyDynamicType {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
func castToJS<ValueType>(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue {
|
|
32
|
+
return try castToJS(value, appContext: appContext, in: try appContext.runtime)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
func castToJS<ValueType>(_ value: ValueType, appContext: AppContext, in runtime: JavaScriptRuntime) throws -> JavaScriptValue {
|
|
32
36
|
if let value = value as? JavaScriptValue {
|
|
33
37
|
return value
|
|
34
38
|
}
|
|
35
39
|
if let value = value as? Encodable {
|
|
36
|
-
let
|
|
37
|
-
let encoder = JSValueEncoder(runtime: runtime)
|
|
38
|
-
|
|
40
|
+
let encoder = JSValueEncoder(appContext: appContext, runtime: runtime)
|
|
39
41
|
try value.encode(to: encoder)
|
|
40
|
-
|
|
41
42
|
return encoder.value
|
|
42
43
|
}
|
|
43
44
|
throw Conversions.ConversionToJSFailedException((kind: .object, nativeType: ValueType.self))
|