expo-modules-core 58.0.18 → 58.0.19
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 +13 -0
- package/android/build.gradle +2 -2
- package/android/prebuilt/metadata.json +1 -1
- package/android/prebuilt/native-libs.tar.xz +0 -0
- package/build/ts-declarations/global.d.ts +0 -1
- package/ios/Api/Factories/ClassFactories.swift +1 -1
- package/ios/Core/ArrayBuffers/ArrayBuffer.swift +8 -3
- package/ios/Core/Classes/ClassDefinition.swift +15 -5
- package/ios/Core/EventListener.swift +4 -0
- package/ios/Core/Events/EventEmitter.swift +1 -1
- package/ios/Core/Events/EventObservingDefinition.swift +4 -0
- package/ios/Core/Functions/AsyncFunctionDefinition.swift +4 -0
- package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +4 -0
- package/ios/Core/Functions/OptimizedAsyncFunctionDefinition.swift +4 -0
- package/ios/Core/Functions/OptimizedSyncFunctionDefinition.swift +4 -0
- package/ios/Core/Functions/StaticFunctionDefinition.swift +12 -16
- package/ios/Core/Functions/SyncFunctionDefinition.swift +4 -0
- package/ios/Core/Modules/ModuleDefinition.swift +43 -16
- package/ios/Core/Objects/ConstantDefinition.swift +4 -0
- package/ios/Core/Objects/ObjectDefinition.swift +35 -31
- package/ios/Core/Objects/PropertyDefinition.swift +4 -0
- package/ios/Core/Protocols/AnyDefinition.swift +43 -1
- package/ios/Core/Protocols/AnyModule.swift +1 -1
- package/ios/Core/TypeName.swift +12 -0
- package/ios/Core/TypedArrays/ConcreteTypedArrays.swift +58 -46
- package/ios/Core/TypedArrays/TypedArray.swift +11 -5
- package/ios/Core/Views/ConcreteViewProp.swift +4 -0
- package/ios/Core/Views/SwiftUI/SwiftUIViewDefinition.swift +1 -1
- package/ios/Core/Views/ViewDefinition.swift +36 -15
- package/ios/Core/Views/ViewLifecycleMethod.swift +4 -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/headers/xcframeworks/ExpoModulesCoreHeaders.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/spm.config.json +1 -0
- package/src/ts-declarations/global.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [iOS] Speed up module registration at app launch by classifying definition elements without protocol conformance lookups. ([#51456](https://github.com/expo/expo/pull/51456) by [@Kudo](https://github.com/Kudo))
|
|
8
|
+
- [iOS] Reduced the overhead of emitting events without a payload. ([#51560](https://github.com/expo/expo/pull/51560) by [@tsapeta](https://github.com/tsapeta))
|
|
9
|
+
- [iOS] Speed up app launch by computing default module, class and view names without protocol conformance lookups. ([#51455](https://github.com/expo/expo/pull/51455) by [@Kudo](https://github.com/Kudo))
|
|
10
|
+
- [iOS] Publish a headers XCFramework for `ExpoModulesCore` with the package, at `prebuilds/output/headers/xcframeworks/ExpoModulesCoreHeaders.tar.gz`. ([#51243](https://github.com/expo/expo/pull/51243) by [@chrfalch](https://github.com/chrfalch))
|
|
11
|
+
- [iOS] Add `isFunction()`, `isTypedArray()`, `isArrayBuffer()`, `getTypedArray(in:)`, `getArrayBuffer(in:)`, `getBigInt(in:)` and `kind` to `JavaScriptUnownedValue`. `Data`, typed arrays, `ArrayBuffer` and integers from a `BigInt` now decode function arguments without copying them into an owning `JavaScriptValue`: a `Data` argument is about 10% faster to decode, and an `Int64` from a `BigInt` about 8× faster. ([#51558](https://github.com/expo/expo/pull/51558) by [@tsapeta](https://github.com/tsapeta))
|
|
12
|
+
- [Internal] Drop unused `EXPO_PROJECT_ROOT` and `EXPO_ROUTER_ABS_APP_ROOT` variables and corresponding invalidation. ([#51540](https://github.com/expo/expo/pull/51540) by [@kitten](https://github.com/kitten))
|
|
13
|
+
- Updated dependencies. ([#51243](https://github.com/expo/expo/pull/51243), [#51562](https://github.com/expo/expo/pull/51562), [#51565](https://github.com/expo/expo/pull/51565), [#51564](https://github.com/expo/expo/pull/51564), [#51560](https://github.com/expo/expo/pull/51560), [#51558](https://github.com/expo/expo/pull/51558))
|
|
14
|
+
- expo-modules-jsi@58.0.14
|
|
15
|
+
|
|
3
16
|
## 58.0.18
|
|
4
17
|
|
|
5
18
|
### 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.19'
|
|
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.19"
|
|
179
179
|
buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
|
|
180
180
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"
|
|
181
181
|
|
|
Binary file
|
|
@@ -13,7 +13,6 @@ export interface ExpoProcessEnv {
|
|
|
13
13
|
/** Used in `@expo/metro-runtime`. */
|
|
14
14
|
EXPO_DEV_SERVER_ORIGIN?: string;
|
|
15
15
|
EXPO_ROUTER_IMPORT_MODE?: string;
|
|
16
|
-
EXPO_ROUTER_ABS_APP_ROOT?: string;
|
|
17
16
|
EXPO_ROUTER_APP_ROOT?: string;
|
|
18
17
|
/** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
|
|
19
18
|
EXPO_BASE_URL?: string;
|
|
@@ -49,5 +49,5 @@ public func Class<SharedObjectType: SharedObject>(
|
|
|
49
49
|
_ sharedObjectType: SharedObjectType.Type,
|
|
50
50
|
@ClassDefinitionBuilder<SharedObjectType> @_implicitSelfCapture _ elements: () -> [AnyClassDefinitionElement]
|
|
51
51
|
) -> ClassDefinition {
|
|
52
|
-
return ClassDefinition(name:
|
|
52
|
+
return ClassDefinition(name: unqualifiedTypeName(SharedObjectType.self), associatedType: SharedObjectType.self, elements: elements())
|
|
53
53
|
}
|
|
@@ -173,10 +173,15 @@ public final class ArrayBuffer: AnyArrayBuffer, Sendable {
|
|
|
173
173
|
unownedValue: borrowing JavaScriptUnownedValue,
|
|
174
174
|
in runtime: borrowing JavaScriptRuntime
|
|
175
175
|
) throws -> ArrayBuffer {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
// The kind checks read the borrowed value, so neither an `ArrayBuffer` nor a typed array is
|
|
177
|
+
// copied into an owning `JavaScriptValue` first.
|
|
178
|
+
if unownedValue.isArrayBuffer() {
|
|
179
|
+
return ArrayBuffer.from(jsArrayBuffer: unownedValue.getArrayBuffer(in: runtime))
|
|
178
180
|
}
|
|
179
|
-
|
|
181
|
+
if unownedValue.isTypedArray() {
|
|
182
|
+
return try ArrayBuffer.from(typedArray: unownedValue.getTypedArray(in: runtime))
|
|
183
|
+
}
|
|
184
|
+
throw ArrayBufferJavaScriptValueConversionException(unownedValue.isObject() ? .object : unownedValue.kind)
|
|
180
185
|
}
|
|
181
186
|
|
|
182
187
|
@JavaScriptActor
|
|
@@ -6,6 +6,10 @@ import ExpoModulesJSI
|
|
|
6
6
|
Represents a JavaScript class.
|
|
7
7
|
*/
|
|
8
8
|
public final class ClassDefinition: ObjectDefinition {
|
|
9
|
+
public override var _definitionClassification: DefinitionClassification {
|
|
10
|
+
return DefinitionClassification(kind: .klass(self))
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
Name of the class.
|
|
11
15
|
*/
|
|
@@ -28,13 +32,13 @@ public final class ClassDefinition: ObjectDefinition {
|
|
|
28
32
|
|
|
29
33
|
private init(_ name: String, associatedType: AnyDynamicType, isSharedRef: Bool, elements: [AnyClassDefinitionElement] = []) {
|
|
30
34
|
self.name = name
|
|
31
|
-
self.constructor = elements.first(where: isConstructor) as? AnySyncFunctionDefinition
|
|
32
35
|
self.associatedType = associatedType
|
|
33
36
|
self.isSharedRef = isSharedRef
|
|
34
37
|
|
|
35
38
|
// Constructors can't be passed down to the object definition
|
|
36
39
|
// as we shouldn't override the default `<Class>.prototype.constructor`.
|
|
37
|
-
|
|
40
|
+
self.constructor = elements.lazy.compactMap(constructorDefinition).first
|
|
41
|
+
let elementsWithoutConstructors = elements.filter { constructorDefinition($0) == nil }
|
|
38
42
|
|
|
39
43
|
super.init(definitions: elementsWithoutConstructors)
|
|
40
44
|
}
|
|
@@ -169,13 +173,19 @@ extension SharedObject: ClassAssociatedObject {}
|
|
|
169
173
|
// MARK: - Privates
|
|
170
174
|
|
|
171
175
|
/**
|
|
172
|
-
|
|
176
|
+
Returns the definition item as a constructor, a synchronous function whose name is "constructor", or `nil`.
|
|
173
177
|
|
|
174
178
|
We do it that way for the following two reasons:
|
|
175
179
|
- It's easier to reuse existing `SyncFunctionDefinition`.
|
|
176
180
|
- Redefining prototype's `constructor` is a bad idea so a function with this name
|
|
177
181
|
needs to be filtered out when decorating the prototype.
|
|
178
182
|
*/
|
|
179
|
-
private func
|
|
180
|
-
|
|
183
|
+
private func constructorDefinition(_ item: AnyDefinition) -> AnySyncFunctionDefinition? {
|
|
184
|
+
switch item._definitionClassification.kind {
|
|
185
|
+
case .function(let function), .staticFunction(let function):
|
|
186
|
+
// Only the element named "constructor" pays for the protocol cast.
|
|
187
|
+
return function.name == "constructor" ? function as? AnySyncFunctionDefinition : nil
|
|
188
|
+
default:
|
|
189
|
+
return nil
|
|
190
|
+
}
|
|
181
191
|
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Represents a listener for the specific event.
|
|
3
3
|
*/
|
|
4
4
|
internal struct EventListener: AnyDefinition {
|
|
5
|
+
var _definitionClassification: DefinitionClassification {
|
|
6
|
+
return DefinitionClassification(kind: .eventListener(self))
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
let name: EventName
|
|
6
10
|
let call: (Any?, Any?) throws -> Void
|
|
7
11
|
|
|
@@ -28,7 +28,7 @@ public extension EventEmitter {
|
|
|
28
28
|
Schedules an event with the given name to be emitted to the associated JavaScript object.
|
|
29
29
|
*/
|
|
30
30
|
func emit(event: String) {
|
|
31
|
-
emit(event: event, payload:
|
|
31
|
+
emit(event: event, payload: JavaScriptUndefined())
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -16,6 +16,10 @@ internal protocol AnyEventObservingDefinition: AnyDefinition, Sendable {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
public final class EventObservingDefinition: AnyEventObservingDefinition, @unchecked Sendable {
|
|
19
|
+
public var _definitionClassification: DefinitionClassification {
|
|
20
|
+
return DefinitionClassification(kind: .eventObserver(self))
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
public typealias ClosureType = () -> Void
|
|
20
24
|
|
|
21
25
|
let type: EventObservingType
|
|
@@ -23,6 +23,10 @@ private let defaultQueue = DispatchQueue(label: "expo.modules.AsyncFunctionQueue
|
|
|
23
23
|
Represents a function that can only be called asynchronously, thus its JavaScript equivalent returns a Promise.
|
|
24
24
|
*/
|
|
25
25
|
public class AsyncFunctionDefinition<Args, FirstArgType, ReturnType>: AnyAsyncFunctionDefinition, @unchecked Sendable {
|
|
26
|
+
public var _definitionClassification: DefinitionClassification {
|
|
27
|
+
return DefinitionClassification(kind: .function(self))
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
typealias ClosureType = (Args) throws -> ReturnType
|
|
27
31
|
|
|
28
32
|
/**
|
|
@@ -17,6 +17,10 @@ internal protocol AnyConcurrentFunctionDefinition: AnyFunctionDefinition {
|
|
|
17
17
|
As opposed to `AsyncFunctionDefinition`, it can leverage the new Swift's concurrency model and take the async/await closure.
|
|
18
18
|
*/
|
|
19
19
|
public class ConcurrentFunctionDefinition<Args, FirstArgType, ReturnType>: AnyConcurrentFunctionDefinition, @unchecked Sendable {
|
|
20
|
+
public var _definitionClassification: DefinitionClassification {
|
|
21
|
+
return DefinitionClassification(kind: .function(self))
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
typealias ClosureType = @Sendable (Args) async throws -> sending ReturnType
|
|
21
25
|
|
|
22
26
|
let body: ClosureType
|
|
@@ -9,6 +9,10 @@ import ExpoModulesJSI
|
|
|
9
9
|
The async variant creates a JS Promise and dispatches the block invocation to a background queue.
|
|
10
10
|
*/
|
|
11
11
|
public struct OptimizedAsyncFunctionDefinition: AnyAsyncFunctionDefinition, @unchecked Sendable {
|
|
12
|
+
public var _definitionClassification: DefinitionClassification {
|
|
13
|
+
return DefinitionClassification(kind: .function(self))
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
public let name: String
|
|
13
17
|
public let typeEncoding: String
|
|
14
18
|
public let argsCount: Int
|
|
@@ -7,6 +7,10 @@ import ExpoModulesJSI
|
|
|
7
7
|
This is used by the `@OptimizedFunction` macro with specific type signatures.
|
|
8
8
|
*/
|
|
9
9
|
public struct OptimizedSyncFunctionDefinition: AnySyncFunctionDefinition, @unchecked Sendable {
|
|
10
|
+
public var _definitionClassification: DefinitionClassification {
|
|
11
|
+
return DefinitionClassification(kind: .function(self))
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
public let name: String
|
|
11
15
|
public let typeEncoding: String
|
|
12
16
|
public let argsCount: Int
|
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
// Copyright 2025-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
A protocol for static any type-erased function.
|
|
5
|
-
*/
|
|
6
|
-
internal protocol AnyStaticFunctionDefinition: AnyFunctionDefinition {
|
|
7
|
-
/**
|
|
8
|
-
Indicates whether the function is static.
|
|
9
|
-
*/
|
|
10
|
-
var isStatic: Bool { get }
|
|
11
|
-
}
|
|
12
|
-
|
|
13
3
|
/**
|
|
14
4
|
Represents a static function that can only be called synchronously.
|
|
15
5
|
*/
|
|
16
6
|
public final class StaticSyncFunctionDefinition<Args, FirstArgType, ReturnType>:
|
|
17
|
-
SyncFunctionDefinition<Args, FirstArgType, ReturnType>,
|
|
18
|
-
|
|
7
|
+
SyncFunctionDefinition<Args, FirstArgType, ReturnType>, @unchecked Sendable {
|
|
8
|
+
public override var _definitionClassification: DefinitionClassification {
|
|
9
|
+
return DefinitionClassification(kind: .staticFunction(self))
|
|
10
|
+
}
|
|
19
11
|
}
|
|
20
12
|
|
|
21
13
|
/**
|
|
22
14
|
Represents a static function that can only be called asynchronously, thus its JavaScript equivalent returns a Promise.
|
|
23
15
|
*/
|
|
24
16
|
public final class StaticAsyncFunctionDefinition<Args, FirstArgType, ReturnType>:
|
|
25
|
-
AsyncFunctionDefinition<Args, FirstArgType, ReturnType>,
|
|
26
|
-
|
|
17
|
+
AsyncFunctionDefinition<Args, FirstArgType, ReturnType>, @unchecked Sendable {
|
|
18
|
+
public override var _definitionClassification: DefinitionClassification {
|
|
19
|
+
return DefinitionClassification(kind: .staticFunction(self))
|
|
20
|
+
}
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
/**
|
|
30
24
|
Represents a static function that can only be called asynchronously, thus its JavaScript equivalent returns a Promise.
|
|
31
25
|
*/
|
|
32
26
|
public final class StaticConcurrentFunctionDefinition<Args, FirstArgType, ReturnType>:
|
|
33
|
-
ConcurrentFunctionDefinition<Args, FirstArgType, ReturnType>,
|
|
34
|
-
|
|
27
|
+
ConcurrentFunctionDefinition<Args, FirstArgType, ReturnType>, @unchecked Sendable {
|
|
28
|
+
public override var _definitionClassification: DefinitionClassification {
|
|
29
|
+
return DefinitionClassification(kind: .staticFunction(self))
|
|
30
|
+
}
|
|
35
31
|
}
|
|
@@ -34,6 +34,10 @@ internal protocol AnySyncFunctionDefinition: AnyFunctionDefinition, ~Copyable {
|
|
|
34
34
|
Represents a function that can only be called synchronously.
|
|
35
35
|
*/
|
|
36
36
|
public class SyncFunctionDefinition<Args, FirstArgType, ReturnType>: AnySyncFunctionDefinition, @unchecked Sendable {
|
|
37
|
+
public var _definitionClassification: DefinitionClassification {
|
|
38
|
+
return DefinitionClassification(kind: .function(self))
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
typealias ClosureType = (Args) throws -> ReturnType
|
|
38
42
|
|
|
39
43
|
/**
|
|
@@ -40,26 +40,41 @@ public final class ModuleDefinition: ObjectDefinition {
|
|
|
40
40
|
override init(definitions: [AnyDefinition]) {
|
|
41
41
|
self.rawDefinitions = definitions
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
var name: String?
|
|
44
|
+
var eventListeners = [EventListener]()
|
|
45
|
+
var viewDefinitions = [AnyViewDefinition]()
|
|
46
|
+
var eventNames = [String]()
|
|
47
|
+
var eventObservers = [AnyEventObservingDefinition]()
|
|
48
|
+
|
|
49
|
+
for definition in definitions {
|
|
50
|
+
switch definition._definitionClassification.kind {
|
|
51
|
+
case .moduleName(let nameDefinition):
|
|
52
|
+
name = nameDefinition.name
|
|
53
|
+
case .eventListener(let listener):
|
|
54
|
+
eventListeners.append(listener)
|
|
55
|
+
case .view(let view):
|
|
56
|
+
viewDefinitions.append(view)
|
|
57
|
+
case .events(let events):
|
|
58
|
+
eventNames.append(contentsOf: events.names)
|
|
59
|
+
case .eventObserver(let observer):
|
|
60
|
+
eventObservers.append(observer)
|
|
61
|
+
case .unknown:
|
|
62
|
+
// `AnyViewDefinition` is the only element protocol collected here that a type from another module can conform to.
|
|
63
|
+
if let view = definition as? AnyViewDefinition {
|
|
64
|
+
viewDefinitions.append(view)
|
|
65
|
+
}
|
|
66
|
+
case .function, .staticFunction, .legacyConstants, .constant, .property, .klass, .viewProp, .viewName, .viewLifecycle:
|
|
67
|
+
break
|
|
68
|
+
}
|
|
69
|
+
}
|
|
49
70
|
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
self.name = name ?? ""
|
|
72
|
+
self.eventListeners = eventListeners
|
|
52
73
|
var viewsDict = Dictionary(uniqueKeysWithValues: viewDefinitions.map { ($0.name, $0) })
|
|
53
74
|
viewsDict[DEFAULT_MODULE_VIEW] = viewDefinitions.first
|
|
54
75
|
self.views = viewsDict
|
|
55
|
-
self.eventNames =
|
|
56
|
-
|
|
57
|
-
.compactMap { ($0 as? EventsDefinition)?.names }
|
|
58
|
-
.joined()
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
self.eventObservers = definitions
|
|
62
|
-
.compactMap { $0 as? AnyEventObservingDefinition }
|
|
76
|
+
self.eventNames = eventNames
|
|
77
|
+
self.eventObservers = eventObservers
|
|
63
78
|
|
|
64
79
|
super.init(definitions: definitions)
|
|
65
80
|
}
|
|
@@ -109,6 +124,10 @@ public final class ModuleDefinition: ObjectDefinition {
|
|
|
109
124
|
Module's name definition. Returned by `name()` in module's definition.
|
|
110
125
|
*/
|
|
111
126
|
internal struct ModuleNameDefinition: AnyDefinition {
|
|
127
|
+
var _definitionClassification: DefinitionClassification {
|
|
128
|
+
return DefinitionClassification(kind: .moduleName(self))
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
let name: String
|
|
113
132
|
}
|
|
114
133
|
|
|
@@ -116,6 +135,10 @@ internal struct ModuleNameDefinition: AnyDefinition {
|
|
|
116
135
|
A definition for module's constants. Returned by `constants(() -> SomeType)` in module's definition.
|
|
117
136
|
*/
|
|
118
137
|
internal struct ConstantsDefinition: AnyDefinition {
|
|
138
|
+
var _definitionClassification: DefinitionClassification {
|
|
139
|
+
return DefinitionClassification(kind: .legacyConstants(self))
|
|
140
|
+
}
|
|
141
|
+
|
|
119
142
|
let body: () -> [String: Any?]
|
|
120
143
|
}
|
|
121
144
|
|
|
@@ -123,5 +146,9 @@ internal struct ConstantsDefinition: AnyDefinition {
|
|
|
123
146
|
A definition for module's events that can be sent to JavaScript.
|
|
124
147
|
*/
|
|
125
148
|
public struct EventsDefinition: AnyDefinition {
|
|
149
|
+
public var _definitionClassification: DefinitionClassification {
|
|
150
|
+
return DefinitionClassification(kind: .events(self))
|
|
151
|
+
}
|
|
152
|
+
|
|
126
153
|
let names: [String]
|
|
127
154
|
}
|
|
@@ -21,6 +21,10 @@ protocol AnyConstantDefinition {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
public final class ConstantDefinition<ReturnType: AnyArgument>: AnyDefinition, AnyConstantDefinition {
|
|
24
|
+
public var _definitionClassification: DefinitionClassification {
|
|
25
|
+
return DefinitionClassification(kind: .constant(self))
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
typealias ClosureType = () throws -> ReturnType
|
|
25
29
|
|
|
26
30
|
/**
|
|
@@ -6,6 +6,10 @@ import ExpoModulesJSI
|
|
|
6
6
|
Base class for other definitions representing an object, such as `ModuleDefinition`.
|
|
7
7
|
*/
|
|
8
8
|
public class ObjectDefinition: AnyDefinition, JavaScriptObjectBuilder {
|
|
9
|
+
public var _definitionClassification: DefinitionClassification {
|
|
10
|
+
return .unknown
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
A dictionary of functions defined by the object.
|
|
11
15
|
*/
|
|
@@ -40,39 +44,39 @@ public class ObjectDefinition: AnyDefinition, JavaScriptObjectBuilder {
|
|
|
40
44
|
Default initializer receiving children definitions from the result builder.
|
|
41
45
|
*/
|
|
42
46
|
init(definitions: [AnyDefinition]) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.reduce(into: [String: AnyPropertyDefinition]()) { dict, property in
|
|
68
|
-
dict[property.name] = property
|
|
47
|
+
var functions = [String: AnyFunctionDefinition]()
|
|
48
|
+
var staticFunctions = [String: AnyFunctionDefinition]()
|
|
49
|
+
var legacyConstants = [ConstantsDefinition]()
|
|
50
|
+
var constants = [String: AnyConstantDefinition]()
|
|
51
|
+
var properties = [String: AnyPropertyDefinition]()
|
|
52
|
+
var classes = [String: ClassDefinition]()
|
|
53
|
+
|
|
54
|
+
for definition in definitions {
|
|
55
|
+
switch definition._definitionClassification.kind {
|
|
56
|
+
case .function(let function):
|
|
57
|
+
functions[function.name] = function
|
|
58
|
+
case .staticFunction(let function):
|
|
59
|
+
staticFunctions[function.name] = function
|
|
60
|
+
case .legacyConstants(let constantsDefinition):
|
|
61
|
+
legacyConstants.append(constantsDefinition)
|
|
62
|
+
case .constant(let constant):
|
|
63
|
+
constants[constant.name] = constant
|
|
64
|
+
case .property(let property):
|
|
65
|
+
properties[property.name] = property
|
|
66
|
+
case .klass(let klass):
|
|
67
|
+
classes[klass.name] = klass
|
|
68
|
+
case .unknown, .moduleName, .eventListener, .events, .eventObserver, .view, .viewProp, .viewName, .viewLifecycle:
|
|
69
|
+
// Every protocol collected here is internal, so an unclassified element from another module can't match any of them.
|
|
70
|
+
break
|
|
69
71
|
}
|
|
72
|
+
}
|
|
70
73
|
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
self.functions = functions
|
|
75
|
+
self.staticFunctions = staticFunctions
|
|
76
|
+
self.legacyConstants = legacyConstants
|
|
77
|
+
self.constants = constants
|
|
78
|
+
self.properties = properties
|
|
79
|
+
self.classes = classes
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -23,6 +23,10 @@ protocol AnyPropertyDefinition {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
public final class PropertyDefinition<OwnerType>: AnyDefinition, AnyPropertyDefinition, @unchecked Sendable {
|
|
26
|
+
public var _definitionClassification: DefinitionClassification {
|
|
27
|
+
return DefinitionClassification(kind: .property(self))
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
Name of the property.
|
|
28
32
|
*/
|
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
A protocol that must be implemented to be a part of module's definition and the module definition itself.
|
|
3
3
|
*/
|
|
4
|
-
public protocol AnyDefinition: ~Copyable {
|
|
4
|
+
public protocol AnyDefinition: ~Copyable {
|
|
5
|
+
/**
|
|
6
|
+
The kind of definition element this is, so containers can switch on it instead of casting to each element protocol.
|
|
7
|
+
A protocol cast that misses the runtime cache walks every conformance record.
|
|
8
|
+
A type that does not override this returns `.unknown`.
|
|
9
|
+
*/
|
|
10
|
+
var _definitionClassification: DefinitionClassification { get }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
extension AnyDefinition where Self: ~Copyable {
|
|
14
|
+
public var _definitionClassification: DefinitionClassification { .unknown }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
The kind of a definition element together with the element itself.
|
|
19
|
+
Only `.unknown` is public, so a conformer outside of this module cannot classify itself.
|
|
20
|
+
When a kind is added, every container switch must handle it, and the `.unknown` fallbacks must stay in sync.
|
|
21
|
+
*/
|
|
22
|
+
public struct DefinitionClassification {
|
|
23
|
+
internal enum Kind {
|
|
24
|
+
case unknown
|
|
25
|
+
case function(AnyFunctionDefinition)
|
|
26
|
+
case staticFunction(AnyFunctionDefinition)
|
|
27
|
+
case legacyConstants(ConstantsDefinition)
|
|
28
|
+
case constant(AnyConstantDefinition)
|
|
29
|
+
case property(AnyPropertyDefinition)
|
|
30
|
+
case klass(ClassDefinition)
|
|
31
|
+
case moduleName(ModuleNameDefinition)
|
|
32
|
+
case eventListener(EventListener)
|
|
33
|
+
case events(EventsDefinition)
|
|
34
|
+
case eventObserver(AnyEventObservingDefinition)
|
|
35
|
+
case view(AnyViewDefinition)
|
|
36
|
+
case viewProp(AnyViewProp)
|
|
37
|
+
case viewName(ViewNameDefinition)
|
|
38
|
+
case viewLifecycle(AnyViewLifecycleMethod)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
internal let kind: Kind
|
|
42
|
+
|
|
43
|
+
public static var unknown: DefinitionClassification {
|
|
44
|
+
return DefinitionClassification(kind: .unknown)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -53,7 +53,7 @@ public protocol AnyModule: AnyObject, AnyArgument {
|
|
|
53
53
|
|
|
54
54
|
extension AnyModule {
|
|
55
55
|
public static var _jsName: String {
|
|
56
|
-
return
|
|
56
|
+
return unqualifiedTypeName(self)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/// An empty definition by default, so `@ExpoModule`-macro modules that describe their whole surface
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2026-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
The name `String(describing: type)` gives for a metatype, without its three protocol conformance probes and the `Mirror`.
|
|
5
|
+
It takes an opaque `Any.Type` and is never inlined on purpose.
|
|
6
|
+
With a statically known metatype the optimizer folds `_typeName` into a constant that keeps the file discriminator
|
|
7
|
+
of a `private` type, e.g. `(Foo in _ABC123…)`, where `String(describing:)` yields `Foo`.
|
|
8
|
+
*/
|
|
9
|
+
@inline(never)
|
|
10
|
+
internal func unqualifiedTypeName(_ type: Any.Type) -> String {
|
|
11
|
+
return _typeName(type, qualified: false)
|
|
12
|
+
}
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
import ExpoModulesJSI
|
|
4
4
|
|
|
5
|
-
// Each concrete typed array overrides `decode` to return its own `Self` and reject a
|
|
6
|
-
// delegating to the shared `decode(_:expectingKind:)` on the base.
|
|
5
|
+
// Each concrete typed array overrides the unowned `decode` to return its own `Self` and reject a
|
|
6
|
+
// mismatched kind, delegating to the shared `decode(_:expectingKind:in:)` on the base. The owning
|
|
7
|
+
// `decode` is the `JavaScriptDecodable` default, which forwards to it. See `TypedArray.swift` for why the
|
|
7
8
|
// witness is an overridable `class func` rather than living in the conformance extension.
|
|
8
9
|
|
|
9
10
|
/// Native equivalent of `Int8Array` in JavaScript, an array of two's-complement 8-bit signed integers.
|
|
10
11
|
public final class Int8Array: GenericTypedArray<Int8> {
|
|
11
12
|
@JavaScriptActor
|
|
12
13
|
@inlinable
|
|
13
|
-
public override class func decode(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
public override class func decode(
|
|
15
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
16
|
+
in runtime: borrowing JavaScriptRuntime
|
|
17
|
+
) throws -> Int8Array {
|
|
18
|
+
return try decode(value, expectingKind: .Int8Array, in: runtime)
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -21,10 +23,11 @@ public final class Int8Array: GenericTypedArray<Int8> {
|
|
|
21
23
|
public final class Int16Array: GenericTypedArray<Int16> {
|
|
22
24
|
@JavaScriptActor
|
|
23
25
|
@inlinable
|
|
24
|
-
public override class func decode(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
public override class func decode(
|
|
27
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
28
|
+
in runtime: borrowing JavaScriptRuntime
|
|
29
|
+
) throws -> Int16Array {
|
|
30
|
+
return try decode(value, expectingKind: .Int16Array, in: runtime)
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -32,10 +35,11 @@ public final class Int16Array: GenericTypedArray<Int16> {
|
|
|
32
35
|
public final class Int32Array: GenericTypedArray<Int32> {
|
|
33
36
|
@JavaScriptActor
|
|
34
37
|
@inlinable
|
|
35
|
-
public override class func decode(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
public override class func decode(
|
|
39
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
40
|
+
in runtime: borrowing JavaScriptRuntime
|
|
41
|
+
) throws -> Int32Array {
|
|
42
|
+
return try decode(value, expectingKind: .Int32Array, in: runtime)
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -43,10 +47,11 @@ public final class Int32Array: GenericTypedArray<Int32> {
|
|
|
43
47
|
public final class Uint8Array: GenericTypedArray<UInt8> {
|
|
44
48
|
@JavaScriptActor
|
|
45
49
|
@inlinable
|
|
46
|
-
public override class func decode(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
public override class func decode(
|
|
51
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
52
|
+
in runtime: borrowing JavaScriptRuntime
|
|
53
|
+
) throws -> Uint8Array {
|
|
54
|
+
return try decode(value, expectingKind: .Uint8Array, in: runtime)
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -54,10 +59,11 @@ public final class Uint8Array: GenericTypedArray<UInt8> {
|
|
|
54
59
|
public final class Uint8ClampedArray: GenericTypedArray<UInt8> {
|
|
55
60
|
@JavaScriptActor
|
|
56
61
|
@inlinable
|
|
57
|
-
public override class func decode(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
public override class func decode(
|
|
63
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
64
|
+
in runtime: borrowing JavaScriptRuntime
|
|
65
|
+
) throws -> Uint8ClampedArray {
|
|
66
|
+
return try decode(value, expectingKind: .Uint8ClampedArray, in: runtime)
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -65,10 +71,11 @@ public final class Uint8ClampedArray: GenericTypedArray<UInt8> {
|
|
|
65
71
|
public final class Uint16Array: GenericTypedArray<UInt16> {
|
|
66
72
|
@JavaScriptActor
|
|
67
73
|
@inlinable
|
|
68
|
-
public override class func decode(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
public override class func decode(
|
|
75
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
76
|
+
in runtime: borrowing JavaScriptRuntime
|
|
77
|
+
) throws -> Uint16Array {
|
|
78
|
+
return try decode(value, expectingKind: .Uint16Array, in: runtime)
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
|
|
@@ -76,10 +83,11 @@ public final class Uint16Array: GenericTypedArray<UInt16> {
|
|
|
76
83
|
public final class Uint32Array: GenericTypedArray<UInt32> {
|
|
77
84
|
@JavaScriptActor
|
|
78
85
|
@inlinable
|
|
79
|
-
public override class func decode(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
public override class func decode(
|
|
87
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
88
|
+
in runtime: borrowing JavaScriptRuntime
|
|
89
|
+
) throws -> Uint32Array {
|
|
90
|
+
return try decode(value, expectingKind: .Uint32Array, in: runtime)
|
|
83
91
|
}
|
|
84
92
|
}
|
|
85
93
|
|
|
@@ -87,10 +95,11 @@ public final class Uint32Array: GenericTypedArray<UInt32> {
|
|
|
87
95
|
public final class Float32Array: GenericTypedArray<Float32> {
|
|
88
96
|
@JavaScriptActor
|
|
89
97
|
@inlinable
|
|
90
|
-
public override class func decode(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
public override class func decode(
|
|
99
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
100
|
+
in runtime: borrowing JavaScriptRuntime
|
|
101
|
+
) throws -> Float32Array {
|
|
102
|
+
return try decode(value, expectingKind: .Float32Array, in: runtime)
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
|
|
@@ -98,10 +107,11 @@ public final class Float32Array: GenericTypedArray<Float32> {
|
|
|
98
107
|
public final class Float64Array: GenericTypedArray<Float64> {
|
|
99
108
|
@JavaScriptActor
|
|
100
109
|
@inlinable
|
|
101
|
-
public override class func decode(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
public override class func decode(
|
|
111
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
112
|
+
in runtime: borrowing JavaScriptRuntime
|
|
113
|
+
) throws -> Float64Array {
|
|
114
|
+
return try decode(value, expectingKind: .Float64Array, in: runtime)
|
|
105
115
|
}
|
|
106
116
|
}
|
|
107
117
|
|
|
@@ -109,10 +119,11 @@ public final class Float64Array: GenericTypedArray<Float64> {
|
|
|
109
119
|
public final class BigInt64Array: GenericTypedArray<Int64> {
|
|
110
120
|
@JavaScriptActor
|
|
111
121
|
@inlinable
|
|
112
|
-
public override class func decode(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
public override class func decode(
|
|
123
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
124
|
+
in runtime: borrowing JavaScriptRuntime
|
|
125
|
+
) throws -> BigInt64Array {
|
|
126
|
+
return try decode(value, expectingKind: .BigInt64Array, in: runtime)
|
|
116
127
|
}
|
|
117
128
|
}
|
|
118
129
|
|
|
@@ -120,9 +131,10 @@ public final class BigInt64Array: GenericTypedArray<Int64> {
|
|
|
120
131
|
public final class BigUint64Array: GenericTypedArray<UInt64> {
|
|
121
132
|
@JavaScriptActor
|
|
122
133
|
@inlinable
|
|
123
|
-
public override class func decode(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
public override class func decode(
|
|
135
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
136
|
+
in runtime: borrowing JavaScriptRuntime
|
|
137
|
+
) throws -> BigUint64Array {
|
|
138
|
+
return try decode(value, expectingKind: .BigUint64Array, in: runtime)
|
|
127
139
|
}
|
|
128
140
|
}
|
|
@@ -100,10 +100,15 @@ public class TypedArray: AnyTypedArray {
|
|
|
100
100
|
|
|
101
101
|
/// `JavaScriptDecodable` witness. It's a `class func` in the class body, not in the conformance
|
|
102
102
|
/// extension, so the concrete subclasses can override it (extension methods can't be overridden).
|
|
103
|
+
/// It takes a borrowed value, so a typed array argument is decoded without copying it into an owning
|
|
104
|
+
/// `JavaScriptValue`; the owning `decode` is the `JavaScriptDecodable` default, which forwards here.
|
|
103
105
|
/// The base accepts any kind and resolves the concrete subclass via `create(from:)`.
|
|
104
106
|
@JavaScriptActor
|
|
105
107
|
@inlinable
|
|
106
|
-
public class func decode(
|
|
108
|
+
public class func decode(
|
|
109
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
110
|
+
in runtime: borrowing JavaScriptRuntime
|
|
111
|
+
) throws -> Self {
|
|
107
112
|
guard value.isTypedArray() else {
|
|
108
113
|
throw NotATypedArrayException()
|
|
109
114
|
}
|
|
@@ -111,7 +116,7 @@ public class TypedArray: AnyTypedArray {
|
|
|
111
116
|
// to `Self` always holds; it only fails when this inherited witness runs for a narrower `Self` (a
|
|
112
117
|
// `GenericTypedArray<T>` specialization) whose element type doesn't match the JS kind. Guard rather
|
|
113
118
|
// than force-cast so that surfaces as a thrown error instead of a trap.
|
|
114
|
-
let typedArray = create(from: value.getTypedArray())
|
|
119
|
+
let typedArray = create(from: value.getTypedArray(in: runtime))
|
|
115
120
|
guard let typed = typedArray as? Self else {
|
|
116
121
|
throw KindMismatchException(expected: nil, received: typedArray.kind)
|
|
117
122
|
}
|
|
@@ -123,13 +128,14 @@ public class TypedArray: AnyTypedArray {
|
|
|
123
128
|
@JavaScriptActor
|
|
124
129
|
@inlinable
|
|
125
130
|
internal static func decode(
|
|
126
|
-
_ value: borrowing
|
|
127
|
-
expectingKind kind: JavaScriptTypedArray.Kind
|
|
131
|
+
_ value: borrowing JavaScriptUnownedValue,
|
|
132
|
+
expectingKind kind: JavaScriptTypedArray.Kind,
|
|
133
|
+
in runtime: borrowing JavaScriptRuntime
|
|
128
134
|
) throws -> Self {
|
|
129
135
|
guard value.isTypedArray() else {
|
|
130
136
|
throw NotATypedArrayException()
|
|
131
137
|
}
|
|
132
|
-
let jsTypedArray = value.getTypedArray()
|
|
138
|
+
let jsTypedArray = value.getTypedArray(in: runtime)
|
|
133
139
|
guard jsTypedArray.kind == kind else {
|
|
134
140
|
throw KindMismatchException(expected: kind, received: jsTypedArray.kind)
|
|
135
141
|
}
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
Specialized class for the view prop. Specifies the prop name and its setter.
|
|
5
5
|
*/
|
|
6
6
|
public final class ConcreteViewProp<ViewType: UIView, PropType: AnyArgument>: AnyViewProp, @unchecked Sendable {
|
|
7
|
+
public var _definitionClassification: DefinitionClassification {
|
|
8
|
+
return DefinitionClassification(kind: .viewProp(self))
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
public typealias SetterType = @MainActor (ViewType, PropType) -> Void
|
|
8
12
|
|
|
9
13
|
/**
|
|
@@ -87,7 +87,7 @@ extension ExpoSwiftUI {
|
|
|
87
87
|
|
|
88
88
|
convenience init(_ viewType: ViewType.Type) {
|
|
89
89
|
// We assume SwiftUI views are exported as named views under the class name
|
|
90
|
-
let nameDefinitionElement = ViewNameDefinition(name:
|
|
90
|
+
let nameDefinitionElement = ViewNameDefinition(name: unqualifiedTypeName(viewType))
|
|
91
91
|
self.init(viewType, elements: [nameDefinitionElement])
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -6,6 +6,10 @@ import ExpoModulesJSI
|
|
|
6
6
|
A definition representing the native view to export to React.
|
|
7
7
|
*/
|
|
8
8
|
public class ViewDefinition<ViewType>: ObjectDefinition, AnyViewDefinition, @unchecked Sendable {
|
|
9
|
+
public override var _definitionClassification: DefinitionClassification {
|
|
10
|
+
return DefinitionClassification(kind: .view(self))
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
An array of view props definitions.
|
|
11
15
|
*/
|
|
@@ -30,22 +34,35 @@ public class ViewDefinition<ViewType>: ObjectDefinition, AnyViewDefinition, @unc
|
|
|
30
34
|
Default initializer receiving children definitions from the result builder.
|
|
31
35
|
*/
|
|
32
36
|
init(_ viewType: ViewType.Type, elements: [AnyViewDefinitionElement]) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
var props = [any AnyViewProp]()
|
|
38
|
+
var name: String?
|
|
39
|
+
var eventNames = [String]()
|
|
40
|
+
var lifecycleMethods = [AnyViewLifecycleMethod]()
|
|
41
|
+
|
|
42
|
+
for element in elements {
|
|
43
|
+
switch element._definitionClassification.kind {
|
|
44
|
+
case .viewProp(let prop):
|
|
45
|
+
props.append(prop)
|
|
46
|
+
case .viewName(let nameDefinition):
|
|
47
|
+
name = nameDefinition.name
|
|
48
|
+
case .events(let events):
|
|
49
|
+
eventNames.append(contentsOf: events.names)
|
|
50
|
+
case .viewLifecycle(let method):
|
|
51
|
+
lifecycleMethods.append(method)
|
|
52
|
+
case .unknown:
|
|
53
|
+
// `AnyViewProp` is the only element protocol collected here that a type from another module can conform to.
|
|
54
|
+
if let prop = element as? AnyViewProp {
|
|
55
|
+
props.append(prop)
|
|
56
|
+
}
|
|
57
|
+
case .function, .staticFunction, .legacyConstants, .constant, .property, .klass, .moduleName, .eventListener, .eventObserver, .view:
|
|
58
|
+
break
|
|
59
|
+
}
|
|
60
|
+
}
|
|
46
61
|
|
|
47
|
-
self.
|
|
48
|
-
|
|
62
|
+
self.props = props
|
|
63
|
+
self.name = name ?? unqualifiedTypeName(viewType)
|
|
64
|
+
self.eventNames = eventNames
|
|
65
|
+
self.lifecycleMethods = lifecycleMethods
|
|
49
66
|
|
|
50
67
|
super.init(definitions: elements)
|
|
51
68
|
}
|
|
@@ -127,5 +144,9 @@ extension UIView: @MainActor AnyArgument {
|
|
|
127
144
|
}
|
|
128
145
|
|
|
129
146
|
public struct ViewNameDefinition: AnyViewDefinitionElement {
|
|
147
|
+
public var _definitionClassification: DefinitionClassification {
|
|
148
|
+
return DefinitionClassification(kind: .viewName(self))
|
|
149
|
+
}
|
|
150
|
+
|
|
130
151
|
let name: String
|
|
131
152
|
}
|
|
@@ -27,6 +27,10 @@ internal protocol AnyViewLifecycleMethod: AnyDefinition {
|
|
|
27
27
|
Element of the view definition that represents a lifecycle method, such as `OnViewDidUpdateProps`.
|
|
28
28
|
*/
|
|
29
29
|
public final class ViewLifecycleMethod<ViewType>: AnyViewLifecycleMethod {
|
|
30
|
+
public var _definitionClassification: DefinitionClassification {
|
|
31
|
+
return DefinitionClassification(kind: .viewLifecycle(self))
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
public typealias Closure = @MainActor (ViewType) -> Void
|
|
31
35
|
|
|
32
36
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.19",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"./package.json": "./package.json"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"expo-modules-jsi": "~58.0.
|
|
67
|
+
"expo-modules-jsi": "~58.0.14",
|
|
68
68
|
"expo-modules-macros": "0.20.0",
|
|
69
69
|
"invariant": "^2.2.4"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@expo/internal-scripts": "58.0.
|
|
72
|
+
"@expo/internal-scripts": "58.0.3",
|
|
73
73
|
"@testing-library/react-native": "^14.0.1",
|
|
74
74
|
"@types/invariant": "^2.2.33",
|
|
75
75
|
"@types/react": "~19.3.0",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/spm.config.json
CHANGED
|
@@ -14,7 +14,6 @@ export interface ExpoProcessEnv {
|
|
|
14
14
|
EXPO_DEV_SERVER_ORIGIN?: string;
|
|
15
15
|
|
|
16
16
|
EXPO_ROUTER_IMPORT_MODE?: string;
|
|
17
|
-
EXPO_ROUTER_ABS_APP_ROOT?: string;
|
|
18
17
|
EXPO_ROUTER_APP_ROOT?: string;
|
|
19
18
|
|
|
20
19
|
/** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
|