expo-modules-core 58.0.14 → 58.0.16
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 +37 -0
- package/android/build.gradle +2 -2
- package/android/prebuilt/metadata.json +2 -2
- package/android/prebuilt/native-libs.tar.xz +0 -0
- package/android/proguard-rules.pro +34 -0
- package/android/src/main/cpp/fabric/AndroidExpoViewComponentDescriptor.cpp +0 -18
- package/android/src/main/java/expo/modules/kotlin/ExpoBridgeModule.kt +20 -4
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/NativeModulesProxyModule.kt +7 -3
- package/android/src/main/java/expo/modules/kotlin/views/ShadowNodeProxy.kt +21 -3
- package/ios/Core/AppContext.swift +15 -12
- package/ios/Core/ArrayBuffers/ArrayBuffer.swift +4 -1
- package/ios/Core/Classes/ClassDefinition.swift +6 -1
- package/ios/Core/Classes/ClassRegistry.swift +5 -3
- package/ios/Core/Conversions.swift +43 -5
- package/ios/Core/DynamicTypes/AnyDynamicType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicArrayBufferType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicArrayType.swift +2 -2
- package/ios/Core/DynamicTypes/DynamicBoolType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicCodableType.swift +5 -5
- package/ios/Core/DynamicTypes/DynamicConvertibleType.swift +1 -7
- package/ios/Core/DynamicTypes/DynamicDataType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicDictionaryType.swift +2 -2
- package/ios/Core/DynamicTypes/DynamicEitherType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicEnumType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicJavaScriptType.swift +12 -6
- package/ios/Core/DynamicTypes/DynamicNumberType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicOptionalType.swift +4 -4
- package/ios/Core/DynamicTypes/DynamicRawType.swift +3 -3
- package/ios/Core/DynamicTypes/DynamicSharedObjectType.swift +2 -2
- package/ios/Core/DynamicTypes/DynamicStringType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicSwiftUIViewType.swift +2 -2
- package/ios/Core/DynamicTypes/DynamicTypedArrayType.swift +1 -1
- package/ios/Core/DynamicTypes/DynamicValueOrUndefinedType.swift +5 -5
- package/ios/Core/DynamicTypes/DynamicViewType.swift +2 -2
- package/ios/Core/DynamicTypes/DynamicVoidType.swift +2 -2
- package/ios/Core/Events/EventEmitter.swift +9 -3
- package/ios/Core/Exceptions/CommonExceptions.swift +9 -0
- package/ios/Core/Exceptions/Exception.swift +13 -0
- package/ios/Core/Functions/AnyFunctionDefinition.swift +1 -1
- package/ios/Core/Functions/AsyncFunctionDefinition.swift +2 -2
- package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +2 -2
- package/ios/Core/Functions/OptimizedAsyncFunctionDefinition.swift +1 -1
- package/ios/Core/Functions/OptimizedSyncFunctionDefinition.swift +3 -3
- package/ios/Core/Functions/SyncFunctionDefinition.swift +5 -5
- package/ios/Core/JSValueDecoder.swift +32 -17
- package/ios/Core/JSValueEncoder.swift +17 -10
- package/ios/Core/MainValueConverter.swift +1 -1
- package/ios/Core/ModuleHolder.swift +4 -4
- package/ios/Core/Modules/CoreModule.swift +37 -48
- package/ios/Core/Objects/ConstantDefinition.swift +5 -3
- package/ios/Core/Objects/PropertyDefinition.swift +2 -2
- package/ios/Core/Promise.swift +1 -1
- package/ios/Core/Records/AnyField.swift +1 -1
- package/ios/Core/Records/Field.swift +3 -3
- package/ios/Core/Records/Record.swift +1 -4
- package/ios/Core/SharedObjects/SharedObject.swift +1 -1
- package/ios/Core/SharedObjects/SharedObjectNativeState.swift +1 -1
- package/ios/JS/ExpoRuntimeInstaller.swift +4 -5
- package/ios/Worklets/Core/DynamicSerializableType.swift +1 -1
- package/ios/Worklets/Core/DynamicWorkletType.swift +1 -1
- package/package.json +4 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Internal] Bump precompiled artifacts due to ABI breakage in expo-modules-jsi, which makes `JavaScriptValue` a non-copyable struct. ([#51368](https://github.com/expo/expo/pull/51368) by [@tsapeta](https://github.com/tsapeta))
|
|
8
|
+
- [iOS] Update `expo-modules-macros` to 0.16.0, which supports closure arguments in `@JS` functions and initializers. ([#51037](https://github.com/expo/expo/pull/51037) by [@tsapeta](https://github.com/tsapeta))
|
|
9
|
+
- [iOS] [Internal] Hold cached JavaScript values and the encoder and decoder state behind `JavaScriptRef`. ([#50978](https://github.com/expo/expo/pull/50978) by [@tsapeta](https://github.com/tsapeta))
|
|
10
|
+
- [Android] Fix build errors with React Native nightlies by removing an unneeded `enableCppPropsIteratorSetter` check from Expo views. ([#51405](https://github.com/expo/expo/pull/51405) by [@Kudo](https://github.com/Kudo))
|
|
11
|
+
- [iOS] Make `JavaScriptValue` a non-copyable struct. This is a breaking change for Swift code that uses `JavaScriptValue` directly:
|
|
12
|
+
|
|
13
|
+
- Values are moved, not shared. Pass them as `borrowing` or `consuming` parameters, and call `copy()` where a second owned value is needed.
|
|
14
|
+
- `JavaScriptValue.undefined` and `JavaScriptValue.null` are functions now: write `.undefined()` and `.null()`.
|
|
15
|
+
- A `JavaScriptValue` can no longer be an argument or a result of a `Function`, `AsyncFunction`, `Property` or `Field` definition. Declare the function with the `@JS` macro instead (in an `@ExpoModule` or `@SharedObject` class) and take the value as `borrowing JavaScriptValue`, or use a typed argument.
|
|
16
|
+
- To keep a value in an array, an escaping closure or another place that takes copyable types only, wrap it with `value.ref()` and read it back with `take()` or `withUnwrappedValue(_:)`.
|
|
17
|
+
- `JavaScriptArray.init(_:items:)`, `JavaScriptArray.enumerated()`, `JavaScriptArray.filter(_:)` and `JavaScriptValuesBuffer.copying(in:values:)` with an array of values are removed. Use the parameter pack initializer, `forEach`, `forEachIndexed`, `reduce`, or the `[JavaScriptValue.Ref]` overload.
|
|
18
|
+
|
|
19
|
+
([#51368](https://github.com/expo/expo/pull/51368) by [@tsapeta](https://github.com/tsapeta))
|
|
20
|
+
|
|
21
|
+
- [iOS] [Internal] Remove `copy runtime` where a borrowed `JavaScriptRuntime` is passed to a function, which already borrows its parameters. ([#51439](https://github.com/expo/expo/pull/51439) by [@tsapeta](https://github.com/tsapeta))
|
|
22
|
+
- [iOS] Read the properties of a typed array through property names cached per runtime, which makes `JavaScriptValue.getTypedArray()` about twice as fast. `getTypedArray()` is now isolated to `JavaScriptActor`, like `asTypedArray()`. ([#51436](https://github.com/expo/expo/pull/51436) by [@tsapeta](https://github.com/tsapeta))
|
|
23
|
+
- Updated dependencies. ([#51373](https://github.com/expo/expo/pull/51373), [#51037](https://github.com/expo/expo/pull/51037), [#51368](https://github.com/expo/expo/pull/51368), [#50977](https://github.com/expo/expo/pull/50977), [#51438](https://github.com/expo/expo/pull/51438), [#51439](https://github.com/expo/expo/pull/51439), [#51435](https://github.com/expo/expo/pull/51435), [#51436](https://github.com/expo/expo/pull/51436))
|
|
24
|
+
- expo-modules-jsi@58.0.11
|
|
25
|
+
|
|
26
|
+
## 58.0.15
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- [Android] Fix record arguments without `@OptimizedRecord` (such as `ImagePickerOptions` in older `expo-image-picker` versions) failing to convert in minified release builds with `The 1st argument cannot be cast to type ...` caused by a `NullPointerException`. Keep the `@Field` annotation class from being renamed by R8. ([#51206](https://github.com/expo/expo/pull/51206) by [@SoSerious194](https://github.com/SoSerious194))
|
|
31
|
+
- [Android] Fix release builds crashing at launch when the app uses an Expo Modules API 2.0 module, such as `expo-crypto`. R8 removed classes and members that the v2 runtime reaches through reflection and JNI. ([#51204](https://github.com/expo/expo/pull/51204) by [@Kudo](https://github.com/Kudo))
|
|
32
|
+
- [Android] Fixed Expo modules not receiving `OnCreate` when JavaScript reaches the JSI `NativeModulesProxy` before the legacy one, for example with lazy imports, which made modules like `expo-web-browser` fail on first use. Its constants are read lazily again, as before #46964. ([#51310](https://github.com/expo/expo/pull/51310) by [@alanjhughes](https://github.com/alanjhughes))
|
|
33
|
+
- [iOS] Fixed JavaScript errors created from native `Exception`s using the exception's debug description as their `message`, which prefixed it with the Swift type name and appended the native `file:line` (e.g. `MyException: reason (at MyModule.swift:42)`). The message is the exception's `description` again, as before the JSI rewrite and as on Android. `Exception.message` can now be overridden by subclasses; subclasses that already declare a `message` property need to mark it as `override`. ([#51210](https://github.com/expo/expo/pull/51210) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
34
|
+
- [Android] Fix views sized by Jetpack Compose, such as `RNHostView` in a `ModalBottomSheet`, that kept their old size until the keyboard animation ended when the keyboard was dismissed with the predictive back gesture. ([#51083](https://github.com/expo/expo/pull/51083) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
|
35
|
+
- [iOS] Throw when JavaScript constructs a shared object class that has no way to build its native instance, instead of returning an object that fails at its first member access. ([#51171](https://github.com/expo/expo/pull/51171) by [@tsapeta](https://github.com/tsapeta))
|
|
36
|
+
- [Android] Warn instead of failing silently when `installModules()` gives up waiting for an active `ReactInstance`. Previously JSI interop was installed into a context with no active instance and the method still returned `true`, so the first visible symptom was `globalThis.expo` being undefined in JS. ([#49801](https://github.com/expo/expo/pull/49801) by [@JeffreyKlug](https://github.com/JeffreyKlug))
|
|
37
|
+
- Updated dependencies. ([#51129](https://github.com/expo/expo/pull/51129), [#51234](https://github.com/expo/expo/pull/51234))
|
|
38
|
+
- expo-modules-jsi@58.0.10
|
|
39
|
+
|
|
3
40
|
## 58.0.14
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -46,7 +46,7 @@ if (shouldIncludeCompose) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
group = 'host.exp.exponent'
|
|
49
|
-
version = '58.0.
|
|
49
|
+
version = '58.0.16'
|
|
50
50
|
|
|
51
51
|
def isExpoModulesCoreTests = {
|
|
52
52
|
Gradle gradle = getGradle()
|
|
@@ -175,7 +175,7 @@ android {
|
|
|
175
175
|
defaultConfig {
|
|
176
176
|
consumerProguardFiles 'proguard-rules.pro'
|
|
177
177
|
versionCode 1
|
|
178
|
-
versionName "58.0.
|
|
178
|
+
versionName "58.0.16"
|
|
179
179
|
buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
|
|
180
180
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"
|
|
181
181
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"reactNativeVersion": "0.88.0",
|
|
3
|
-
"sourceHash": "
|
|
3
|
+
"sourceHash": "4a484f59a9d342285a14ab862c0ea08a",
|
|
4
4
|
"variants": [
|
|
5
5
|
"debug",
|
|
6
6
|
"release"
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"libexpo-modules-jsi.so"
|
|
17
17
|
],
|
|
18
18
|
"stripped": true,
|
|
19
|
-
"createdAt": "2026-10-
|
|
19
|
+
"createdAt": "2026-10-13T08:41:33.015189716Z"
|
|
20
20
|
}
|
|
Binary file
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
*;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
# RecordTypeConverter reads `Field.key` through reflection to map JS keys to record
|
|
13
|
+
# properties. When R8 renames the annotation class, records without
|
|
14
|
+
# `@OptimizedRecord` can fail to convert with a NullPointerException at that read.
|
|
15
|
+
-keep @interface expo.modules.kotlin.records.Field { *; }
|
|
16
|
+
|
|
12
17
|
-keep class * extends expo.modules.kotlin.sharedobjects.SharedObject
|
|
13
18
|
|
|
14
19
|
-keep enum * implements expo.modules.kotlin.types.Enumerable {
|
|
@@ -48,3 +53,32 @@
|
|
|
48
53
|
-keep class * implements expo.modules.kotlin.services.Service {
|
|
49
54
|
<init>(...);
|
|
50
55
|
}
|
|
56
|
+
|
|
57
|
+
# Expo Modules v2: ExpoModulesV2Host loads the generated list and the modules by reflection.
|
|
58
|
+
-keep class expo.modules.ExpoModulesV2ModuleList { public <init>(); }
|
|
59
|
+
-keep class * extends io.github.expo.modules.v2.Module {
|
|
60
|
+
<init>();
|
|
61
|
+
static ** INSTANCE;
|
|
62
|
+
}
|
|
63
|
+
# The v2 C++ runtime reaches these through JNI, and the artifacts ship no consumer rules.
|
|
64
|
+
-keep class io.github.expo.kolibri.** { *; }
|
|
65
|
+
-keep class io.github.expo.modules.v2.** { *; }
|
|
66
|
+
# JNI calls exported members and generated trampolines by name.
|
|
67
|
+
# A record registers its codec from the static `recordCodec$ExpoModulesV2` field initializer.
|
|
68
|
+
-keepclassmembers class * {
|
|
69
|
+
@io.github.expo.modules.v2.JS *;
|
|
70
|
+
@io.github.expo.modules.v2.Constant *;
|
|
71
|
+
@io.github.expo.modules.v2.Event *;
|
|
72
|
+
*** *$ExpoModulesV2(...);
|
|
73
|
+
static ** *$ExpoModulesV2;
|
|
74
|
+
}
|
|
75
|
+
-keep class **$ExpoModulesV2 { <init>(); }
|
|
76
|
+
# Kotlin puts property annotations on a synthetic method, so the getters need a rule of their own.
|
|
77
|
+
-keepclassmembers class * extends io.github.expo.modules.v2.Module { public *; }
|
|
78
|
+
-keepclassmembers class * extends io.github.expo.modules.v2.SharedObject { public *; }
|
|
79
|
+
# EnumConverter reads an enum's only property field by reflection, and v2 enums have no marker type.
|
|
80
|
+
# Scope it to enums in the package (and subpackages) of a v2 module or shared object.
|
|
81
|
+
-if class **.* extends io.github.expo.modules.v2.Module
|
|
82
|
+
-keepclassmembers,allowobfuscation enum <1>.** { !static <fields>; }
|
|
83
|
+
-if class **.* extends io.github.expo.modules.v2.SharedObject
|
|
84
|
+
-keepclassmembers,allowobfuscation enum <1>.** { !static <fields>; }
|
|
@@ -45,24 +45,6 @@ react::Props::Shared AndroidExpoViewComponentDescriptor::cloneProps(
|
|
|
45
45
|
shadowNodeProps->initializeDynamicProps(sourceProps, rawProps, filterObjectKeys_);
|
|
46
46
|
#endif
|
|
47
47
|
|
|
48
|
-
// TODO(@lukmccall): We probably can remove this loop
|
|
49
|
-
if (react::ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
|
|
50
|
-
#ifdef RN_SERIALIZABLE_STATE
|
|
51
|
-
const auto &dynamic = shadowNodeProps->rawProps;
|
|
52
|
-
#else
|
|
53
|
-
const auto &dynamic = static_cast<folly::dynamic>(rawProps);
|
|
54
|
-
#endif
|
|
55
|
-
for (const auto &pair: dynamic.items()) {
|
|
56
|
-
const auto &name = pair.first.getString();
|
|
57
|
-
shadowNodeProps->setProp(
|
|
58
|
-
context,
|
|
59
|
-
RAW_PROPS_KEY_HASH(name),
|
|
60
|
-
name.c_str(),
|
|
61
|
-
react::RawValue(pair.second)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
48
|
if (!stateProps_.empty()) {
|
|
67
49
|
JNIEnv *env = jni::Environment::current();
|
|
68
50
|
const auto &rawPropsAccessor = *((RawPropsAccessor *) &rawProps);
|
|
@@ -20,9 +20,21 @@ class ExpoBridgeModule(
|
|
|
20
20
|
fun installModules(): Boolean {
|
|
21
21
|
// Bridgeless ReactHostImpl may have BridgelessReactContext ready but not ReactInstance.
|
|
22
22
|
// Try to busy wait until ReactInstance is available so we could get the javaScriptContextHolder.
|
|
23
|
-
tryWaitSync(waitMs = 100, retries = 10) {
|
|
23
|
+
val ready = tryWaitSync(waitMs = 100, retries = 10) {
|
|
24
24
|
reactApplicationContext.hasActiveReactInstance()
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
if (!ready) {
|
|
28
|
+
// Don't fall through silently: without an active ReactInstance, installJSIInterop()
|
|
29
|
+
// below installs nothing into the runtime and this method still returns true, so the
|
|
30
|
+
// first visible symptom is JS reading `globalThis.expo` as undefined ("Cannot read
|
|
31
|
+
// property 'EventEmitter' of undefined") - far from the cause.
|
|
32
|
+
logger.warn(
|
|
33
|
+
"hasActiveReactInstance() is still false after waiting; installing JSI interop anyway. " +
|
|
34
|
+
"globalThis.expo will most likely be missing in the JS runtime."
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
val kotlinInterop = nativeModulesProxy.get()?.kotlinInteropModuleRegistry
|
|
27
39
|
?: throw IllegalStateException("Couldn't find KotlinInteropModuleRegistry")
|
|
28
40
|
|
|
@@ -30,12 +42,16 @@ class ExpoBridgeModule(
|
|
|
30
42
|
return true
|
|
31
43
|
}
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether the predicate became true within the given budget.
|
|
47
|
+
*/
|
|
48
|
+
private fun tryWaitSync(waitMs: Long, retries: Int, predicate: () -> Boolean): Boolean {
|
|
49
|
+
repeat(retries) {
|
|
35
50
|
if (predicate()) {
|
|
36
|
-
return
|
|
51
|
+
return true
|
|
37
52
|
}
|
|
38
53
|
Thread.sleep(waitMs)
|
|
39
54
|
}
|
|
55
|
+
return predicate()
|
|
40
56
|
}
|
|
41
57
|
}
|
package/android/src/main/java/expo/modules/kotlin/defaultmodules/NativeModulesProxyModule.kt
CHANGED
|
@@ -9,13 +9,17 @@ import expo.modules.kotlin.toBridgePromise
|
|
|
9
9
|
|
|
10
10
|
internal const val NativeModulesProxyModuleName = "NativeModulesProxy"
|
|
11
11
|
|
|
12
|
+
private val legacyConstantKeys = listOf("modulesConstants", "exportedMethods", "viewManagersMetadata")
|
|
13
|
+
|
|
12
14
|
class NativeModulesProxyModule : Module() {
|
|
13
15
|
override fun definition() = ModuleDefinition {
|
|
14
16
|
Name(NativeModulesProxyModuleName)
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// The legacy proxy isn't attached yet when this definition is built, so read it lazily.
|
|
19
|
+
// Reading its constants is also what emits `OnCreate` to all modules.
|
|
20
|
+
legacyConstantKeys.forEach { key ->
|
|
21
|
+
Constant(key) {
|
|
22
|
+
appContext.legacyModulesProxyHolder?.get()?.constants?.get(key)
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package expo.modules.kotlin.views
|
|
2
2
|
|
|
3
3
|
import android.view.ViewTreeObserver
|
|
4
|
+
import androidx.annotation.UiThread
|
|
4
5
|
import expo.modules.kotlin.jni.fabric.NativeStatePropsGetter
|
|
6
|
+
import kotlinx.coroutines.launch
|
|
5
7
|
import java.lang.ref.WeakReference
|
|
6
8
|
|
|
7
9
|
class ShadowNodeProxy(expoView: ExpoView) {
|
|
@@ -10,18 +12,24 @@ class ShadowNodeProxy(expoView: ExpoView) {
|
|
|
10
12
|
|
|
11
13
|
private var pendingFlush: ((stateWrapper: Any) -> Unit)? = null
|
|
12
14
|
private var preDrawListener: ViewTreeObserver.OnPreDrawListener? = null
|
|
13
|
-
private
|
|
15
|
+
private var flushPosted = false
|
|
16
|
+
private val flushRunnable = Runnable {
|
|
17
|
+
flushPosted = false
|
|
18
|
+
drainPendingFlush()
|
|
19
|
+
}
|
|
14
20
|
|
|
15
21
|
// Schedule in predraw listener to avoid early return in re-entrancy
|
|
16
22
|
// We have a proper fix [here](https://github.com/facebook/react-native/pull/56311)
|
|
17
23
|
// but it needs to be merged in RN
|
|
18
24
|
// TODO: Remove the workaround when RN PR gets merged.
|
|
25
|
+
@UiThread
|
|
19
26
|
fun setViewSize(width: Double, height: Double) {
|
|
20
27
|
scheduleFlush { stateWrapper ->
|
|
21
28
|
stateUpdater.updateViewSizeImmediate(stateWrapper, width, height)
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
|
|
32
|
+
@UiThread
|
|
25
33
|
fun setStyleSize(width: Double?, height: Double?) {
|
|
26
34
|
scheduleFlush { stateWrapper ->
|
|
27
35
|
stateUpdater.updateStyleSizeImmediate(stateWrapper, width ?: Double.NaN, height ?: Double.NaN)
|
|
@@ -68,8 +76,18 @@ class ShadowNodeProxy(expoView: ExpoView) {
|
|
|
68
76
|
|
|
69
77
|
// Predraw listener do not get called for each keyboard transition event so we add a fallback flush to be called here
|
|
70
78
|
// https://github.com/expo/expo/issues/47778
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
// Async and posted once, so it still runs during animations.
|
|
80
|
+
// `Dispatchers.Main` posts async messages, which skip the traversal sync barriers.
|
|
81
|
+
// https://github.com/expo/expo/issues/51034
|
|
82
|
+
if (!flushPosted) {
|
|
83
|
+
flushPosted = true
|
|
84
|
+
if (view.isAttachedToWindow) {
|
|
85
|
+
view.appContext.mainQueue.launch { flushRunnable.run() }
|
|
86
|
+
} else {
|
|
87
|
+
// `view.post` keeps the runnable until the view attaches.
|
|
88
|
+
view.post(flushRunnable)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
73
91
|
}
|
|
74
92
|
|
|
75
93
|
private fun drainPendingFlush() {
|
|
@@ -92,7 +92,7 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
92
92
|
|
|
93
93
|
public typealias UIRuntimeFactory = (
|
|
94
94
|
_ appContext: AppContext,
|
|
95
|
-
_ pointerValue: JavaScriptValue,
|
|
95
|
+
_ pointerValue: borrowing JavaScriptValue,
|
|
96
96
|
_ runtime: JavaScriptRuntime
|
|
97
97
|
) throws -> JavaScriptRuntime
|
|
98
98
|
|
|
@@ -495,6 +495,9 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
495
495
|
|
|
496
496
|
try coreModuleHolder.definition.decorate(object: coreObject, appContext: self)
|
|
497
497
|
|
|
498
|
+
// Bind the `@JS` members of the core module, such as `installOnUIRuntime`.
|
|
499
|
+
try coreModule._decorateModule(object: coreObject, in: runtime)
|
|
500
|
+
|
|
498
501
|
// Install `global.expo.EventEmitter`.
|
|
499
502
|
installer.installEventEmitterClass()
|
|
500
503
|
|
|
@@ -561,8 +564,8 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
561
564
|
let sharedObjectClass = try coreObject.getPropertyAsObject("SharedObject")
|
|
562
565
|
let sharedObjectBaseProto = sharedObjectClass.getProperty("prototype")
|
|
563
566
|
|
|
564
|
-
//
|
|
565
|
-
//
|
|
567
|
+
// Prototypes are cached behind `JavaScriptRef` because `JavaScriptObject` is ~Copyable and
|
|
568
|
+
// cannot be a Dictionary value.
|
|
566
569
|
let prototypeCache = WorkletPrototypeCache()
|
|
567
570
|
|
|
568
571
|
// Called by the worklet serializer's `unpack` to recreate a SharedObject proxy.
|
|
@@ -580,8 +583,10 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
580
583
|
let typeId = ObjectIdentifier(type(of: nativeObject))
|
|
581
584
|
let instance: JavaScriptObject
|
|
582
585
|
|
|
583
|
-
if let
|
|
584
|
-
|
|
586
|
+
if let cachedInstance = prototypeCache.store[typeId]?.withUnwrappedValue({ (prototype: borrowing JavaScriptObject) in
|
|
587
|
+
runtime.createObject(prototype: prototype)
|
|
588
|
+
}) {
|
|
589
|
+
instance = cachedInstance
|
|
585
590
|
} else {
|
|
586
591
|
guard let classDefinition = self.findClassDefinition(for: typeId) else {
|
|
587
592
|
throw SharedObjectClassNotRegisteredException(String(describing: type(of: nativeObject)))
|
|
@@ -591,8 +596,8 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
591
596
|
appContext: self,
|
|
592
597
|
basePrototype: sharedObjectBaseProto.getObject()
|
|
593
598
|
)
|
|
594
|
-
prototypeCache.store[typeId] = built.asValue()
|
|
595
599
|
instance = runtime.createObject(prototype: built)
|
|
600
|
+
prototypeCache.store[typeId] = built.ref()
|
|
596
601
|
}
|
|
597
602
|
|
|
598
603
|
instance.defineProperty(sharedObjectIdPropertyName, value: objectId, options: [])
|
|
@@ -640,9 +645,7 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
640
645
|
public static func from(runtime: borrowing JavaScriptRuntime) -> AppContext? {
|
|
641
646
|
// Recovery may happen on every conversion, so look the core object up through a cached
|
|
642
647
|
// prop name id to avoid re-interning the "expo" string into JSI on each call.
|
|
643
|
-
|
|
644
|
-
// taking it owned — it only reads the runtime, so the owned convention forces a needless retain.
|
|
645
|
-
let coreObjectPropName = JavaScriptPropNameID.cached(copy runtime, globalCoreObjectPropertyName)
|
|
648
|
+
let coreObjectPropName = JavaScriptPropNameID.cached(runtime, globalCoreObjectPropertyName)
|
|
646
649
|
guard let coreObject = try? runtime.global().getPropertyAsObject(coreObjectPropName) else {
|
|
647
650
|
return nil
|
|
648
651
|
}
|
|
@@ -820,12 +823,12 @@ public class AppContext: NSObject, EXAppContextProtocol, @unchecked Sendable {
|
|
|
820
823
|
|
|
821
824
|
/**
|
|
822
825
|
Reference-type store for cached worklet prototypes. Needed because JavaScriptObject
|
|
823
|
-
is ~Copyable and cannot be stored in a Dictionary; we cache
|
|
824
|
-
|
|
826
|
+
is ~Copyable and cannot be stored in a Dictionary; we cache the prototype as a
|
|
827
|
+
`JavaScriptValue.Ref` and rehydrate a JavaScriptObject on use.
|
|
825
828
|
*/
|
|
826
829
|
@JavaScriptActor
|
|
827
830
|
private final class WorkletPrototypeCache {
|
|
828
|
-
var store: [ObjectIdentifier:
|
|
831
|
+
var store: [ObjectIdentifier: JavaScriptObject.Ref] = [:]
|
|
829
832
|
}
|
|
830
833
|
|
|
831
834
|
// MARK: - Public exceptions
|
|
@@ -157,6 +157,7 @@ public final class ArrayBuffer: AnyArrayBuffer, Sendable {
|
|
|
157
157
|
// MARK: - JavaScript conversion
|
|
158
158
|
|
|
159
159
|
/// Converts a JavaScript ArrayBuffer or TypedArray to Expo's safe native ArrayBuffer representation.
|
|
160
|
+
@JavaScriptActor
|
|
160
161
|
@usableFromInline
|
|
161
162
|
internal static func from(value: borrowing JavaScriptValue) throws -> ArrayBuffer {
|
|
162
163
|
guard value.isObject() else {
|
|
@@ -166,6 +167,7 @@ public final class ArrayBuffer: AnyArrayBuffer, Sendable {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
/// Converts a borrowed JavaScript ArrayBuffer or TypedArray without materializing an owning JavaScriptValue.
|
|
170
|
+
@JavaScriptActor
|
|
169
171
|
@usableFromInline
|
|
170
172
|
internal static func from(
|
|
171
173
|
unownedValue: borrowing JavaScriptUnownedValue,
|
|
@@ -177,6 +179,7 @@ public final class ArrayBuffer: AnyArrayBuffer, Sendable {
|
|
|
177
179
|
return try ArrayBuffer.from(jsObject: unownedValue.getObject(in: runtime))
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
@JavaScriptActor
|
|
180
183
|
private static func from(jsObject: consuming JavaScriptObject) throws -> ArrayBuffer {
|
|
181
184
|
if jsObject.isArrayBuffer() {
|
|
182
185
|
return ArrayBuffer.from(jsArrayBuffer: jsObject.getArrayBuffer())
|
|
@@ -256,7 +259,7 @@ extension ArrayBuffer: JavaScriptDecodable, JavaScriptEncodable {
|
|
|
256
259
|
_ value: ArrayBuffer,
|
|
257
260
|
in runtime: borrowing JavaScriptRuntime
|
|
258
261
|
) throws -> JavaScriptValue {
|
|
259
|
-
return value.asJavaScriptArrayBuffer(runtime:
|
|
262
|
+
return value.asJavaScriptArrayBuffer(runtime: runtime).asValue()
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
265
|
|
|
@@ -70,6 +70,11 @@ public final class ClassDefinition: ObjectDefinition {
|
|
|
70
70
|
if let sharedObject = result as? SharedObject {
|
|
71
71
|
appContext.sharedObjectRegistry.add(native: sharedObject, javaScript: this.getObject())
|
|
72
72
|
}
|
|
73
|
+
} else if sharedObjectType != nil {
|
|
74
|
+
// Nothing built a native instance, so the object would reach JavaScript with no backing
|
|
75
|
+
// state and fail at its first member access. Classes whose inputs only the native side can
|
|
76
|
+
// supply land here: they need a `@JS init` or a DSL `Constructor` to be constructible.
|
|
77
|
+
throw Exceptions.ConstructorUnavailable(name)
|
|
73
78
|
}
|
|
74
79
|
return this
|
|
75
80
|
}
|
|
@@ -152,7 +157,7 @@ extension JavaScriptObject: ClassAssociatedObject, AnyArgument {
|
|
|
152
157
|
return DynamicJavaScriptType.shared
|
|
153
158
|
}
|
|
154
159
|
|
|
155
|
-
public static func convert(from value: JavaScriptValue, appContext: AppContext) throws -> Self {
|
|
160
|
+
public static func convert(from value: borrowing JavaScriptValue, appContext: AppContext) throws -> Self {
|
|
156
161
|
guard value.kind == .object else {
|
|
157
162
|
throw Conversions.UnexpectedValueType((received: value.kind, expected: .object))
|
|
158
163
|
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
import ExpoModulesJSI
|
|
4
4
|
|
|
5
5
|
internal final class ClassRegistry {
|
|
6
|
-
|
|
6
|
+
// Classes are kept behind `JavaScriptRef` because `JavaScriptObject` is ~Copyable and cannot be a
|
|
7
|
+
// Dictionary value.
|
|
8
|
+
var nativeToJS = [ObjectIdentifier: JavaScriptValue.Ref]()
|
|
7
9
|
|
|
8
10
|
// MARK: - Accessing
|
|
9
11
|
|
|
10
12
|
func getJavaScriptClass(nativeClassId: ObjectIdentifier) -> JavaScriptObject? {
|
|
11
|
-
return nativeToJS[nativeClassId]?.getObject()
|
|
13
|
+
return nativeToJS[nativeClassId]?.withUnwrappedValue { (value: borrowing JavaScriptValue) in value.getObject() }
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
func getJavaScriptClass(nativeClass: SharedObject.Type) -> JavaScriptObject? {
|
|
@@ -19,7 +21,7 @@ internal final class ClassRegistry {
|
|
|
19
21
|
// MARK: - Registration
|
|
20
22
|
|
|
21
23
|
func register(nativeClassId: ObjectIdentifier, javaScriptClass: borrowing JavaScriptObject) {
|
|
22
|
-
nativeToJS[nativeClassId] = javaScriptClass.
|
|
24
|
+
nativeToJS[nativeClassId] = javaScriptClass.refToValue()
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
func register(nativeClass: SharedObject.Type, javaScriptClass: borrowing JavaScriptObject) {
|
|
@@ -163,7 +163,7 @@ public struct Conversions {
|
|
|
163
163
|
*/
|
|
164
164
|
static func anyToJavaScriptValue<ValueType>(_ value: ValueType, appContext: AppContext, in runtime: JavaScriptRuntime) throws -> JavaScriptValue {
|
|
165
165
|
if ValueType.self is AnyOptional.Type, Optional.isNil(value) {
|
|
166
|
-
return .null
|
|
166
|
+
return .null()
|
|
167
167
|
}
|
|
168
168
|
if let value = value as? AnyArgument {
|
|
169
169
|
return try type(of: value).getDynamicType().castToJS(value, appContext: appContext, in: runtime)
|
|
@@ -185,15 +185,18 @@ public struct Conversions {
|
|
|
185
185
|
path so produced dicts/arrays live in the calling runtime, not the main runtime.
|
|
186
186
|
*/
|
|
187
187
|
static func unknownToJavaScriptValue(_ value: Any, appContext: AppContext, in runtime: JavaScriptRuntime) throws -> JavaScriptValue {
|
|
188
|
+
if let converted = value as? ConvertedJavaScriptValue {
|
|
189
|
+
return converted.takeValue()
|
|
190
|
+
}
|
|
188
191
|
if let value = value as? JavaScriptRepresentable {
|
|
189
192
|
return .representing(value: value, in: runtime)
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
switch value {
|
|
193
196
|
case is Void:
|
|
194
|
-
return .undefined
|
|
197
|
+
return .undefined()
|
|
195
198
|
case is NSNull:
|
|
196
|
-
return .null
|
|
199
|
+
return .null()
|
|
197
200
|
case let number as NSNumber:
|
|
198
201
|
if number === kCFBooleanTrue {
|
|
199
202
|
return .true()
|
|
@@ -221,7 +224,7 @@ public struct Conversions {
|
|
|
221
224
|
return jsObject.asValue()
|
|
222
225
|
default:
|
|
223
226
|
log.warn("unknownToJavaScriptValue: unsupported native type '\(type(of: value))', returning undefined")
|
|
224
|
-
return .undefined
|
|
227
|
+
return .undefined()
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
|
|
@@ -236,7 +239,7 @@ public struct Conversions {
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
let uint8ArrayCtor = try runtime.global().getPropertyAsFunction("Uint8Array")
|
|
239
|
-
return try uint8ArrayCtor.callAsConstructor(arrayBuffer.asValue())
|
|
242
|
+
return try uint8ArrayCtor.callAsConstructor(arrayBuffer.asValue().ref())
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
// MARK: - Exceptions
|
|
@@ -349,3 +352,38 @@ public struct Conversions {
|
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
A JavaScript value carried through `Any` inside the conversion pipeline, between a dynamic type's
|
|
358
|
+
`convertResult` and its `castToJS` (for example a record field that is already a JS object). It is
|
|
359
|
+
needed because `JavaScriptValue` is non-copyable and cannot be boxed in `Any` itself. Internal to the
|
|
360
|
+
pipeline: the module API never hands it to user code.
|
|
361
|
+
*/
|
|
362
|
+
internal final class ConvertedJavaScriptValue: @unchecked Sendable {
|
|
363
|
+
/**
|
|
364
|
+
The shared box for `undefined`. It holds no value and `takeValue()` creates a fresh `undefined`
|
|
365
|
+
each time, so one instance serves every use without an allocation.
|
|
366
|
+
*/
|
|
367
|
+
static let undefined = ConvertedJavaScriptValue()
|
|
368
|
+
|
|
369
|
+
private let ref: JavaScriptValue.Ref?
|
|
370
|
+
|
|
371
|
+
init(_ value: consuming JavaScriptValue) {
|
|
372
|
+
self.ref = value.ref()
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
private init() {
|
|
376
|
+
self.ref = nil
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
Moves the value out of the box, so the pipeline reads it without cloning the engine value. A box is
|
|
381
|
+
read once, where the converted value becomes a JS value; a later read yields `undefined`.
|
|
382
|
+
*/
|
|
383
|
+
func takeValue() -> JavaScriptValue {
|
|
384
|
+
guard let ref else {
|
|
385
|
+
return .undefined()
|
|
386
|
+
}
|
|
387
|
+
return ref.take() ?? .undefined()
|
|
388
|
+
}
|
|
389
|
+
}
|
|
@@ -24,7 +24,7 @@ public protocol AnyDynamicType: CustomStringConvertible, Sendable {
|
|
|
24
24
|
It **must** be run on the thread used by the JavaScript runtime.
|
|
25
25
|
*/
|
|
26
26
|
@JavaScriptActor
|
|
27
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any
|
|
27
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
Casts the given Swift-side value to the wrapped type and returns it as `Any`.
|
|
@@ -17,7 +17,7 @@ internal struct DynamicArrayBufferType: AnyDynamicType {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/// Converts JS array buffer to its native representation.
|
|
20
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
20
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
21
21
|
do {
|
|
22
22
|
return try ArrayBuffer.from(value: jsValue)
|
|
23
23
|
} catch is ArrayBufferJavaScriptValueConversionException {
|
|
@@ -23,7 +23,7 @@ internal struct DynamicArrayType: AnyDynamicType {
|
|
|
23
23
|
return false
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
26
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
27
27
|
if jsValue.isArray() {
|
|
28
28
|
return try jsValue.getArray().map { value in
|
|
29
29
|
return try elementType.cast(jsValue: value, appContext: appContext)
|
|
@@ -52,7 +52,7 @@ internal struct DynamicArrayType: AnyDynamicType {
|
|
|
52
52
|
/**
|
|
53
53
|
Type-aware conversion for arrays that were already normalized by `convertResult`.
|
|
54
54
|
Elements must use `castToJS` here to avoid re-entering `convertResult` for values that
|
|
55
|
-
are already in their post-conversion shape, such as `JavaScriptValue.undefined`.
|
|
55
|
+
are already in their post-conversion shape, such as `JavaScriptValue.undefined()`.
|
|
56
56
|
*/
|
|
57
57
|
func castToJS<ValueType>(_ value: ValueType, appContext: AppContext) throws -> JavaScriptValue {
|
|
58
58
|
return try castToJS(value, appContext: appContext, in: try appContext.runtime)
|
|
@@ -28,7 +28,7 @@ internal struct DynamicBoolType: AnyDynamicType {
|
|
|
28
28
|
throw Conversions.CastingException<Bool>(value)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
31
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
32
32
|
if jsValue.kind == .bool {
|
|
33
33
|
return jsValue.getBool()
|
|
34
34
|
}
|
|
@@ -17,11 +17,11 @@ internal struct DynamicCodableType<InnerType>: AnyDynamicType {
|
|
|
17
17
|
return type is Self
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
20
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
21
21
|
guard let DecodableType = InnerType.self as? Decodable.Type else {
|
|
22
22
|
throw Conversions.CastingJSValueException<InnerType>(jsValue.kind)
|
|
23
23
|
}
|
|
24
|
-
let decoder = try JSValueDecoder(value: jsValue, appContext: appContext)
|
|
24
|
+
let decoder = try JSValueDecoder(value: jsValue.copy(), appContext: appContext)
|
|
25
25
|
return try DecodableType.init(from: decoder)
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -37,8 +37,8 @@ internal struct DynamicCodableType<InnerType>: AnyDynamicType {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
func castToJS<ValueType>(_ value: ValueType, appContext: AppContext, in runtime: JavaScriptRuntime) throws -> JavaScriptValue {
|
|
40
|
-
if let
|
|
41
|
-
return
|
|
40
|
+
if let converted = value as? ConvertedJavaScriptValue {
|
|
41
|
+
return converted.takeValue()
|
|
42
42
|
}
|
|
43
43
|
if let value = value as? Encodable {
|
|
44
44
|
let encoder = JSValueEncoder(appContext: appContext, runtime: runtime)
|
|
@@ -50,7 +50,7 @@ internal struct DynamicCodableType<InnerType>: AnyDynamicType {
|
|
|
50
50
|
|
|
51
51
|
func convertResult<ResultType>(_ result: ResultType, appContext: AppContext) throws -> Any {
|
|
52
52
|
// TODO: We should get rid of this function, but it seems it's still used in some places
|
|
53
|
-
return try castToJS(result, appContext: appContext)
|
|
53
|
+
return ConvertedJavaScriptValue(try castToJS(result, appContext: appContext))
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
var description: String {
|
|
@@ -20,7 +20,7 @@ internal struct DynamicConvertibleType: AnyDynamicType {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@JavaScriptActor
|
|
23
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
23
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
24
24
|
// `from(object:)` dispatches dynamically: reflection-based hydration for `@Field` records,
|
|
25
25
|
// a direct statically-typed factory for `@Record`-synthesized ones.
|
|
26
26
|
if let recordType = innerType as? any Record.Type {
|
|
@@ -37,9 +37,6 @@ internal struct DynamicConvertibleType: AnyDynamicType {
|
|
|
37
37
|
if let directJSValue = try directJSValueIfPossible(value, appContext: appContext) {
|
|
38
38
|
return directJSValue
|
|
39
39
|
}
|
|
40
|
-
if let jsValue = value as? JavaScriptValue {
|
|
41
|
-
return jsValue
|
|
42
|
-
}
|
|
43
40
|
if value is AnyArgument {
|
|
44
41
|
return try convertOriginalValueToJS(value, appContext: appContext)
|
|
45
42
|
}
|
|
@@ -97,9 +94,6 @@ internal struct DynamicConvertibleType: AnyDynamicType {
|
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
private func serializeConvertedValue(_ value: Any, appContext: AppContext) throws -> JavaScriptValue {
|
|
100
|
-
if let result = value as? JavaScriptValue {
|
|
101
|
-
return result
|
|
102
|
-
}
|
|
103
97
|
if let result = value as? AnyArgument {
|
|
104
98
|
let dynamicType = type(of: result).getDynamicType()
|
|
105
99
|
// A `Convertible` that keeps the default `convertResult` returns the value unchanged,
|
|
@@ -19,7 +19,7 @@ internal struct DynamicDataType: AnyDynamicType {
|
|
|
19
19
|
/**
|
|
20
20
|
Converts JS typed array to its native representation.
|
|
21
21
|
*/
|
|
22
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
22
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
23
23
|
guard jsValue.isTypedArray() else {
|
|
24
24
|
throw Conversions.CastingJSValueException<Uint8Array>(jsValue.kind)
|
|
25
25
|
}
|