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
|
@@ -23,7 +23,7 @@ internal final class JSValueEncoder: Encoder {
|
|
|
23
23
|
The result of encoding to `JavaScriptValue`. Use this property after running `encode(to:)` on the encodable.
|
|
24
24
|
*/
|
|
25
25
|
var value: JavaScriptValue {
|
|
26
|
-
return valueHolder.
|
|
26
|
+
return valueHolder.take()
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -120,7 +120,7 @@ private func encodeUsingDynamicType<ValueType: Encodable>(
|
|
|
120
120
|
valueHolder: holder
|
|
121
121
|
)
|
|
122
122
|
try value.encode(to: encoder)
|
|
123
|
-
return holder.
|
|
123
|
+
return holder.take()
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// MARK: - Containers
|
|
@@ -129,7 +129,14 @@ private func encodeUsingDynamicType<ValueType: Encodable>(
|
|
|
129
129
|
An object that holds a JS value, mutated by an encoding container as it makes progress.
|
|
130
130
|
*/
|
|
131
131
|
private final class JSValueHolder {
|
|
132
|
-
|
|
132
|
+
// Optional so the value can be moved out: a non-copyable stored property of a class cannot be
|
|
133
|
+
// consumed, but `Optional.take()` can run on it.
|
|
134
|
+
var value: JavaScriptValue?
|
|
135
|
+
|
|
136
|
+
/// Moves the encoded value out, leaving the holder empty. An empty holder yields `undefined`.
|
|
137
|
+
func take() -> JavaScriptValue {
|
|
138
|
+
return value.take() ?? .undefined()
|
|
139
|
+
}
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
/**
|
|
@@ -149,7 +156,7 @@ private struct JSValueEncodingContainer: SingleValueEncodingContainer {
|
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
mutating func encodeNil() throws {
|
|
152
|
-
valueHolder.value = .null
|
|
159
|
+
valueHolder.value = .null()
|
|
153
160
|
}
|
|
154
161
|
|
|
155
162
|
mutating func encode<ValueType: Encodable>(_ value: ValueType) throws {
|
|
@@ -190,7 +197,7 @@ private final class JSObjectEncodingContainer<Key: CodingKey>: KeyedEncodingCont
|
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
func encodeNil(forKey key: Key) throws {
|
|
193
|
-
object.setProperty(key.stringValue, value: JavaScriptValue.null)
|
|
200
|
+
object.setProperty(key.stringValue, value: JavaScriptValue.null())
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
func encode<ValueType: Encodable>(_ value: ValueType, forKey key: Key) throws {
|
|
@@ -247,7 +254,7 @@ private final class JSObjectEncodingContainer<Key: CodingKey>: KeyedEncodingCont
|
|
|
247
254
|
runtime: runtime,
|
|
248
255
|
codingPath: codingPath + [key]
|
|
249
256
|
)
|
|
250
|
-
object.setProperty(key.stringValue, value: holder.
|
|
257
|
+
object.setProperty(key.stringValue, value: holder.take())
|
|
251
258
|
return KeyedEncodingContainer(container)
|
|
252
259
|
}
|
|
253
260
|
|
|
@@ -259,7 +266,7 @@ private final class JSObjectEncodingContainer<Key: CodingKey>: KeyedEncodingCont
|
|
|
259
266
|
runtime: runtime,
|
|
260
267
|
codingPath: codingPath + [key]
|
|
261
268
|
)
|
|
262
|
-
object.setProperty(key.stringValue, value: holder.
|
|
269
|
+
object.setProperty(key.stringValue, value: holder.take())
|
|
263
270
|
return container
|
|
264
271
|
}
|
|
265
272
|
|
|
@@ -299,7 +306,7 @@ private final class JSArrayEncodingContainer: UnkeyedEncodingContainer {
|
|
|
299
306
|
}
|
|
300
307
|
|
|
301
308
|
func encodeNil() throws {
|
|
302
|
-
array[count] = JavaScriptValue.null
|
|
309
|
+
array[count] = JavaScriptValue.null()
|
|
303
310
|
count += 1
|
|
304
311
|
}
|
|
305
312
|
|
|
@@ -322,7 +329,7 @@ private final class JSArrayEncodingContainer: UnkeyedEncodingContainer {
|
|
|
322
329
|
runtime: runtime,
|
|
323
330
|
codingPath: codingPath + [AnyCodingKey(intValue: count)]
|
|
324
331
|
)
|
|
325
|
-
array[count] = holder.
|
|
332
|
+
array[count] = holder.take()
|
|
326
333
|
count += 1
|
|
327
334
|
return KeyedEncodingContainer(container)
|
|
328
335
|
}
|
|
@@ -335,7 +342,7 @@ private final class JSArrayEncodingContainer: UnkeyedEncodingContainer {
|
|
|
335
342
|
runtime: runtime,
|
|
336
343
|
codingPath: codingPath + [AnyCodingKey(intValue: count)]
|
|
337
344
|
)
|
|
338
|
-
array[count] = holder.
|
|
345
|
+
array[count] = holder.take()
|
|
339
346
|
count += 1
|
|
340
347
|
return container
|
|
341
348
|
}
|
|
@@ -14,7 +14,7 @@ public struct MainValueConverter: ~Copyable {
|
|
|
14
14
|
It **must** be run on the thread used by the JavaScript runtime.
|
|
15
15
|
*/
|
|
16
16
|
@JavaScriptActor
|
|
17
|
-
public func toNative(_ value: JavaScriptValue, _ type: AnyDynamicType) throws -> Any {
|
|
17
|
+
public func toNative(_ value: borrowing JavaScriptValue, _ type: AnyDynamicType) throws -> Any {
|
|
18
18
|
return try type.cast(jsValue: value, appContext: appContext)
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -186,18 +186,18 @@ public final class ModuleHolder {
|
|
|
186
186
|
let startListening = runtime.createFunction("__expo_onStartListeningToEvent") {
|
|
187
187
|
[weak module = self.module] _, arguments in
|
|
188
188
|
guard let module, arguments.count > 0 else {
|
|
189
|
-
return .undefined
|
|
189
|
+
return .undefined()
|
|
190
190
|
}
|
|
191
191
|
module.didStartListening(event: try arguments[0].asString())
|
|
192
|
-
return .undefined
|
|
192
|
+
return .undefined()
|
|
193
193
|
}
|
|
194
194
|
let stopListening = runtime.createFunction("__expo_onStopListeningToEvent") {
|
|
195
195
|
[weak module = self.module] _, arguments in
|
|
196
196
|
guard let module, arguments.count > 0 else {
|
|
197
|
-
return .undefined
|
|
197
|
+
return .undefined()
|
|
198
198
|
}
|
|
199
199
|
module.didStopListening(event: try arguments[0].asString())
|
|
200
|
-
return .undefined
|
|
200
|
+
return .undefined()
|
|
201
201
|
}
|
|
202
202
|
object.defineProperty("__expo_onStartListeningToEvent", value: startListening.asValue(), options: [])
|
|
203
203
|
object.defineProperty("__expo_onStopListeningToEvent", value: stopListening.asValue(), options: [])
|
|
@@ -5,6 +5,7 @@ import Foundation
|
|
|
5
5
|
import ExpoModulesJSI
|
|
6
6
|
|
|
7
7
|
// The core module that describes the `global.expo` object.
|
|
8
|
+
@ExpoModule
|
|
8
9
|
internal final class CoreModule: Module {
|
|
9
10
|
internal func definition() -> ModuleDefinition {
|
|
10
11
|
Constant("expoModulesCoreVersion") {
|
|
@@ -31,53 +32,6 @@ internal final class CoreModule: Module {
|
|
|
31
32
|
false
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
Function("installOnUIRuntime") { (uiRuntimeHolder: JavaScriptValue) in
|
|
35
|
-
guard let appContext else {
|
|
36
|
-
throw Exceptions.AppContextLost()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Check if was already installed
|
|
40
|
-
if appContext._uiRuntime != nil {
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let runtime = try appContext.runtime
|
|
45
|
-
guard uiRuntimeHolder.isObject() else {
|
|
46
|
-
throw WorkletUIRuntimeException()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
guard let factory = AppContext.uiRuntimeFactory else {
|
|
50
|
-
throw WorkletUIRuntimeException()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Use a Sendable box to safely capture error across isolation boundaries
|
|
54
|
-
final class ErrorHolder: @unchecked Sendable {
|
|
55
|
-
var error: (any Error)?
|
|
56
|
-
}
|
|
57
|
-
let errorHolder = ErrorHolder()
|
|
58
|
-
|
|
59
|
-
let block = {
|
|
60
|
-
do {
|
|
61
|
-
let uiRuntime = try factory(appContext, uiRuntimeHolder, runtime)
|
|
62
|
-
appContext._uiRuntime = uiRuntime
|
|
63
|
-
} catch {
|
|
64
|
-
errorHolder.error = error
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if Thread.isMainThread {
|
|
69
|
-
block()
|
|
70
|
-
} else {
|
|
71
|
-
DispatchQueue.main.sync {
|
|
72
|
-
block()
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if let error = errorHolder.error {
|
|
77
|
-
throw error
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
35
|
// Expose some common classes and maybe even the `modules` host object in the future.
|
|
82
36
|
Function("uuidv4") { () -> String in
|
|
83
37
|
return UUID().uuidString.lowercased()
|
|
@@ -130,6 +84,42 @@ internal final class CoreModule: Module {
|
|
|
130
84
|
|
|
131
85
|
return viewName
|
|
132
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
Installs the worklet UI runtime from the holder object that the worklets JS code passes to
|
|
90
|
+
`global.expo.installOnUIRuntime`.
|
|
91
|
+
*/
|
|
92
|
+
@JS
|
|
93
|
+
nonisolated internal func installOnUIRuntime(_ uiRuntimeHolder: borrowing JavaScriptValue) throws {
|
|
94
|
+
guard let appContext else {
|
|
95
|
+
throw Exceptions.AppContextLost()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Check if was already installed
|
|
99
|
+
if appContext._uiRuntime != nil {
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let runtime = try appContext.runtime
|
|
104
|
+
guard uiRuntimeHolder.isObject() else {
|
|
105
|
+
throw WorkletUIRuntimeException()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
guard let factory = AppContext.uiRuntimeFactory else {
|
|
109
|
+
throw WorkletUIRuntimeException()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// The runtime is created and stored on the main thread: setting `_uiRuntime` prepares it there.
|
|
113
|
+
// `DispatchQueue.main.sync` doesn't escape its closure and rethrows, so the closure can borrow the
|
|
114
|
+
// holder and the error reaches the caller directly.
|
|
115
|
+
if Thread.isMainThread {
|
|
116
|
+
appContext._uiRuntime = try factory(appContext, uiRuntimeHolder, runtime)
|
|
117
|
+
} else {
|
|
118
|
+
try DispatchQueue.main.sync {
|
|
119
|
+
appContext._uiRuntime = try factory(appContext, uiRuntimeHolder, runtime)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
133
123
|
}
|
|
134
124
|
|
|
135
125
|
internal final class WorkletUIRuntimeException: Exception, @unchecked Sendable {
|
|
@@ -137,4 +127,3 @@ internal final class WorkletUIRuntimeException: Exception, @unchecked Sendable {
|
|
|
137
127
|
"Cannot find UI worklet runtime"
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
|
-
|
|
@@ -76,7 +76,9 @@ public final class ConstantDefinition<ReturnType: AnyArgument>: AnyDefinition, A
|
|
|
76
76
|
*/
|
|
77
77
|
@JavaScriptActor
|
|
78
78
|
internal func buildGetter(appContext: AppContext) throws -> JavaScriptFunction {
|
|
79
|
-
|
|
79
|
+
// The converted value is cached behind a `JavaScriptRef` so the closure can keep it across calls:
|
|
80
|
+
// the ref gives the value reference semantics, which an escaping closure capture needs.
|
|
81
|
+
let savedValue = JavaScriptValue.Ref()
|
|
80
82
|
return try appContext.runtime.createFunction(name) { [weak appContext, weak self, name] _, _ in
|
|
81
83
|
guard let appContext else {
|
|
82
84
|
throw Exceptions.AppContextLost()
|
|
@@ -87,11 +89,11 @@ public final class ConstantDefinition<ReturnType: AnyArgument>: AnyDefinition, A
|
|
|
87
89
|
guard let getter = self.getter else {
|
|
88
90
|
throw NativeConstantWithoutGetterException(name)
|
|
89
91
|
}
|
|
90
|
-
if let value = savedValue {
|
|
92
|
+
if let value = savedValue.withUnwrappedValue({ (value: borrowing JavaScriptValue) in value.copy() }) {
|
|
91
93
|
return value
|
|
92
94
|
}
|
|
93
95
|
let value = try appContext.converter.toJS(try getter(), ~ReturnType.self)
|
|
94
|
-
savedValue
|
|
96
|
+
savedValue.reset(value.copy())
|
|
95
97
|
return value
|
|
96
98
|
}
|
|
97
99
|
}
|
|
@@ -146,7 +146,7 @@ public final class PropertyDefinition<OwnerType>: AnyDefinition, AnyPropertyDefi
|
|
|
146
146
|
throw NativePropertyUnavailableException(name)
|
|
147
147
|
}
|
|
148
148
|
guard let getter = self.getter else {
|
|
149
|
-
return .undefined
|
|
149
|
+
return .undefined()
|
|
150
150
|
}
|
|
151
151
|
return try getter.call(appContext, in: runtime, this: this, arguments: arguments)
|
|
152
152
|
}
|
|
@@ -165,7 +165,7 @@ public final class PropertyDefinition<OwnerType>: AnyDefinition, AnyPropertyDefi
|
|
|
165
165
|
throw NativePropertyUnavailableException(name)
|
|
166
166
|
}
|
|
167
167
|
guard let setter = self.setter else {
|
|
168
|
-
return .undefined
|
|
168
|
+
return .undefined()
|
|
169
169
|
}
|
|
170
170
|
return try setter.call(appContext, in: runtime, this: this, arguments: arguments)
|
|
171
171
|
}
|
package/ios/Core/Promise.swift
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import ExpoModulesJSI
|
|
4
4
|
|
|
5
5
|
public struct Promise: AnyArgument, Sendable {
|
|
6
|
-
public typealias ResolveClosure = @Sendable (_ value: JavaScriptValue) -> Void
|
|
6
|
+
public typealias ResolveClosure = @Sendable (_ value: consuming JavaScriptValue) -> Void
|
|
7
7
|
public typealias RejectClosure = @Sendable (Exception) -> Void
|
|
8
8
|
|
|
9
9
|
internal weak var appContext: AppContext?
|
|
@@ -27,5 +27,5 @@ internal protocol AnyFieldInternal: AnyField {
|
|
|
27
27
|
func set(_ newValue: Any?, appContext: AppContext) throws
|
|
28
28
|
|
|
29
29
|
@JavaScriptActor
|
|
30
|
-
func set(jsValue: JavaScriptValue, appContext: AppContext) throws
|
|
30
|
+
func set(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws
|
|
31
31
|
}
|
|
@@ -95,7 +95,7 @@ public final class Field<Type: AnyArgument>: AnyFieldInternal, @unchecked Sendab
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
@JavaScriptActor
|
|
98
|
-
internal func set(jsValue: JavaScriptValue, appContext: AppContext) throws {
|
|
98
|
+
internal func set(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws {
|
|
99
99
|
if jsValue.isNull() && isRequired {
|
|
100
100
|
throw FieldRequiredException(key!)
|
|
101
101
|
}
|
|
@@ -109,7 +109,7 @@ public final class Field<Type: AnyArgument>: AnyFieldInternal, @unchecked Sendab
|
|
|
109
109
|
if jsValue.isNull() {
|
|
110
110
|
throw FieldRequiredException(key!)
|
|
111
111
|
}
|
|
112
|
-
throw FieldInvalidTypeException((fieldKey: key!, value: jsValue, desiredType: Type.self)).causedBy(error)
|
|
112
|
+
throw FieldInvalidTypeException((fieldKey: key!, value: jsValue.kind, desiredType: Type.self)).causedBy(error)
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -118,7 +118,7 @@ public final class Field<Type: AnyArgument>: AnyFieldInternal, @unchecked Sendab
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
@JavaScriptActor
|
|
121
|
-
internal func castValue(jsValue: JavaScriptValue, appContext: AppContext) throws -> Type? {
|
|
121
|
+
internal func castValue(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Type? {
|
|
122
122
|
return try fieldType.cast(jsValue: jsValue, appContext: appContext) as? Type
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -230,10 +230,7 @@ internal func recordFieldValueToJSValue(
|
|
|
230
230
|
|
|
231
231
|
convertedValue = Conversions.convertFunctionResult(value, appContext: appContext)
|
|
232
232
|
if Optional.isNil(convertedValue) {
|
|
233
|
-
return .null
|
|
234
|
-
}
|
|
235
|
-
if let jsValue = convertedValue as? JavaScriptValue {
|
|
236
|
-
return jsValue
|
|
233
|
+
return .null()
|
|
237
234
|
}
|
|
238
235
|
return try Conversions.unknownToJavaScriptValue(convertedValue, appContext: appContext)
|
|
239
236
|
}
|
|
@@ -94,7 +94,7 @@ open class SharedObject: AnySharedObject {
|
|
|
94
94
|
/// Builds a native instance from the JS constructor arguments, or `nil` to use the DSL `Constructor`
|
|
95
95
|
/// path. Overridden by the `@SharedObject` macro from the class's `@JS init`.
|
|
96
96
|
@JavaScriptActor
|
|
97
|
-
open class func _constructSharedObject(this: JavaScriptValue, arguments: borrowing JavaScriptValuesBuffer, in runtime: JavaScriptRuntime) throws -> SharedObject? {
|
|
97
|
+
open class func _constructSharedObject(this: borrowing JavaScriptValue, arguments: borrowing JavaScriptValuesBuffer, in runtime: JavaScriptRuntime) throws -> SharedObject? {
|
|
98
98
|
return nil
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -20,7 +20,7 @@ internal final class SharedObjectNativeState: JavaScriptNativeState {
|
|
|
20
20
|
/// The JS object paired with the native object in each runtime, keyed by runtime identity and held
|
|
21
21
|
/// weakly. One native object can be exposed to several runtimes (e.g. the main and UI runtimes, or
|
|
22
22
|
/// worklet contexts), each with its own JS counterpart.
|
|
23
|
-
private var pairedObjects: [JavaScriptRuntime.ID:
|
|
23
|
+
private var pairedObjects: [JavaScriptRuntime.ID: JavaScriptWeakObject.Ref] = [:]
|
|
24
24
|
|
|
25
25
|
internal init(native: SharedObject, factory: @escaping JavaScriptNativeState.Factory) {
|
|
26
26
|
self.native = native
|
|
@@ -57,7 +57,7 @@ internal class ExpoRuntimeInstaller: EXJavaScriptRuntimeManager {
|
|
|
57
57
|
}
|
|
58
58
|
let modulesHostObject = runtime.createHostObject(
|
|
59
59
|
get: { [weak appContext] moduleName in
|
|
60
|
-
return appContext?.getNativeModuleObject(moduleName) ?? .undefined
|
|
60
|
+
return appContext?.getNativeModuleObject(moduleName) ?? .undefined()
|
|
61
61
|
},
|
|
62
62
|
set: { propertyName, _ in
|
|
63
63
|
throw ReadOnlyExpoModulesPropertyException(propertyName)
|
|
@@ -83,8 +83,7 @@ internal final class ReadOnlyExpoModulesPropertyException: GenericException<Stri
|
|
|
83
83
|
+ "Define or override behavior inside the native module instead."
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
var message: String { reason }
|
|
86
|
+
// `Exception.message` is the `description`, which is just `reason` here (no cause chain).
|
|
87
|
+
// Override it explicitly so the JS-facing error stays the bare `reason`.
|
|
88
|
+
override var message: String { reason }
|
|
90
89
|
}
|
|
@@ -17,7 +17,7 @@ internal struct DynamicSerializableType: AnyDynamicType {
|
|
|
17
17
|
return false
|
|
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
|
let runtime = try appContext.runtime
|
|
22
22
|
let jsSerializable: JavaScriptSerializable? = runtime.withUnsafePointee { runtimePointee in
|
|
23
23
|
return jsValue.withUnsafePointee { valuePointee in
|
|
@@ -14,7 +14,7 @@ internal struct DynamicWorkletType: AnyDynamicType {
|
|
|
14
14
|
return type is Self
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
func cast(jsValue: JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
17
|
+
func cast(jsValue: borrowing JavaScriptValue, appContext: AppContext) throws -> Any {
|
|
18
18
|
guard let serializable = try serializableDynamicType.cast(jsValue: jsValue, appContext: appContext) as? Serializable else {
|
|
19
19
|
throw NotSerializableException(Worklet.self)
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.16",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo",
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
"./package.json": "./package.json"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"expo-modules-jsi": "~58.0.
|
|
68
|
-
"expo-modules-macros": "0.
|
|
67
|
+
"expo-modules-jsi": "~58.0.11",
|
|
68
|
+
"expo-modules-macros": "0.19.1",
|
|
69
69
|
"invariant": "^2.2.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
+
"@expo/internal-scripts": "58.0.1",
|
|
72
73
|
"@testing-library/react-native": "^14.0.1",
|
|
73
74
|
"@types/invariant": "^2.2.33",
|
|
74
75
|
"@types/react": "~19.3.0",
|
|
75
76
|
"@types/react-dom": "^19.1.7",
|
|
76
|
-
"expo-module-scripts": "56.0.8",
|
|
77
77
|
"react-dom": "19.3.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|