peachsim 0.1.2269 → 0.1.2270
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/commands/record.ts +4 -1
- package/detox/index.ts +8 -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 +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +32 -20
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +7 -4
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +21 -14
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +49 -26
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +3 -3
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +9 -5
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +3 -3
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- 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 +1 -1
- package/dist-lib/skills.cjs +56 -27
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +3 -3
- package/dist-lib/vite.cjs +3 -3
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +1 -0
- package/java-platform/licenses/android.txt +6 -3
- package/java-platform/licenses/openjdk.txt +5 -4
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/desktop-host-delivery.ts +22 -6
- package/src/expo-pod-prebuilt.ts +29 -3
- package/src/guest-bundle.ts +1 -0
- package/src/kotlin-host.ts +8 -4
- package/src/native-package-slice-build.ts +156 -96
- package/src/package-tree-digest.ts +33 -10
- package/src/swift-submit.ts +2 -1
- package/src/turbo-compile.ts +5 -1
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
peachAnsweredNativePackages,
|
|
9
9
|
withUnansweredNativePackages,
|
|
10
10
|
} from './answeredNativePackages'
|
|
11
|
+
import { prepareNativeAppRoot } from './expo-native-workspace'
|
|
11
12
|
import { expoPodInputs, expoPodPackages } from './expo-pod-prebuilt'
|
|
13
|
+
import { cacheDir } from './home-paths'
|
|
12
14
|
import { isRecord } from './is-record'
|
|
13
15
|
import {
|
|
14
16
|
buildExpoSwiftPackageSlice,
|
|
@@ -23,14 +25,16 @@ import { nativeEntryKey } from './native-prebuilt'
|
|
|
23
25
|
import { selectCompiledNitroProviders } from './nitro-bundle'
|
|
24
26
|
import { prepareNitroCompileInput } from './nitro-compile'
|
|
25
27
|
import { NITRO_VIEWS_TARGET } from './nitro-source'
|
|
26
|
-
import {
|
|
28
|
+
import { nativePackageTreeDigest } from './package-tree-digest'
|
|
27
29
|
import { reactNativeCoreFloor } from './react-native-core'
|
|
28
30
|
import { compilerSourceDigest, compileSwiftProjectUnit } from './swift-compile'
|
|
29
31
|
import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
|
|
30
32
|
import { swiftNativePin } from './swift-native-pin'
|
|
31
33
|
import { swiftManifestTargets } from './swift-package'
|
|
34
|
+
import { withSwiftRootLock } from './swift-root-lock'
|
|
32
35
|
import { prepareTurboCompileInput } from './turbo-compile'
|
|
33
36
|
import { discoverTurboProviders, TURBO_CORE_TARGET } from './turbo-source'
|
|
37
|
+
import { installedXcodeWorkspace } from './xcode-project'
|
|
34
38
|
import type { NitroBuildConfiguration } from './nitroContract'
|
|
35
39
|
|
|
36
40
|
export interface DetectedNativePackage {
|
|
@@ -65,54 +69,61 @@ function resolveReactNativeRoot(appRoot: string): string {
|
|
|
65
69
|
export async function detectNativePackageKinds(
|
|
66
70
|
appRoot: string,
|
|
67
71
|
packageName?: string,
|
|
68
|
-
opts?: { includeAnswered?: readonly string[] },
|
|
72
|
+
opts?: { includeAnswered?: readonly string[]; kind?: NativePackageSliceKind },
|
|
69
73
|
): Promise<DetectedNativePackage[]> {
|
|
70
74
|
if (opts?.includeAnswered && opts.includeAnswered.length > 0) {
|
|
75
|
+
const nextOpts = opts.kind ? { kind: opts.kind } : undefined
|
|
71
76
|
return withUnansweredNativePackages(opts.includeAnswered, () =>
|
|
72
|
-
detectNativePackageKinds(appRoot, packageName),
|
|
77
|
+
detectNativePackageKinds(appRoot, packageName, nextOpts),
|
|
73
78
|
)
|
|
74
79
|
}
|
|
75
80
|
const realRoot = fs.realpathSync(appRoot)
|
|
76
81
|
const answered = peachAnsweredNativePackages()
|
|
77
82
|
const detected: DetectedNativePackage[] = []
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
if (!opts?.kind || opts.kind === 'expo-swift') {
|
|
85
|
+
for (const pod of await expoPodPackages(realRoot)) {
|
|
86
|
+
detected.push({
|
|
87
|
+
name: pod.name,
|
|
88
|
+
version: pod.version,
|
|
89
|
+
root: fs.realpathSync(pod.root),
|
|
90
|
+
kind: 'expo-swift',
|
|
91
|
+
})
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
const nitroNames = new Set<string>()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
if (!opts?.kind || opts.kind === 'nitro') {
|
|
97
|
+
const nitroSelection = await selectCompiledNitroProviders(realRoot)
|
|
98
|
+
for (const provider of nitroSelection?.providers ?? []) {
|
|
99
|
+
const root = fs.realpathSync(provider.root)
|
|
100
|
+
const meta = readPackageMeta(root)
|
|
101
|
+
const version = meta?.version ?? '0.0.0'
|
|
102
|
+
nitroNames.add(provider.name)
|
|
103
|
+
detected.push({
|
|
104
|
+
name: provider.name,
|
|
105
|
+
version,
|
|
106
|
+
root,
|
|
107
|
+
kind: 'nitro',
|
|
108
|
+
})
|
|
109
|
+
}
|
|
101
110
|
}
|
|
102
111
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
if (!opts?.kind || opts.kind === 'turbomodule') {
|
|
113
|
+
const seenTurbo = new Set<string>()
|
|
114
|
+
for (const provider of await discoverTurboProviders(realRoot)) {
|
|
115
|
+
const root = fs.realpathSync(provider.root)
|
|
116
|
+
const meta = readPackageMeta(root)
|
|
117
|
+
if (!meta || seenTurbo.has(meta.name)) continue
|
|
118
|
+
seenTurbo.add(meta.name)
|
|
119
|
+
if (answered.has(meta.name) || nitroNames.has(meta.name)) continue
|
|
120
|
+
detected.push({
|
|
121
|
+
name: meta.name,
|
|
122
|
+
version: meta.version,
|
|
123
|
+
root,
|
|
124
|
+
kind: 'turbomodule',
|
|
125
|
+
})
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
return detected
|
|
@@ -139,7 +150,7 @@ export async function turboPackageSliceInputs(opts: {
|
|
|
139
150
|
version: opts.packageVersion,
|
|
140
151
|
'react-native': opts.reactNativeVersion,
|
|
141
152
|
'core-mode': opts.coreMode,
|
|
142
|
-
tree: await
|
|
153
|
+
tree: await nativePackageTreeDigest(opts.packageRoot),
|
|
143
154
|
}
|
|
144
155
|
}
|
|
145
156
|
|
|
@@ -161,7 +172,7 @@ export async function nitroPackageSliceInputs(opts: {
|
|
|
161
172
|
'nitro-modules': opts.nitroVersion,
|
|
162
173
|
'react-native': opts.reactNativeVersion,
|
|
163
174
|
configuration: opts.configuration,
|
|
164
|
-
tree: await
|
|
175
|
+
tree: await nativePackageTreeDigest(opts.packageRoot),
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
|
|
@@ -206,17 +217,38 @@ export async function buildNativePackageSlice(opts: {
|
|
|
206
217
|
}
|
|
207
218
|
|
|
208
219
|
if (kind === 'turbomodule') {
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
let resolvedProjectRoot = projectRoot
|
|
221
|
+
let providers = (
|
|
222
|
+
await discoverTurboProviders(appRoot, resolvedProjectRoot, opts.iosTarget)
|
|
211
223
|
).filter((provider) => readPackageMeta(provider.root)?.name === opts.packageName)
|
|
212
224
|
if (providers.length === 0) return null
|
|
225
|
+
const hasExpoConfig = ['app.json', 'app.config.ts', 'app.config.js'].some((name) =>
|
|
226
|
+
fs.existsSync(path.join(appRoot, name)),
|
|
227
|
+
)
|
|
228
|
+
const hasSwiftSources = providers.some((provider) =>
|
|
229
|
+
fs
|
|
230
|
+
.readdirSync(provider.root, { recursive: true, encoding: 'utf8' })
|
|
231
|
+
.some((file) => file.endsWith('.swift')),
|
|
232
|
+
)
|
|
233
|
+
if (
|
|
234
|
+
!opts.projectRoot &&
|
|
235
|
+
!installedXcodeWorkspace(resolvedProjectRoot) &&
|
|
236
|
+
hasExpoConfig &&
|
|
237
|
+
hasSwiftSources
|
|
238
|
+
) {
|
|
239
|
+
resolvedProjectRoot = await prepareNativeAppRoot(appRoot, undefined, opts.iosTarget)
|
|
240
|
+
providers = (
|
|
241
|
+
await discoverTurboProviders(appRoot, resolvedProjectRoot, opts.iosTarget)
|
|
242
|
+
).filter((provider) => readPackageMeta(provider.root)?.name === opts.packageName)
|
|
243
|
+
if (providers.length === 0) return null
|
|
244
|
+
}
|
|
213
245
|
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
214
246
|
const { input, collection } = await prepareTurboCompileInput({
|
|
215
247
|
appRoot,
|
|
216
248
|
reactNativeRoot,
|
|
217
249
|
providers,
|
|
218
250
|
moduleRoot,
|
|
219
|
-
projectRoot,
|
|
251
|
+
projectRoot: resolvedProjectRoot,
|
|
220
252
|
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
221
253
|
iosDeploymentTargetFallback: reactNativeCoreFloor(reactNativeRoot),
|
|
222
254
|
})
|
|
@@ -314,6 +346,7 @@ export async function buildNativePackageSlice(opts: {
|
|
|
314
346
|
if (!matchedRoot) return null
|
|
315
347
|
const configuration: NitroBuildConfiguration = opts.configuration ?? 'Release'
|
|
316
348
|
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
349
|
+
const iosDeploymentTargetFallback = reactNativeCoreFloor(reactNativeRoot)
|
|
317
350
|
const { input, collection, packagePath } = await prepareNitroCompileInput({
|
|
318
351
|
appRoot,
|
|
319
352
|
packageRoots: [matchedRoot],
|
|
@@ -322,9 +355,8 @@ export async function buildNativePackageSlice(opts: {
|
|
|
322
355
|
projectRoot,
|
|
323
356
|
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
324
357
|
configuration,
|
|
325
|
-
iosDeploymentTargetFallback
|
|
358
|
+
iosDeploymentTargetFallback,
|
|
326
359
|
})
|
|
327
|
-
const workRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-nitro-slice-'))
|
|
328
360
|
try {
|
|
329
361
|
const providerInfo = collection.providers[0]
|
|
330
362
|
if (!providerInfo) return null
|
|
@@ -340,63 +372,91 @@ export async function buildNativePackageSlice(opts: {
|
|
|
340
372
|
const cached = loadNativePackageSlice(providerInfo.name, key, { remote: false })
|
|
341
373
|
if (cached) return cached
|
|
342
374
|
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
buildRoot: compileRoot,
|
|
354
|
-
intermediates: true,
|
|
355
|
-
},
|
|
356
|
-
)
|
|
357
|
-
const packageSwift = input.files['Package.swift'] ?? ''
|
|
358
|
-
const coreTargets = new Set([
|
|
359
|
-
'NitroCore',
|
|
360
|
-
'JsiBridge',
|
|
361
|
-
'NitroModules',
|
|
362
|
-
NITRO_VIEWS_TARGET,
|
|
363
|
-
...Object.keys(input.libraries ?? {}),
|
|
364
|
-
])
|
|
365
|
-
const onlyTargets = new Set(
|
|
366
|
-
swiftManifestTargets(packageSwift)
|
|
367
|
-
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
368
|
-
.map((target) => target.name),
|
|
369
|
-
)
|
|
370
|
-
const packed = packCompiledTargetsToSliceDir({
|
|
371
|
-
buildRoot: compileRoot,
|
|
372
|
-
packageSwift,
|
|
373
|
-
toolchainBin: toolchain.toolchainBin,
|
|
374
|
-
stagingDir,
|
|
375
|
-
onlyTargets,
|
|
375
|
+
// share compiled NitroCore/JsiBridge/NitroModules intermediates across slices
|
|
376
|
+
const nitroCoreKey = nativeEntryKey({
|
|
377
|
+
kind: 'nitro-slice-core',
|
|
378
|
+
compiler: compilerSourceDigest,
|
|
379
|
+
'swift-pin': JSON.stringify(swiftNativePin()),
|
|
380
|
+
'nitro-modules': collection.nitro.version,
|
|
381
|
+
'react-native': collection.reactNative.version,
|
|
382
|
+
iosDeploymentTargetFallback,
|
|
383
|
+
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
384
|
+
configuration,
|
|
376
385
|
})
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
386
|
+
const compileRoot = path.join(cacheDir(), 'nitro-slice-build', nitroCoreKey)
|
|
387
|
+
return await withSwiftRootLock(`${compileRoot}.slice-lock`, async () => {
|
|
388
|
+
const lockedCached = loadNativePackageSlice(providerInfo.name, key, {
|
|
389
|
+
remote: false,
|
|
390
|
+
})
|
|
391
|
+
if (lockedCached) return lockedCached
|
|
392
|
+
|
|
393
|
+
fs.mkdirSync(compileRoot, { recursive: true })
|
|
394
|
+
const sourcesDir = path.join(compileRoot, 'Sources')
|
|
395
|
+
if (fs.existsSync(sourcesDir)) {
|
|
396
|
+
for (const entry of fs.readdirSync(sourcesDir)) {
|
|
397
|
+
if (entry.startsWith('NitroPackage_')) {
|
|
398
|
+
fs.rmSync(path.join(sourcesDir, entry), { recursive: true, force: true })
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
const stagingDir = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-nitro-slice-'))
|
|
403
|
+
try {
|
|
404
|
+
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
405
|
+
await compileSwiftProjectUnit(
|
|
406
|
+
{ ...input, optimize: false },
|
|
407
|
+
{
|
|
408
|
+
...toolchain,
|
|
409
|
+
moduleRoot,
|
|
410
|
+
buildRoot: compileRoot,
|
|
411
|
+
intermediates: true,
|
|
412
|
+
},
|
|
413
|
+
)
|
|
414
|
+
const packageSwift = input.files['Package.swift'] ?? ''
|
|
415
|
+
const coreTargets = new Set([
|
|
416
|
+
'NitroCore',
|
|
417
|
+
'JsiBridge',
|
|
418
|
+
'NitroModules',
|
|
419
|
+
NITRO_VIEWS_TARGET,
|
|
420
|
+
...Object.keys(input.libraries ?? {}),
|
|
421
|
+
])
|
|
422
|
+
const onlyTargets = new Set(
|
|
423
|
+
swiftManifestTargets(packageSwift)
|
|
424
|
+
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
425
|
+
.map((target) => target.name),
|
|
426
|
+
)
|
|
427
|
+
const packed = packCompiledTargetsToSliceDir({
|
|
428
|
+
buildRoot: compileRoot,
|
|
429
|
+
packageSwift,
|
|
430
|
+
toolchainBin: toolchain.toolchainBin,
|
|
431
|
+
stagingDir,
|
|
432
|
+
onlyTargets,
|
|
433
|
+
})
|
|
434
|
+
const targetNames = packed.targets.map((target) => target.name)
|
|
435
|
+
const manifest: NativePackageSliceManifest = {
|
|
436
|
+
schema: 1,
|
|
437
|
+
kind: 'nitro',
|
|
438
|
+
packageName: providerInfo.name,
|
|
439
|
+
packageVersion: providerInfo.version,
|
|
440
|
+
key,
|
|
441
|
+
runtimePin: swiftNativePin(),
|
|
442
|
+
targets: packed.targets,
|
|
443
|
+
nitro: {
|
|
444
|
+
targetNames,
|
|
445
|
+
hybridObjects: providerInfo.hybridObjects,
|
|
446
|
+
registrations: collection.registrations,
|
|
447
|
+
},
|
|
448
|
+
}
|
|
449
|
+
return finalizeSliceEntry({
|
|
450
|
+
manifest,
|
|
451
|
+
inputs,
|
|
452
|
+
assetFiles: packed.files,
|
|
453
|
+
stagingDir,
|
|
454
|
+
})
|
|
455
|
+
} finally {
|
|
456
|
+
fs.rmSync(stagingDir, { recursive: true, force: true })
|
|
457
|
+
}
|
|
397
458
|
})
|
|
398
459
|
} finally {
|
|
399
460
|
fs.rmSync(packagePath, { recursive: true, force: true })
|
|
400
|
-
fs.rmSync(workRoot, { recursive: true, force: true })
|
|
401
461
|
}
|
|
402
462
|
}
|
|
@@ -5,25 +5,48 @@ import { join } from 'node:path'
|
|
|
5
5
|
|
|
6
6
|
const READ_AHEAD = 64
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function hashPackageTree(
|
|
9
|
+
root: string,
|
|
10
|
+
options: {
|
|
11
|
+
compareNames: (left: string, right: string) => number
|
|
12
|
+
skipFile?: (name: string) => boolean
|
|
13
|
+
},
|
|
14
|
+
): Promise<string> {
|
|
10
15
|
const files: string[] = []
|
|
11
16
|
const walk = (directory: string, relative: string) => {
|
|
12
17
|
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) =>
|
|
13
|
-
a.name
|
|
18
|
+
options.compareNames(a.name, b.name),
|
|
14
19
|
)) {
|
|
15
20
|
if (entry.name === 'node_modules') continue
|
|
16
21
|
const path = `${relative}${entry.name}`
|
|
17
22
|
if (entry.isDirectory()) walk(join(directory, entry.name), `${path}/`)
|
|
18
|
-
else if (entry.isFile()) files.push(path)
|
|
23
|
+
else if (entry.isFile() && !options.skipFile?.(entry.name)) files.push(path)
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
walk(root, '')
|
|
22
27
|
const hash = createHash('sha256')
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
return (async () => {
|
|
29
|
+
for (let start = 0; start < files.length; start += READ_AHEAD) {
|
|
30
|
+
const batch = files.slice(start, start + READ_AHEAD)
|
|
31
|
+
const bytes = await Promise.all(batch.map((file) => readFile(join(root, file))))
|
|
32
|
+
batch.forEach((file, index) => hash.update(`${file}\0`).update(bytes[index]!))
|
|
33
|
+
}
|
|
34
|
+
return hash.digest('hex')
|
|
35
|
+
})()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** an installed package's source tree digest, its nested node_modules excluded. */
|
|
39
|
+
export function packageTreeDigest(root: string): Promise<string> {
|
|
40
|
+
return hashPackageTree(root, {
|
|
41
|
+
compareNames: (left, right) => left.localeCompare(right),
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** native-build package digest excluding declaration and sourcemap outputs plugins may rewrite. */
|
|
46
|
+
export function nativePackageTreeDigest(root: string): Promise<string> {
|
|
47
|
+
return hashPackageTree(root, {
|
|
48
|
+
compareNames: (left, right) => (left < right ? -1 : left > right ? 1 : 0),
|
|
49
|
+
skipFile: (name) =>
|
|
50
|
+
name.endsWith('.d.ts') || name.endsWith('.d.ts.map') || name.endsWith('.js.map'),
|
|
51
|
+
})
|
|
29
52
|
}
|
package/src/swift-submit.ts
CHANGED
|
@@ -151,7 +151,8 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
|
|
|
151
151
|
// `peach.bitmap_release`; trees name them `peach-bitmap:<id>`.
|
|
152
152
|
// 72: a refresh may answer `{"$patch":[node]}`, nodes that replace the same
|
|
153
153
|
// ids in the last tree.
|
|
154
|
-
|
|
154
|
+
// 73: custom label styles retain a StyledLabel accessibility host.
|
|
155
|
+
export const SWIFT_HOST_ABI = 73
|
|
155
156
|
|
|
156
157
|
export interface SwiftImageUpload {
|
|
157
158
|
/** the raster file picked for the asset (has the extension). */
|
package/src/turbo-compile.ts
CHANGED
|
@@ -379,7 +379,11 @@ export async function prepareTurboCompileInput(
|
|
|
379
379
|
collection.externalPodSources.map(({ moduleName }) => moduleName),
|
|
380
380
|
)
|
|
381
381
|
for (const target of collection.targets)
|
|
382
|
-
if (
|
|
382
|
+
if (
|
|
383
|
+
!externalModules.has(target.name) ||
|
|
384
|
+
collection.rendererSwiftTargets.includes(target.name)
|
|
385
|
+
)
|
|
386
|
+
available.add(target.name)
|
|
383
387
|
const missing = [
|
|
384
388
|
...new Set([
|
|
385
389
|
...missingSwiftModules(collection.files, available).keys(),
|