peachsim 0.1.2480 → 0.1.2481
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/cli/agent-note.ts +50 -21
- package/cli/commands/stream.ts +33 -12
- package/detox/index.ts +5 -4
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +3147 -3025
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-RHJLDFQ6.mjs → acorn-FYDDLFH7.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-LIULVSRG.mjs → chunk-3AHKFCTP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LNLVUOIL.mjs → chunk-55FEZERB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IMJ6FVRR.mjs → chunk-56VSEMVW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5VNECNVL.mjs → chunk-6ALMBFOB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QWPRWZCR.mjs → chunk-CIRF7MUH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QNFDJM4V.mjs → chunk-DILJLCVN.mjs} +12 -12
- package/dist-lib/esm-chunks/{chunk-KPDAPPKX.mjs → chunk-DOTVMR2R.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-JW6P2F6T.mjs → chunk-DR66BWZR.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-NZYUWM5K.mjs → chunk-HK2YIUS3.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-K633NA6X.mjs → chunk-I2KV5OCI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IGQJDRVL.mjs → chunk-IKMY4F25.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-43UZGHLJ.mjs → chunk-MTWECGVY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HHXID6CS.mjs → chunk-MYAC4QOH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OW2NZLWH.mjs → chunk-OMWELJZM.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-PB53B3G3.mjs → chunk-RRHGYD5I.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-PPI4PXUE.mjs → chunk-V27M6XEI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AN4RNKME.mjs → chunk-VGOJCWU3.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IAQ6RFFI.mjs → chunk-XVGPPYRC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-X7K3JLJ3.mjs → chunk-YBJYSS46.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-U5UJRFVB.mjs → chunk-YY4T7YSR.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-VYP6I44Y.mjs → chunk-ZNG6GMUS.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-K64IERC5.mjs → metro-layout-parser-EEI7OVUC.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-4B2KGEQL.mjs → swift-package-prebuilt-V5QMDVKG.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-SUCFPPKO.mjs → swift-sdk-app-module-QEWCSQWL.mjs} +13 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-YX5FMNXN.mjs → swift-sdk-image-XH4JSUEA.mjs} +13 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-WFJBSXZG.mjs → swift-sdk-image-producer-HQJ5Z6TE.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +2078 -1952
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +2977 -2852
- package/dist-lib/host/fetch-proxy-handler.cjs +630 -330
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +79 -79
- package/dist-lib/public-origins-lib.json +70 -70
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +7 -7
- package/dist-lib/skills.cjs +3587 -3441
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +5 -5
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/package.json +1 -1
- package/src/canvas-agent-note-delivery.ts +36 -6
- package/src/expo-swift-host.ts +27 -20
- package/src/expo-widgets-bundle.ts +5 -0
- package/src/host/staged-host-files.ts +7 -0
- package/src/native-preparation.ts +139 -3
- package/src/nitro-bundle.ts +17 -20
- package/src/swift-host.ts +13 -0
- package/src/turbo-bundle.ts +2 -1
|
@@ -1,20 +1,156 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
import path from 'node:path'
|
|
1
5
|
import { clearTimeout, setTimeout } from 'node:timers'
|
|
6
|
+
import { setImmediate } from 'node:timers/promises'
|
|
7
|
+
import { workspaceExclusion } from './expo-workspace-exclusion'
|
|
8
|
+
import { readExpoConfigAsync } from './native-firebase-config'
|
|
9
|
+
import {
|
|
10
|
+
resolveActiveRuntimeRoot,
|
|
11
|
+
resolveDevCheckoutRuntimeAssetRoot,
|
|
12
|
+
} from './runtime-assets'
|
|
13
|
+
import { findWorkspaceRoot } from './workspace-root'
|
|
2
14
|
|
|
3
15
|
const setTimeoutNode: (fn: () => void, ms: number) => NodeJS.Timeout = setTimeout
|
|
16
|
+
const OPEN_RECEIPT_MS = 30 * 60 * 1000
|
|
17
|
+
const openRevisions = new Map<string, Promise<string | null>>()
|
|
18
|
+
|
|
19
|
+
function openRevision(app: string, token: string): Promise<string | null> {
|
|
20
|
+
const key = `${app}\0${token}`
|
|
21
|
+
let revision = openRevisions.get(key)
|
|
22
|
+
if (!revision) {
|
|
23
|
+
revision = nativeInputRevision(app).catch(() => null)
|
|
24
|
+
openRevisions.set(key, revision)
|
|
25
|
+
setTimeoutNode(() => openRevisions.delete(key), OPEN_RECEIPT_MS).unref()
|
|
26
|
+
}
|
|
27
|
+
return revision
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function nativeInputRevision(app: string): Promise<string> {
|
|
31
|
+
const root = findWorkspaceRoot(app)
|
|
32
|
+
const [excluded, config] = await Promise.all([
|
|
33
|
+
workspaceExclusion(root),
|
|
34
|
+
readExpoConfigAsync(app),
|
|
35
|
+
])
|
|
36
|
+
const require = createRequire(path.join(app, 'package.json'))
|
|
37
|
+
let widgetsOutput: string | undefined
|
|
38
|
+
try {
|
|
39
|
+
widgetsOutput = path.join(
|
|
40
|
+
path.dirname(require.resolve('expo-widgets/package.json')),
|
|
41
|
+
'bundle',
|
|
42
|
+
'build',
|
|
43
|
+
)
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'MODULE_NOT_FOUND'))
|
|
46
|
+
throw error
|
|
47
|
+
}
|
|
48
|
+
const hash = createHash('sha256')
|
|
49
|
+
hash.update(
|
|
50
|
+
JSON.stringify([
|
|
51
|
+
config,
|
|
52
|
+
resolveActiveRuntimeRoot(),
|
|
53
|
+
resolveDevCheckoutRuntimeAssetRoot(),
|
|
54
|
+
]),
|
|
55
|
+
)
|
|
56
|
+
// use file identities for this bridge's lifetime; artifact digests still name the bytes.
|
|
57
|
+
const visited = new Set<string>()
|
|
58
|
+
const directories: { file: string; installed: boolean }[] = [
|
|
59
|
+
{ file: root, installed: false },
|
|
60
|
+
]
|
|
61
|
+
for (const { file: directory, installed } of directories) {
|
|
62
|
+
if (visited.has(directory)) continue
|
|
63
|
+
visited.add(directory)
|
|
64
|
+
const entries = fs.readdirSync(directory, { withFileTypes: true })
|
|
65
|
+
entries.sort((a, b) => (a.name < b.name ? -1 : Number(a.name !== b.name)))
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
const file = path.join(directory, entry.name)
|
|
68
|
+
const dependency = installed || entry.name === 'node_modules'
|
|
69
|
+
if (file === widgetsOutput || entry.name === '.git') continue
|
|
70
|
+
if (!dependency && excluded(path.relative(root, file), entry.isDirectory()))
|
|
71
|
+
continue
|
|
72
|
+
hash.update(file).update('\0')
|
|
73
|
+
if (entry.isDirectory()) {
|
|
74
|
+
directories.push({ file, installed: dependency })
|
|
75
|
+
continue
|
|
76
|
+
}
|
|
77
|
+
const stat = fs.lstatSync(file)
|
|
78
|
+
hash.update(
|
|
79
|
+
`${stat.dev}:${stat.ino}:${stat.size}:${stat.ctimeMs}:${stat.mtimeMs}\0`,
|
|
80
|
+
)
|
|
81
|
+
if (!entry.isSymbolicLink()) continue
|
|
82
|
+
const target = fs.statSync(file, { throwIfNoEntry: false })
|
|
83
|
+
if (target?.isDirectory()) {
|
|
84
|
+
directories.push({ file: fs.realpathSync(file), installed: dependency })
|
|
85
|
+
} else if (target) {
|
|
86
|
+
hash.update(
|
|
87
|
+
`${target.dev}:${target.ino}:${target.size}:${target.ctimeMs}:${target.mtimeMs}\0`,
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (visited.size % 256 === 0) await setImmediate()
|
|
92
|
+
}
|
|
93
|
+
return hash.digest('hex')
|
|
94
|
+
}
|
|
4
95
|
|
|
5
|
-
// a completed open retains its result for the first tenant request only.
|
|
6
|
-
// reloads make a fresh request so edited native sources are observed.
|
|
7
96
|
export class NativePreparationReceipts<T> {
|
|
97
|
+
private readonly compiling = new Map<
|
|
98
|
+
string,
|
|
99
|
+
{ revision: string | null; result: Promise<T> }
|
|
100
|
+
>()
|
|
101
|
+
private readonly prepared = new Map<
|
|
102
|
+
string,
|
|
103
|
+
{ revision: string; value: T; expiry: NodeJS.Timeout }
|
|
104
|
+
>()
|
|
8
105
|
private readonly receipts = new Map<
|
|
9
106
|
string,
|
|
10
107
|
{ owner: string; value: T; expiry: NodeJS.Timeout }
|
|
11
108
|
>()
|
|
12
109
|
|
|
110
|
+
async prepare(
|
|
111
|
+
owner: string,
|
|
112
|
+
root: string,
|
|
113
|
+
token: string | null,
|
|
114
|
+
compile: () => Promise<T>,
|
|
115
|
+
isAvailable?: (value: T) => boolean,
|
|
116
|
+
): Promise<T> {
|
|
117
|
+
const revision = token && isAvailable ? await openRevision(root, token) : null
|
|
118
|
+
let pending = this.compiling.get(owner)
|
|
119
|
+
while (pending) {
|
|
120
|
+
if (pending.revision === revision) return pending.result
|
|
121
|
+
await pending.result.catch(() => undefined)
|
|
122
|
+
pending = this.compiling.get(owner)
|
|
123
|
+
}
|
|
124
|
+
const prepared = this.prepared.get(owner)
|
|
125
|
+
if (prepared && prepared.revision === revision && isAvailable?.(prepared.value)) {
|
|
126
|
+
prepared.expiry.refresh()
|
|
127
|
+
return prepared.value
|
|
128
|
+
}
|
|
129
|
+
if (prepared) clearTimeout(prepared.expiry)
|
|
130
|
+
this.prepared.delete(owner)
|
|
131
|
+
const result = compile()
|
|
132
|
+
.then((value) => {
|
|
133
|
+
if (revision) {
|
|
134
|
+
const expiry = setTimeoutNode(
|
|
135
|
+
() => this.prepared.delete(owner),
|
|
136
|
+
OPEN_RECEIPT_MS,
|
|
137
|
+
)
|
|
138
|
+
expiry.unref()
|
|
139
|
+
this.prepared.set(owner, { revision, value, expiry })
|
|
140
|
+
}
|
|
141
|
+
return value
|
|
142
|
+
})
|
|
143
|
+
.finally(() => this.compiling.delete(owner))
|
|
144
|
+
this.compiling.set(owner, { revision, result })
|
|
145
|
+
return result
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// each open hands its own response to the first tenant request, including null.
|
|
13
149
|
store(owner: string, token: string | null, value: T): void {
|
|
14
150
|
if (!token) return
|
|
15
151
|
const previous = this.receipts.get(token)
|
|
16
152
|
if (previous) clearTimeout(previous.expiry)
|
|
17
|
-
const expiry = setTimeoutNode(() => this.receipts.delete(token),
|
|
153
|
+
const expiry = setTimeoutNode(() => this.receipts.delete(token), OPEN_RECEIPT_MS)
|
|
18
154
|
expiry.unref()
|
|
19
155
|
this.receipts.set(token, { owner, value, expiry })
|
|
20
156
|
}
|
package/src/nitro-bundle.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { selectCompiledNitroProviders } from './nitro-app-providers'
|
|
12
12
|
import { compileNitroModule } from './nitro-compile'
|
|
13
13
|
import { swiftDistributionRoot } from './swift-distribution'
|
|
14
|
-
import { icuUrl, type SwiftArtifact } from './swift-host'
|
|
14
|
+
import { icuUrl, swiftArtifactIsAvailable, type SwiftArtifact } from './swift-host'
|
|
15
15
|
import { swiftIcuBundleAsset } from './swift-icu'
|
|
16
16
|
import type { NitroBuildConfiguration, NitroCompiledModule } from './nitroContract'
|
|
17
17
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
@@ -144,8 +144,8 @@ export function compiledModuleRequestHandler<Metadata>(
|
|
|
144
144
|
iosTarget: string | undefined,
|
|
145
145
|
params: URLSearchParams,
|
|
146
146
|
) => Promise<{ metadata: Metadata } | null>,
|
|
147
|
+
isAvailable?: (origin: string, metadata: Metadata) => boolean,
|
|
147
148
|
): (req: IncomingMessage, res: ServerResponse) => Promise<void> {
|
|
148
|
-
const compiling = new Map<string, Promise<Metadata | null>>()
|
|
149
149
|
const openPreparations = new NativePreparationReceipts<Metadata | null>()
|
|
150
150
|
return async (req, res) => {
|
|
151
151
|
const url = new URL(req.url ?? '/', 'http://localhost')
|
|
@@ -172,7 +172,9 @@ export function compiledModuleRequestHandler<Metadata>(
|
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
174
|
const iosTarget = url.searchParams.get('iosTarget') ?? undefined
|
|
175
|
-
const
|
|
175
|
+
const app = fs.realpathSync(root)
|
|
176
|
+
const assetOrigin = `http://${host}`
|
|
177
|
+
const key = `${host}\0${app}\0${iosTarget ?? ''}\0${url.searchParams.get('configuration') ?? ''}`
|
|
176
178
|
const prepared = openPreparations.take(
|
|
177
179
|
key,
|
|
178
180
|
url.searchParams.get(NATIVE_PREPARED_QUERY_PARAM),
|
|
@@ -185,25 +187,19 @@ export function compiledModuleRequestHandler<Metadata>(
|
|
|
185
187
|
res.end(JSON.stringify(prepared.value))
|
|
186
188
|
return
|
|
187
189
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
pending = compile(
|
|
191
|
-
fs.realpathSync(root),
|
|
192
|
-
`http://${host}`,
|
|
193
|
-
iosTarget,
|
|
194
|
-
url.searchParams,
|
|
195
|
-
)
|
|
196
|
-
.then((compiled) => compiled?.metadata ?? null)
|
|
197
|
-
.finally(() => compiling.delete(key))
|
|
198
|
-
compiling.set(key, pending)
|
|
199
|
-
}
|
|
200
|
-
const metadata = await pending
|
|
201
|
-
if (res.destroyed) return
|
|
202
|
-
openPreparations.store(
|
|
190
|
+
const token = url.searchParams.get(NATIVE_PREPARE_QUERY_PARAM)
|
|
191
|
+
const metadata = await openPreparations.prepare(
|
|
203
192
|
key,
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
app,
|
|
194
|
+
token,
|
|
195
|
+
async () =>
|
|
196
|
+
(await compile(app, assetOrigin, iosTarget, url.searchParams))?.metadata ??
|
|
197
|
+
null,
|
|
198
|
+
isAvailable &&
|
|
199
|
+
((metadata) => metadata === null || isAvailable(assetOrigin, metadata)),
|
|
206
200
|
)
|
|
201
|
+
if (res.destroyed) return
|
|
202
|
+
openPreparations.store(key, token, metadata)
|
|
207
203
|
res.writeHead(200, {
|
|
208
204
|
'Content-Type': 'application/json',
|
|
209
205
|
'Cache-Control': 'no-store',
|
|
@@ -225,4 +221,5 @@ export const handleNitroRequest = compiledModuleRequestHandler(
|
|
|
225
221
|
throw new Error('Nitro compilation needs configuration=Debug or Release')
|
|
226
222
|
return compileNitroApp(root, origin, configuration, undefined, true, iosTarget)
|
|
227
223
|
},
|
|
224
|
+
(origin, { url, hash }) => swiftArtifactIsAvailable(origin, url, hash),
|
|
228
225
|
)
|
package/src/swift-host.ts
CHANGED
|
@@ -4264,6 +4264,19 @@ function endImmutableRanges(res: ServerResponse, bytes: Buffer) {
|
|
|
4264
4264
|
res.end(bytes.subarray(start, end + 1))
|
|
4265
4265
|
}
|
|
4266
4266
|
|
|
4267
|
+
export function swiftArtifactIsAvailable(
|
|
4268
|
+
origin: string,
|
|
4269
|
+
url: string,
|
|
4270
|
+
hash: string,
|
|
4271
|
+
): boolean {
|
|
4272
|
+
return (
|
|
4273
|
+
!url.startsWith(`${origin}${ARTIFACT_PATH}`) ||
|
|
4274
|
+
[...projects().values()].some((project) =>
|
|
4275
|
+
project.artifacts.some((artifact) => artifact.hash === hash),
|
|
4276
|
+
)
|
|
4277
|
+
)
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4267
4280
|
export async function serveSwiftPackageAsset(
|
|
4268
4281
|
pathname: string,
|
|
4269
4282
|
res: ServerResponse,
|
package/src/turbo-bundle.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type CompiledModuleAsset,
|
|
13
13
|
} from './nitro-bundle'
|
|
14
14
|
import { swiftDistributionRoot } from './swift-distribution'
|
|
15
|
-
import { icuUrl, type SwiftArtifact } from './swift-host'
|
|
15
|
+
import { icuUrl, swiftArtifactIsAvailable, type SwiftArtifact } from './swift-host'
|
|
16
16
|
import { compileTurboModule } from './turbo-compile'
|
|
17
17
|
import { discoverTurboProviders, turboProviderCandidates } from './turbo-source'
|
|
18
18
|
import { installedXcodeWorkspace } from './xcode-project'
|
|
@@ -152,4 +152,5 @@ export async function buildTurboBundle(
|
|
|
152
152
|
export const handleTurboRequest = compiledModuleRequestHandler(
|
|
153
153
|
'TurboModule',
|
|
154
154
|
(root, origin, iosTarget) => compileTurboApp(root, origin, undefined, iosTarget),
|
|
155
|
+
(origin, { url, hash }) => swiftArtifactIsAvailable(origin, url, hash),
|
|
155
156
|
)
|