expo-modules-core 58.0.15 → 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.
Files changed (59) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/android/build.gradle +2 -2
  3. package/android/prebuilt/metadata.json +2 -2
  4. package/android/prebuilt/native-libs.tar.xz +0 -0
  5. package/android/src/main/cpp/fabric/AndroidExpoViewComponentDescriptor.cpp +0 -18
  6. package/ios/Core/AppContext.swift +15 -12
  7. package/ios/Core/ArrayBuffers/ArrayBuffer.swift +4 -1
  8. package/ios/Core/Classes/ClassDefinition.swift +1 -1
  9. package/ios/Core/Classes/ClassRegistry.swift +5 -3
  10. package/ios/Core/Conversions.swift +43 -5
  11. package/ios/Core/DynamicTypes/AnyDynamicType.swift +1 -1
  12. package/ios/Core/DynamicTypes/DynamicArrayBufferType.swift +1 -1
  13. package/ios/Core/DynamicTypes/DynamicArrayType.swift +2 -2
  14. package/ios/Core/DynamicTypes/DynamicBoolType.swift +1 -1
  15. package/ios/Core/DynamicTypes/DynamicCodableType.swift +5 -5
  16. package/ios/Core/DynamicTypes/DynamicConvertibleType.swift +1 -7
  17. package/ios/Core/DynamicTypes/DynamicDataType.swift +1 -1
  18. package/ios/Core/DynamicTypes/DynamicDictionaryType.swift +2 -2
  19. package/ios/Core/DynamicTypes/DynamicEitherType.swift +1 -1
  20. package/ios/Core/DynamicTypes/DynamicEnumType.swift +1 -1
  21. package/ios/Core/DynamicTypes/DynamicJavaScriptType.swift +12 -6
  22. package/ios/Core/DynamicTypes/DynamicNumberType.swift +1 -1
  23. package/ios/Core/DynamicTypes/DynamicOptionalType.swift +4 -4
  24. package/ios/Core/DynamicTypes/DynamicRawType.swift +3 -3
  25. package/ios/Core/DynamicTypes/DynamicSharedObjectType.swift +2 -2
  26. package/ios/Core/DynamicTypes/DynamicStringType.swift +1 -1
  27. package/ios/Core/DynamicTypes/DynamicSwiftUIViewType.swift +2 -2
  28. package/ios/Core/DynamicTypes/DynamicTypedArrayType.swift +1 -1
  29. package/ios/Core/DynamicTypes/DynamicValueOrUndefinedType.swift +5 -5
  30. package/ios/Core/DynamicTypes/DynamicViewType.swift +2 -2
  31. package/ios/Core/DynamicTypes/DynamicVoidType.swift +2 -2
  32. package/ios/Core/Events/EventEmitter.swift +9 -3
  33. package/ios/Core/Functions/AnyFunctionDefinition.swift +1 -1
  34. package/ios/Core/Functions/AsyncFunctionDefinition.swift +2 -2
  35. package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +2 -2
  36. package/ios/Core/Functions/OptimizedAsyncFunctionDefinition.swift +1 -1
  37. package/ios/Core/Functions/OptimizedSyncFunctionDefinition.swift +3 -3
  38. package/ios/Core/Functions/SyncFunctionDefinition.swift +5 -5
  39. package/ios/Core/JSValueDecoder.swift +32 -17
  40. package/ios/Core/JSValueEncoder.swift +17 -10
  41. package/ios/Core/MainValueConverter.swift +1 -1
  42. package/ios/Core/ModuleHolder.swift +4 -4
  43. package/ios/Core/Modules/CoreModule.swift +37 -48
  44. package/ios/Core/Objects/ConstantDefinition.swift +5 -3
  45. package/ios/Core/Objects/PropertyDefinition.swift +2 -2
  46. package/ios/Core/Promise.swift +1 -1
  47. package/ios/Core/Records/AnyField.swift +1 -1
  48. package/ios/Core/Records/Field.swift +3 -3
  49. package/ios/Core/Records/Record.swift +1 -4
  50. package/ios/Core/SharedObjects/SharedObject.swift +1 -1
  51. package/ios/Core/SharedObjects/SharedObjectNativeState.swift +1 -1
  52. package/ios/JS/ExpoRuntimeInstaller.swift +1 -1
  53. package/ios/Worklets/Core/DynamicSerializableType.swift +1 -1
  54. package/ios/Worklets/Core/DynamicWorkletType.swift +1 -1
  55. package/package.json +3 -3
  56. package/prebuilds/output/debug/xcframeworks/ExpoModulesCore.tar.gz +0 -0
  57. package/prebuilds/output/debug/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
  58. package/prebuilds/output/release/xcframeworks/ExpoModulesCore.tar.gz +0 -0
  59. package/prebuilds/output/release/xcframeworks/ExpoModulesWorklets.tar.gz +0 -0
@@ -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: JavaScriptRef<JavaScriptWeakObject>] = [:]
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)
@@ -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.15",
3
+ "version": "58.0.16",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "keywords": [
6
6
  "expo",
@@ -64,8 +64,8 @@
64
64
  "./package.json": "./package.json"
65
65
  },
66
66
  "dependencies": {
67
- "expo-modules-jsi": "~58.0.10",
68
- "expo-modules-macros": "0.15.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": {