expo-brownfield 58.0.11 → 58.0.13
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 +26 -0
- package/android/build.gradle +2 -2
- package/expo-module.config.json +0 -3
- package/ios/ExpoBrownfieldModule.swift +40 -33
- package/ios/ExpoBrownfieldStateModule.swift +15 -35
- package/ios/Messaging.swift +1 -1
- package/ios/SharedState.swift +10 -2
- package/ios/State.swift +1 -1
- package/package.json +4 -4
- package/prebuilds/output/debug/xcframeworks/ExpoBrownfield.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoBrownfield.tar.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [iOS][Internal] Define `ExpoBrownfieldModule` and `ExpoBrownfieldStateModule` with the `@ExpoModule`, `@SharedObject`, `@JS` and `@Event` macros instead of the module definition DSL. ([#51381](https://github.com/expo/expo/pull/51381) by [@tsapeta](https://github.com/tsapeta))
|
|
8
|
+
- [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))
|
|
9
|
+
- [iOS] Make `JavaScriptValue` a non-copyable struct. This is a breaking change for Swift code that uses `JavaScriptValue` directly:
|
|
10
|
+
|
|
11
|
+
- Values are moved, not shared. Pass them as `borrowing` or `consuming` parameters, and call `copy()` where a second owned value is needed.
|
|
12
|
+
- `JavaScriptValue.undefined` and `JavaScriptValue.null` are functions now: write `.undefined()` and `.null()`.
|
|
13
|
+
- 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.
|
|
14
|
+
- 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(_:)`.
|
|
15
|
+
- `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.
|
|
16
|
+
|
|
17
|
+
([#51368](https://github.com/expo/expo/pull/51368) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
19
|
+
- [iOS] Remove the module class declarations from `expo-module.config.json`. Autolinking now detects the `@ExpoModule`-annotated classes. ([#49784](https://github.com/expo/expo/pull/49784) by [@tsapeta](https://github.com/tsapeta))
|
|
20
|
+
- Updated dependencies. ([#51321](https://github.com/expo/expo/pull/51321))
|
|
21
|
+
- @expo/env@2.5.2
|
|
22
|
+
|
|
23
|
+
## 58.0.12
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Bump precompiled artifacts due to ABI breakage in expo-modules-core@58.0.13. ([#51138](https://github.com/expo/expo/pull/51138) by [@alanjhughes](https://github.com/alanjhughes))
|
|
28
|
+
|
|
3
29
|
## 58.0.11
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,7 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'expo.modules.brownfield'
|
|
7
|
-
version = '58.0.
|
|
7
|
+
version = '58.0.13'
|
|
8
8
|
|
|
9
9
|
expoModule {
|
|
10
10
|
canBePublished false
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.brownfield"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 1
|
|
17
|
-
versionName '58.0.
|
|
17
|
+
versionName '58.0.13'
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
package/expo-module.config.json
CHANGED
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
|
|
3
|
-
let NATIVE_MESSAGE_EVENT_NAME = "onMessage"
|
|
4
|
-
|
|
5
3
|
// MARK: - ExpoBrownfieldModule
|
|
6
4
|
|
|
5
|
+
@ExpoModule
|
|
7
6
|
public class ExpoBrownfieldModule: Module {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
@Event("onMessage")
|
|
8
|
+
var onMessage: (BrownfieldMessage) -> Void
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
public override func didStartListening(event: String) {
|
|
11
|
+
BrownfieldMessagingInternal.shared.setExpoModule(self)
|
|
12
|
+
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
public override func didStopListening(event: String) {
|
|
15
|
+
BrownfieldMessagingInternal.shared.clearExpoModule(self)
|
|
16
|
+
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
@JS
|
|
19
|
+
func popToNative(_ animated: Bool) {
|
|
20
|
+
DispatchQueue.main.async {
|
|
21
|
+
NotificationCenter.default.post(
|
|
22
|
+
name: Notification.Name("popToNative"),
|
|
23
|
+
object: nil,
|
|
24
|
+
userInfo: ["animated": animated]
|
|
25
|
+
)
|
|
19
26
|
}
|
|
27
|
+
}
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
@JS
|
|
30
|
+
func setNativeBackEnabled(_ enabled: Bool) {
|
|
31
|
+
DispatchQueue.main.async {
|
|
32
|
+
NotificationCenter.default.post(
|
|
33
|
+
name: Notification.Name("setNativeBackEnabled"),
|
|
34
|
+
object: nil,
|
|
35
|
+
userInfo: ["enabled": enabled]
|
|
36
|
+
)
|
|
29
37
|
}
|
|
38
|
+
}
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
@JS
|
|
41
|
+
func sendMessage(_ message: borrowing JavaScriptValue) throws {
|
|
42
|
+
let object = try message.asObject()
|
|
43
|
+
var result: BrownfieldMessage = [:]
|
|
44
|
+
|
|
45
|
+
// Same conversion as the `[String: Any?]` DSL argument: `undefined` properties are dropped
|
|
46
|
+
// and `null` ones are kept as `nil`.
|
|
47
|
+
for key in object.getPropertyNames() {
|
|
48
|
+
let property = object.getProperty(key)
|
|
49
|
+
if property.isUndefined() {
|
|
50
|
+
continue
|
|
38
51
|
}
|
|
52
|
+
result.updateValue(property.isNull() ? nil : property.getAny(), forKey: key)
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
Function("sendMessage") { (message: BrownfieldMessage) in
|
|
42
|
-
BrownfieldMessagingInternal.shared.emit(message)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public func sendMessage(_ message: BrownfieldMessage) {
|
|
47
|
-
sendEvent(NATIVE_MESSAGE_EVENT_NAME, message)
|
|
54
|
+
BrownfieldMessagingInternal.shared.emit(result)
|
|
48
55
|
}
|
|
49
56
|
}
|
|
@@ -1,47 +1,27 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
|
|
3
|
-
let KEY_RECREATED_EVENT_NAME = "onKeyRecreated"
|
|
4
|
-
|
|
5
3
|
// MARK: - ExpoBrownfieldStateModule
|
|
6
4
|
|
|
5
|
+
@ExpoModule(classes: [SharedState.self])
|
|
7
6
|
public class ExpoBrownfieldStateModule: Module {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Events(KEY_RECREATED_EVENT_NAME)
|
|
12
|
-
|
|
13
|
-
Class(SharedState.self) {
|
|
14
|
-
Constructor { (key: String) in
|
|
15
|
-
return SharedState(key)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Function("get") { (state: SharedState) -> Any? in
|
|
19
|
-
return state.get()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Function("set") { (state: SharedState, value: JavaScriptValue?) in
|
|
23
|
-
state.set(value?.getAny())
|
|
24
|
-
}
|
|
25
|
-
}
|
|
7
|
+
@Event("onKeyRecreated")
|
|
8
|
+
var onKeyRecreated: ([String: String]) -> Void
|
|
26
9
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
OnDestroy {
|
|
32
|
-
BrownfieldStateInternal.shared.clearExpoModule(self)
|
|
33
|
-
}
|
|
10
|
+
public override func didCreate() {
|
|
11
|
+
BrownfieldStateInternal.shared.setExpoModule(self)
|
|
12
|
+
}
|
|
34
13
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
public override func willDestroy() {
|
|
15
|
+
BrownfieldStateInternal.shared.clearExpoModule(self)
|
|
16
|
+
}
|
|
38
17
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
@JS
|
|
19
|
+
func getSharedState(_ key: String) -> SharedState {
|
|
20
|
+
return BrownfieldStateInternal.shared.getOrCreate(key)
|
|
42
21
|
}
|
|
43
22
|
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
@JS
|
|
24
|
+
func deleteSharedState(_ key: String) {
|
|
25
|
+
_ = BrownfieldStateInternal.shared.delete(key)
|
|
46
26
|
}
|
|
47
27
|
}
|
package/ios/Messaging.swift
CHANGED
package/ios/SharedState.swift
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
|
|
3
|
+
@SharedObject
|
|
3
4
|
public final class SharedState: SharedObject {
|
|
4
5
|
private let lock = NSLock()
|
|
5
6
|
private let key: String
|
|
6
7
|
private var value: Any?
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
@JS
|
|
10
|
+
nonisolated public init(_ key: String) {
|
|
9
11
|
self.key = key
|
|
10
12
|
super.init()
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
@JS
|
|
16
|
+
nonisolated public func get() -> Any? {
|
|
14
17
|
lock.lock()
|
|
15
18
|
defer { lock.unlock() }
|
|
16
19
|
return value
|
|
@@ -25,4 +28,9 @@ public final class SharedState: SharedObject {
|
|
|
25
28
|
BrownfieldStateInternal.shared.notifySubscribers(key, newValue)
|
|
26
29
|
BrownfieldStateInternal.shared.maybeNotifyKeyRecreated(key)
|
|
27
30
|
}
|
|
31
|
+
|
|
32
|
+
@JS
|
|
33
|
+
func set(fromJS value: borrowing JavaScriptValue) {
|
|
34
|
+
set(value.isUndefined() || value.isNull() ? nil : value.getAny())
|
|
35
|
+
}
|
|
28
36
|
}
|
package/ios/State.swift
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-brownfield",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.13",
|
|
4
4
|
"description": "Toolkit and APIs for adding brownfield setup to Expo projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"brownfield",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"./plugin": "./plugin/build/index.js"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expo/env": "~2.5.
|
|
41
|
+
"@expo/env": "~2.5.2",
|
|
42
42
|
"@expo/spawn-async": "^1.8.0",
|
|
43
43
|
"chalk": "^4.1.2",
|
|
44
44
|
"commander": "^14.0.3",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@bacons/xcode": "1.0.0-alpha.29",
|
|
53
|
+
"@expo/internal-scripts": "58.0.1",
|
|
53
54
|
"@types/diff": "^5.2.0",
|
|
54
55
|
"@types/jest": "^30.0.0",
|
|
55
56
|
"@types/node": "^22.14.0",
|
|
56
57
|
"@types/prompts": "^2.0.6",
|
|
57
58
|
"@types/react": "~19.3.0",
|
|
58
59
|
"create-expo": "5.1.4",
|
|
59
|
-
"expo": "58.0.
|
|
60
|
-
"expo-module-scripts": "56.0.6",
|
|
60
|
+
"expo": "58.0.8",
|
|
61
61
|
"glob": "^13.0.6"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
Binary file
|
|
Binary file
|