expo-modules-jsi 56.0.9 → 56.0.11
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
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.11 — 2026-07-03
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [iOS] Preserve the `code` on the JavaScript error when an async function rejects with a `JavaScriptThrowable` (e.g. an `Exception`), instead of stringifying it and dropping the `code` — mirroring the synchronous throw path. ([#47453](https://github.com/expo/expo/pull/47453) by [@HubertBer](https://github.com/HubertBer))
|
|
18
|
+
|
|
19
|
+
## 56.0.10 — 2026-06-15
|
|
20
|
+
|
|
21
|
+
### 🐛 Bug fixes
|
|
22
|
+
|
|
23
|
+
- [iOS] Ignore already-settled promises. ([#46765](https://github.com/expo/expo/pull/46765) by [@jakex7](https://github.com/jakex7))
|
|
24
|
+
|
|
13
25
|
## 56.0.9 — 2026-06-10
|
|
14
26
|
|
|
15
27
|
### 🎉 New features
|
|
@@ -75,15 +75,16 @@ public struct JavaScriptPromise: JavaScriptType, ~Copyable {
|
|
|
75
75
|
guard let runtime else {
|
|
76
76
|
return
|
|
77
77
|
}
|
|
78
|
-
guard !resolveFunction.isEmpty else {
|
|
79
|
-
preconditionFailure("Cannot settle a promise more than once")
|
|
80
|
-
}
|
|
81
78
|
|
|
82
79
|
// `resolve` is not isolated, so make sure to jump to JS thread.
|
|
83
80
|
runtime.schedule(priority: .immediate) { [resolveFunction, rejectFunction] in
|
|
81
|
+
// If the promise is already settled, do nothing.
|
|
82
|
+
guard let resolver = resolveFunction.take() else {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
84
85
|
// Call the actual resolver given in the Promise setup.
|
|
85
86
|
// This will also call `deferredPromise.resolve` in the `then` handler.
|
|
86
|
-
_ = try!
|
|
87
|
+
_ = try! resolver.getFunction().call(arguments: value)
|
|
87
88
|
|
|
88
89
|
// Release the rejecter, we cannot call it anymore.
|
|
89
90
|
rejectFunction.release()
|
|
@@ -94,19 +95,24 @@ public struct JavaScriptPromise: JavaScriptType, ~Copyable {
|
|
|
94
95
|
guard let runtime else {
|
|
95
96
|
return
|
|
96
97
|
}
|
|
97
|
-
guard !rejectFunction.isEmpty else {
|
|
98
|
-
preconditionFailure("Cannot settle a promise more than once")
|
|
99
|
-
}
|
|
100
98
|
|
|
101
99
|
// `reject` is not isolated, so make sure to jump to JS thread.
|
|
102
100
|
runtime.schedule(priority: .immediate) { [resolveFunction, rejectFunction] in
|
|
103
|
-
//
|
|
104
|
-
let
|
|
105
|
-
|
|
101
|
+
// If the promise is already settled, do nothing.
|
|
102
|
+
guard let rejecter = rejectFunction.take() else {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let errorValue: JavaScriptValue
|
|
107
|
+
if let throwable = error as? JavaScriptThrowable {
|
|
108
|
+
errorValue = JavaScriptError(runtime, from: throwable).asValue()
|
|
109
|
+
} else {
|
|
110
|
+
errorValue = JavaScriptError(runtime, message: String(describing: error)).asValue()
|
|
111
|
+
}
|
|
106
112
|
|
|
107
113
|
// Call the actual rejecter given in the Promise setup.
|
|
108
114
|
// This will also call `deferredPromise.reject` in the `then` handler.
|
|
109
|
-
_ = try!
|
|
115
|
+
_ = try! rejecter.getFunction().call(arguments: errorValue)
|
|
110
116
|
|
|
111
117
|
// Release the resolver, we cannot call it anymore.
|
|
112
118
|
resolveFunction.release()
|
|
@@ -279,6 +279,23 @@ struct JavaScriptPromiseTests {
|
|
|
279
279
|
#expect(result.getInt() == 99)
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
@Test
|
|
283
|
+
func `settling promise more than once is ignored`() async throws {
|
|
284
|
+
struct TestError: Error, Sendable {}
|
|
285
|
+
|
|
286
|
+
let runtime = JavaScriptRuntime()
|
|
287
|
+
let promise = try JavaScriptPromise(runtime)
|
|
288
|
+
|
|
289
|
+
runtime.global().setProperty("testPromise", value: promise.asValue())
|
|
290
|
+
promise.resolve(42)
|
|
291
|
+
promise.reject(TestError())
|
|
292
|
+
promise.resolve(100)
|
|
293
|
+
|
|
294
|
+
let result = try await promise.await()
|
|
295
|
+
|
|
296
|
+
#expect(result.getInt() == 42)
|
|
297
|
+
}
|
|
298
|
+
|
|
282
299
|
@Test
|
|
283
300
|
func `promise all`() async throws {
|
|
284
301
|
let runtime = JavaScriptRuntime()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-jsi",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.11",
|
|
4
4
|
"description": "The JavaScript Interface for Expo Modules",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": [],
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./apple/scripts/test.sh"
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b2e161a54f90a778ab7e5560c0c8f021bbfcaae2",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "apple/scripts/build-xcframework.sh",
|
|
47
47
|
"swift:format": "../../scripts/swift-format.sh",
|