expo 58.0.26 → 58.1.0
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/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/fetch/ExpoFetchModule.kt +14 -2
- package/android/src/main/java/expo/modules/fetch/NativeResponse.kt +15 -0
- package/android/src/test/java/expo/modules/fetch/NativeResponseTest.kt +256 -0
- package/build/async-require/asyncRequireModule.js +0 -2
- package/build/async-require/asyncRequireModule.js.map +1 -1
- package/build/winter/fetch/FetchResponse.d.ts +1 -0
- package/build/winter/fetch/FetchResponse.js +9 -8
- package/build/winter/fetch/FetchResponse.js.map +1 -1
- package/bundledNativeModules.json +23 -23
- package/ios/Expo/Fetch/ExpoFetchModule.swift +2 -2
- package/ios/Expo/Fetch/NativeResponse.swift +7 -1
- package/ios/Tests/NativeResponseTests.swift +171 -0
- package/package.json +11 -11
- package/scripts/spm/README.md +11 -9
- package/scripts/spm/__tests__/direct.test.js +117 -12
- package/scripts/spm/__tests__/plugin.test.js +179 -8
- package/scripts/spm/__tests__/real-manifests.test.js +3 -3
- package/scripts/spm/direct.js +132 -81
- package/scripts/spm/plugin.js +64 -31
- package/src/async-require/asyncRequireModule.ts +0 -2
- package/src/winter/fetch/FetchResponse.ts +10 -8
- package/src/winter/fetch/__tests__/FetchResponse-test.ts +19 -4
- package/template.tgz +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import Foundation
|
|
4
|
+
import Testing
|
|
5
|
+
|
|
6
|
+
@testable import Expo
|
|
7
|
+
|
|
8
|
+
@Suite("NativeResponse")
|
|
9
|
+
struct NativeResponseTests {
|
|
10
|
+
/**
|
|
11
|
+
Drives the response state machine the way `ExpoURLSessionTask` does and drains the
|
|
12
|
+
serial queue that every delegate callback hops onto.
|
|
13
|
+
*/
|
|
14
|
+
private final class Harness {
|
|
15
|
+
let queue = DispatchQueue(label: "expo.modules.fetch.tests.RequestQueue")
|
|
16
|
+
let response: NativeResponse
|
|
17
|
+
let session: ExpoURLSessionTask
|
|
18
|
+
let task: URLSessionTask
|
|
19
|
+
|
|
20
|
+
init() {
|
|
21
|
+
response = NativeResponse(dispatchQueue: queue)
|
|
22
|
+
session = ExpoURLSessionTask(delegate: response)
|
|
23
|
+
// Never resumed, so no request is made. `handleDidCompleteWithError` only reads
|
|
24
|
+
// `currentRequest` on the missing-local-file path, which these tests do not take.
|
|
25
|
+
task = URLSession.shared.dataTask(with: URL(string: "https://example.test/")!)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
func receiveResponse() {
|
|
29
|
+
response.urlSessionDidStart(session)
|
|
30
|
+
response.urlSession(
|
|
31
|
+
session,
|
|
32
|
+
didReceive: HTTPURLResponse(
|
|
33
|
+
url: URL(string: "https://example.test/")!,
|
|
34
|
+
statusCode: 200,
|
|
35
|
+
httpVersion: "HTTP/1.1",
|
|
36
|
+
headerFields: ["Transfer-Encoding": "chunked"]
|
|
37
|
+
)!
|
|
38
|
+
)
|
|
39
|
+
drain()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
func receive(_ data: Data) {
|
|
43
|
+
response.urlSession(session, didReceive: data)
|
|
44
|
+
drain()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
func complete(with error: (any Error)?) {
|
|
48
|
+
response.urlSession(session, task: task, didCompleteWithError: error)
|
|
49
|
+
drain()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
func startStreaming() throws -> Data? {
|
|
53
|
+
return try queue.sync { try response.startStreaming() }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func cancel() {
|
|
57
|
+
response.emitRequestCanceled()
|
|
58
|
+
drain()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func redirect(mode: NativeRequestRedirect) {
|
|
62
|
+
response.redirectMode = mode
|
|
63
|
+
response.urlSession(
|
|
64
|
+
session,
|
|
65
|
+
task: task,
|
|
66
|
+
willPerformHTTPRedirection: HTTPURLResponse(
|
|
67
|
+
url: URL(string: "https://example.test/")!,
|
|
68
|
+
statusCode: 302,
|
|
69
|
+
httpVersion: "HTTP/1.1",
|
|
70
|
+
headerFields: ["Location": "https://example.test/moved"]
|
|
71
|
+
)!,
|
|
72
|
+
newRequest: URLRequest(url: URL(string: "https://example.test/moved")!),
|
|
73
|
+
completionHandler: { _ in }
|
|
74
|
+
)
|
|
75
|
+
drain()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private func drain() {
|
|
79
|
+
queue.sync {}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Test
|
|
84
|
+
func `startStreaming throws when the request failed before the body was read`() {
|
|
85
|
+
// The request promise resolves as soon as headers land, so JS can hold a response
|
|
86
|
+
// whose transport dies before anything reads `response.body`. `didFailWithError` is
|
|
87
|
+
// emitted only from `.bodyStreamingStarted`, so nothing reaches the JS stream and
|
|
88
|
+
// `startStreaming` has to be the one to report the failure.
|
|
89
|
+
let harness = Harness()
|
|
90
|
+
harness.receiveResponse()
|
|
91
|
+
harness.complete(with: URLError(.networkConnectionLost))
|
|
92
|
+
|
|
93
|
+
#expect(harness.response.state == .errorReceived)
|
|
94
|
+
|
|
95
|
+
let error = #expect(throws: URLError.self) {
|
|
96
|
+
_ = try harness.startStreaming()
|
|
97
|
+
}
|
|
98
|
+
#expect(error?.code == .networkConnectionLost)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Test
|
|
102
|
+
func `startStreaming rethrows a truncated chunked body error`() {
|
|
103
|
+
let harness = Harness()
|
|
104
|
+
harness.receiveResponse()
|
|
105
|
+
harness.receive(Data("hello".utf8))
|
|
106
|
+
harness.complete(with: URLError(.cannotParseResponse))
|
|
107
|
+
|
|
108
|
+
let error = #expect(throws: URLError.self) {
|
|
109
|
+
_ = try harness.startStreaming()
|
|
110
|
+
}
|
|
111
|
+
#expect(error?.code == .cannotParseResponse)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Test
|
|
115
|
+
func `startStreaming still returns the buffered body when the request succeeded`() throws {
|
|
116
|
+
let harness = Harness()
|
|
117
|
+
harness.receiveResponse()
|
|
118
|
+
harness.receive(Data("hello world".utf8))
|
|
119
|
+
harness.complete(with: nil)
|
|
120
|
+
|
|
121
|
+
#expect(harness.response.state == .bodyCompleted)
|
|
122
|
+
#expect(try harness.startStreaming() == Data("hello world".utf8))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@Test
|
|
126
|
+
func `startStreaming still opens the stream while the body is in flight`() throws {
|
|
127
|
+
let harness = Harness()
|
|
128
|
+
harness.receiveResponse()
|
|
129
|
+
|
|
130
|
+
#expect(try harness.startStreaming() == nil)
|
|
131
|
+
#expect(harness.response.state == .bodyStreamingStarted)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Test
|
|
135
|
+
func `startStreaming throws after the request was canceled before the body was read`() {
|
|
136
|
+
// `emitRequestCanceled` reaches `.errorReceived` through the same gate: it emits
|
|
137
|
+
// `didFailWithError` only from `.bodyStreamingStarted`, so a cancel landing before
|
|
138
|
+
// the body is read leaves the stream with nothing to settle it either.
|
|
139
|
+
let harness = Harness()
|
|
140
|
+
harness.receiveResponse()
|
|
141
|
+
harness.cancel()
|
|
142
|
+
|
|
143
|
+
#expect(harness.response.state == .errorReceived)
|
|
144
|
+
#expect(throws: FetchRequestCanceledException.self) {
|
|
145
|
+
_ = try harness.startStreaming()
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@Test
|
|
150
|
+
func `startStreaming throws when a redirect was rejected before the body was read`() {
|
|
151
|
+
// Same gate again, via `redirect: "error"`.
|
|
152
|
+
let harness = Harness()
|
|
153
|
+
harness.receiveResponse()
|
|
154
|
+
harness.redirect(mode: .error)
|
|
155
|
+
|
|
156
|
+
#expect(harness.response.state == .errorReceived)
|
|
157
|
+
#expect(throws: FetchRedirectException.self) {
|
|
158
|
+
_ = try harness.startStreaming()
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@Test
|
|
163
|
+
func `a followed redirect still streams normally`() throws {
|
|
164
|
+
let harness = Harness()
|
|
165
|
+
harness.receiveResponse()
|
|
166
|
+
harness.redirect(mode: .follow)
|
|
167
|
+
|
|
168
|
+
#expect(harness.response.state == .responseReceived)
|
|
169
|
+
#expect(try harness.startStreaming() == nil)
|
|
170
|
+
}
|
|
171
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo",
|
|
3
|
-
"version": "58.0
|
|
3
|
+
"version": "58.1.0",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo"
|
|
@@ -212,27 +212,27 @@
|
|
|
212
212
|
},
|
|
213
213
|
"dependencies": {
|
|
214
214
|
"@babel/runtime": "^7.20.0",
|
|
215
|
-
"@expo/cli": "^58.1.
|
|
216
|
-
"@expo/config": "~58.0.
|
|
217
|
-
"@expo/config-plugins": "~58.0.
|
|
215
|
+
"@expo/cli": "^58.1.22",
|
|
216
|
+
"@expo/config": "~58.0.13",
|
|
217
|
+
"@expo/config-plugins": "~58.0.14",
|
|
218
218
|
"@expo/devtools": "~58.0.2",
|
|
219
219
|
"@expo/dom-webview": "~58.0.2",
|
|
220
|
-
"@expo/fingerprint": "^0.
|
|
221
|
-
"@expo/local-build-cache-provider": "^58.0.
|
|
220
|
+
"@expo/fingerprint": "^0.22.0",
|
|
221
|
+
"@expo/local-build-cache-provider": "^58.0.13",
|
|
222
222
|
"@expo/log-box": "^58.0.15",
|
|
223
223
|
"@expo/log-box-utils": "^58.0.2",
|
|
224
224
|
"@expo/metro": "~58.0.0",
|
|
225
|
-
"@expo/metro-config": "~58.0.
|
|
225
|
+
"@expo/metro-config": "~58.0.24",
|
|
226
226
|
"@ungap/structured-clone": "^1.3.0",
|
|
227
|
-
"babel-preset-expo": "~58.0.
|
|
227
|
+
"babel-preset-expo": "~58.0.27",
|
|
228
228
|
"expo-asset": "~58.0.21",
|
|
229
229
|
"expo-constants": "~58.0.16",
|
|
230
|
-
"expo-file-system": "~58.0.
|
|
230
|
+
"expo-file-system": "~58.0.15",
|
|
231
231
|
"expo-font": "~58.0.12",
|
|
232
232
|
"expo-keep-awake": "~58.0.4",
|
|
233
233
|
"expo-modules-autolinking": "~58.1.0",
|
|
234
234
|
"expo-modules-cli": "~0.5.0",
|
|
235
|
-
"expo-modules-core": "~58.
|
|
235
|
+
"expo-modules-core": "~58.2.0",
|
|
236
236
|
"pretty-format": "^29.7.0",
|
|
237
237
|
"react-refresh": "^0.14.2",
|
|
238
238
|
"whatwg-url-minimum": "^0.2.0"
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"@expo/metro-runtime": "58.0.17",
|
|
242
242
|
"@types/node": "^22.14.0",
|
|
243
243
|
"@types/react": "~19.3.0",
|
|
244
|
-
"expo-updates": "58.0.
|
|
244
|
+
"expo-updates": "58.0.23",
|
|
245
245
|
"npm-run-all2": "^8.0.4",
|
|
246
246
|
"react": "19.3.0",
|
|
247
247
|
"react-dom": "19.3.0",
|
package/scripts/spm/README.md
CHANGED
|
@@ -90,19 +90,21 @@ The plugin decides each module in this order:
|
|
|
90
90
|
1. When a precompiled artifact exists, the module is linked precompiled, unless
|
|
91
91
|
the app lists it in `buildFromSource`.
|
|
92
92
|
2. Otherwise, when its `Package.swift` depends on the `ExpoModulesCoreHeaders`
|
|
93
|
-
product, the plugin builds it from that
|
|
94
|
-
compiles against the `ExpoModulesCoreHeaders`
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
or the `ExpoModulesWorkletsHeaders` product, the plugin builds it from that
|
|
94
|
+
manifest as it stands. The manifest compiles against the `ExpoModulesCoreHeaders`
|
|
95
|
+
and `ExpoModulesJSIHeaders` xcframeworks, and against
|
|
96
|
+
`ExpoModulesWorkletsHeaders` when it depends on it. `ExpoModulesCoreHeaders`
|
|
97
|
+
depends on the `expo-modules-macros` package, so SwiftPM builds the Expo macro
|
|
98
|
+
plugin and loads it into the module with no compiler flags in its manifest.
|
|
99
|
+
`ExpoModulesCoreHeaders` also depends on React Native's header products, so a
|
|
100
|
+
module that imports React gets them through it and does not name React Native
|
|
101
|
+
in its manifest.
|
|
100
102
|
3. Otherwise its `Package.swift` is mirrored into a generated package, or a
|
|
101
103
|
pure-Swift module gets a generated package over its sources.
|
|
102
104
|
|
|
103
105
|
A manifest built as it stands is linked at `<outDir>/direct/<npm package name>`,
|
|
104
|
-
a symlink to the module root, next to the
|
|
105
|
-
|
|
106
|
+
a symlink to the module root, next to the headers packages the plugin emits in
|
|
107
|
+
`direct/`. Link names are not flattened, so a scoped package
|
|
106
108
|
lands at `direct/@scope/pkg`. SwiftPM resolves the manifest's relative paths
|
|
107
109
|
from the link, not from the module's real directory, so the path to the headers
|
|
108
110
|
package depends on that depth: `../ExpoModulesCoreHeaders` for an unscoped
|
|
@@ -11,7 +11,7 @@ jest.mock('../cli', () => ({
|
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
13
|
const { runDumpPackage } = require('../cli');
|
|
14
|
-
const {
|
|
14
|
+
const { dumpModuleManifest, emitDirectPackage, headersStandInsOf } = require('../direct');
|
|
15
15
|
const { rerunSpmUpdate, thrownBy } = require('./helpers');
|
|
16
16
|
|
|
17
17
|
const hapticsManifest = {
|
|
@@ -26,23 +26,23 @@ const manifestDependingOn = (...dependencies) => ({
|
|
|
26
26
|
targets: [{ name: 'ExpoHaptics', type: 'regular', dependencies }],
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
describe('
|
|
29
|
+
describe('headersStandInsOf', () => {
|
|
30
30
|
// Verbatim shape from `swift package dump-package` (Swift 6.4) of a manifest with
|
|
31
31
|
// `.product(name: "ExpoModulesCoreHeaders", package: "ExpoModulesCoreHeaders")`.
|
|
32
32
|
const coreHeadersProduct = {
|
|
33
33
|
product: ['ExpoModulesCoreHeaders', 'ExpoModulesCoreHeaders', null, null],
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
it('is
|
|
36
|
+
it('is ExpoModulesCoreHeaders when a target depends on the ExpoModulesCoreHeaders product', () => {
|
|
37
37
|
expect(
|
|
38
|
-
|
|
38
|
+
headersStandInsOf({
|
|
39
39
|
...manifestDependingOn(),
|
|
40
40
|
targets: [
|
|
41
41
|
{ name: 'ExpoHapticsObjC', type: 'regular', dependencies: [] },
|
|
42
42
|
{ name: 'ExpoHaptics', type: 'regular', dependencies: [coreHeadersProduct] },
|
|
43
43
|
],
|
|
44
44
|
})
|
|
45
|
-
).
|
|
45
|
+
).toEqual(['ExpoModulesCoreHeaders']);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// `.byName(name:)` and a bare string both dump as `byName`; SwiftPM resolves the name to
|
|
@@ -50,8 +50,8 @@ describe('dependsOnCoreHeaders', () => {
|
|
|
50
50
|
it.each([
|
|
51
51
|
['without a condition', { byName: ['ExpoModulesCoreHeaders', null] }],
|
|
52
52
|
['with a condition', { byName: ['ExpoModulesCoreHeaders', { platformNames: ['ios'] }] }],
|
|
53
|
-
])('is
|
|
54
|
-
expect(
|
|
53
|
+
])('is ExpoModulesCoreHeaders for a dependency by name %s', (_, dependency) => {
|
|
54
|
+
expect(headersStandInsOf(manifestDependingOn(dependency))).toEqual(['ExpoModulesCoreHeaders']);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it.each([
|
|
@@ -70,8 +70,51 @@ describe('dependsOnCoreHeaders', () => {
|
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
['no targets', { name: 'expo-haptics', products: [] }],
|
|
73
|
-
])('is
|
|
74
|
-
expect(
|
|
73
|
+
])('is empty for a manifest with %s', (_, manifest) => {
|
|
74
|
+
expect(headersStandInsOf(manifest)).toEqual([]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it.each([
|
|
78
|
+
[
|
|
79
|
+
'product',
|
|
80
|
+
{ product: ['ExpoModulesWorkletsHeaders', 'ExpoModulesWorkletsHeaders', null, null] },
|
|
81
|
+
],
|
|
82
|
+
['name', { byName: ['ExpoModulesWorkletsHeaders', null] }],
|
|
83
|
+
])(
|
|
84
|
+
'is both headers packages for a %s dependency on ExpoModulesWorkletsHeaders alone',
|
|
85
|
+
(_, dependency) => {
|
|
86
|
+
expect(headersStandInsOf(manifestDependingOn(dependency))).toEqual([
|
|
87
|
+
'ExpoModulesCoreHeaders',
|
|
88
|
+
'ExpoModulesWorkletsHeaders',
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
it('is empty for a dependency by name that a target of the manifest has', () => {
|
|
94
|
+
expect(
|
|
95
|
+
headersStandInsOf({
|
|
96
|
+
...manifestDependingOn(),
|
|
97
|
+
targets: [
|
|
98
|
+
{
|
|
99
|
+
name: 'ExpoHaptics',
|
|
100
|
+
type: 'regular',
|
|
101
|
+
dependencies: [{ byName: ['ExpoModulesCoreHeaders', null] }],
|
|
102
|
+
},
|
|
103
|
+
{ name: 'ExpoModulesCoreHeaders', type: 'regular', dependencies: [] },
|
|
104
|
+
],
|
|
105
|
+
})
|
|
106
|
+
).toEqual([]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('names each headers package once when targets depend on both', () => {
|
|
110
|
+
expect(
|
|
111
|
+
headersStandInsOf(
|
|
112
|
+
manifestDependingOn(
|
|
113
|
+
{ byName: ['ExpoModulesWorkletsHeaders', null] },
|
|
114
|
+
{ product: ['ExpoModulesCoreHeaders', 'ExpoModulesCoreHeaders', null, null] }
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
).toEqual(['ExpoModulesCoreHeaders', 'ExpoModulesWorkletsHeaders']);
|
|
75
118
|
});
|
|
76
119
|
});
|
|
77
120
|
|
|
@@ -139,7 +182,7 @@ describe('emitDirectPackage', () => {
|
|
|
139
182
|
moduleRoot: path.join(root, 'expo-haptics'),
|
|
140
183
|
packageName: 'expo-haptics',
|
|
141
184
|
outDir,
|
|
142
|
-
coreHeadersXCFramework,
|
|
185
|
+
headersXCFrameworks: { ExpoModulesCoreHeaders: coreHeadersXCFramework },
|
|
143
186
|
jsiHeadersPkgPath,
|
|
144
187
|
macrosPackageRoot,
|
|
145
188
|
react,
|
|
@@ -326,7 +369,7 @@ describe('emitDirectPackage', () => {
|
|
|
326
369
|
moduleRoot,
|
|
327
370
|
packageName: '@acme/widgets',
|
|
328
371
|
outDir,
|
|
329
|
-
coreHeadersXCFramework,
|
|
372
|
+
headersXCFrameworks: { ExpoModulesCoreHeaders: coreHeadersXCFramework },
|
|
330
373
|
jsiHeadersPkgPath,
|
|
331
374
|
macrosPackageRoot,
|
|
332
375
|
manifest: hapticsManifest,
|
|
@@ -345,7 +388,7 @@ describe('emitDirectPackage', () => {
|
|
|
345
388
|
moduleRoot: path.join(root, 'expo-haptics'),
|
|
346
389
|
packageName: 'expo-haptics',
|
|
347
390
|
outDir,
|
|
348
|
-
coreHeadersXCFramework,
|
|
391
|
+
headersXCFrameworks: { ExpoModulesCoreHeaders: coreHeadersXCFramework },
|
|
349
392
|
jsiHeadersPkgPath,
|
|
350
393
|
macrosPackageRoot,
|
|
351
394
|
manifest: { ...hapticsManifest, name: 'ExpoHapticsPackage' },
|
|
@@ -367,6 +410,68 @@ describe('emitDirectPackage', () => {
|
|
|
367
410
|
]);
|
|
368
411
|
});
|
|
369
412
|
|
|
413
|
+
describe('with the ExpoModulesWorklets headers', () => {
|
|
414
|
+
let workletsHeadersXCFramework;
|
|
415
|
+
let workletsPkgDir;
|
|
416
|
+
const workletsManifest = () =>
|
|
417
|
+
fs.readFileSync(path.join(workletsPkgDir, 'Package.swift'), 'utf8');
|
|
418
|
+
|
|
419
|
+
beforeEach(() => {
|
|
420
|
+
workletsPkgDir = path.join(outDir, 'direct', 'ExpoModulesWorkletsHeaders');
|
|
421
|
+
workletsHeadersXCFramework = path.join(
|
|
422
|
+
root,
|
|
423
|
+
'expo-modules-core',
|
|
424
|
+
'headers',
|
|
425
|
+
'ExpoModulesWorkletsHeaders.xcframework'
|
|
426
|
+
);
|
|
427
|
+
fs.mkdirSync(workletsHeadersXCFramework, { recursive: true });
|
|
428
|
+
emitDirectPackage({
|
|
429
|
+
moduleRoot: path.join(root, 'expo-haptics'),
|
|
430
|
+
packageName: 'expo-haptics',
|
|
431
|
+
outDir,
|
|
432
|
+
headersXCFrameworks: {
|
|
433
|
+
ExpoModulesCoreHeaders: coreHeadersXCFramework,
|
|
434
|
+
ExpoModulesWorkletsHeaders: workletsHeadersXCFramework,
|
|
435
|
+
},
|
|
436
|
+
jsiHeadersPkgPath,
|
|
437
|
+
macrosPackageRoot,
|
|
438
|
+
manifest: hapticsManifest,
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it('declares one product over the ExpoModulesWorklets headers binary target', () => {
|
|
443
|
+
expect(workletsManifest().match(/\.binaryTarget\(/g)).toHaveLength(1);
|
|
444
|
+
expect(workletsManifest()).toContain(
|
|
445
|
+
'.binaryTarget(name: "ExpoModulesWorkletsHeaders", path: "ExpoModulesWorkletsHeaders.xcframework")'
|
|
446
|
+
);
|
|
447
|
+
expect(workletsManifest()).toMatch(
|
|
448
|
+
/\.library\(name: "ExpoModulesWorkletsHeaders", targets: \["ExpoModulesWorkletsHeaders"/
|
|
449
|
+
);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('places the ExpoModulesWorklets headers xcframework in the package by link', () => {
|
|
453
|
+
const link = path.join(workletsPkgDir, 'ExpoModulesWorkletsHeaders.xcframework');
|
|
454
|
+
expect(fs.lstatSync(link).isSymbolicLink()).toBe(true);
|
|
455
|
+
expect(fs.realpathSync(link)).toBe(fs.realpathSync(workletsHeadersXCFramework));
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
it('depends on the ExpoModulesCore headers package beside it, and on nothing else', () => {
|
|
459
|
+
expect(workletsManifest()).toContain(
|
|
460
|
+
'.package(name: "ExpoModulesCoreHeaders", path: "../ExpoModulesCoreHeaders")'
|
|
461
|
+
);
|
|
462
|
+
expect(workletsManifest()).toMatch(
|
|
463
|
+
/\.target\(\s*name: "ExpoModulesWorkletsHeadersDependencies",\s*dependencies: \[\s*\.product\(name: "ExpoModulesCoreHeaders", package: "ExpoModulesCoreHeaders"\),\s*\]/
|
|
464
|
+
);
|
|
465
|
+
expect(workletsManifest().match(/\.package\(/g)).toHaveLength(1);
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
it('also writes the ExpoModulesCore headers package', () => {
|
|
469
|
+
expect(manifest()).toContain(
|
|
470
|
+
'.binaryTarget(name: "ExpoModulesCoreHeaders", path: "ExpoModulesCoreHeaders.xcframework")'
|
|
471
|
+
);
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
|
|
370
475
|
it('changes no file in the package when emitted again with the same inputs', () => {
|
|
371
476
|
emit();
|
|
372
477
|
const snapshot = () =>
|