peachsim 0.1.686 → 0.1.687
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/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +45 -10
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +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/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/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.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 +46 -11
- package/dist-lib/swift-compile.cjs +45 -10
- package/dist-lib/swift-compile.mjs +45 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +45 -10
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/swift-compile.ts +65 -10
package/src/swift-compile.ts
CHANGED
|
@@ -212,17 +212,29 @@ export function withNativeSourceGlue(
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
const OPTIONAL_FRAMEWORKS = new Set(['CryptoKit', 'Security'])
|
|
216
|
+
|
|
217
|
+
function swiftTargetDependencies(
|
|
216
218
|
files: Record<string, string>,
|
|
217
|
-
targets: SwiftPackageTarget[],
|
|
219
|
+
targets: Pick<SwiftPackageTarget, 'name' | 'path'>[],
|
|
218
220
|
): Map<string, string[]> {
|
|
219
|
-
const names = new Set(targets.map((target) => target.name))
|
|
221
|
+
const names = new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)])
|
|
220
222
|
const siblings = new Map<string, string[]>()
|
|
221
223
|
for (const target of targets) {
|
|
222
|
-
const prefix = `${target.path}/`
|
|
224
|
+
const prefix = target.path === '.' ? '' : `${target.path}/`
|
|
223
225
|
const deps = new Set<string>()
|
|
224
226
|
for (const [file, contents] of Object.entries(files)) {
|
|
225
227
|
if (file === 'Package.swift' || !file.startsWith(prefix)) continue
|
|
228
|
+
if (
|
|
229
|
+
targets.some(
|
|
230
|
+
(candidate) =>
|
|
231
|
+
candidate.name !== target.name &&
|
|
232
|
+
candidate.path !== '.' &&
|
|
233
|
+
candidate.path.startsWith(prefix) &&
|
|
234
|
+
file.startsWith(`${candidate.path}/`),
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
continue
|
|
226
238
|
// an import may carry attributes (`@_exported`, `@preconcurrency`) and a
|
|
227
239
|
// declaration kind (`import struct Nuke.ImageRequest`).
|
|
228
240
|
for (const match of contents.matchAll(
|
|
@@ -256,7 +268,7 @@ const OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "Pe
|
|
|
256
268
|
const ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
257
269
|
|
|
258
270
|
/** bump with any change to the emitted multi-target manifest text. */
|
|
259
|
-
export const MULTI_MANIFEST_VERSION =
|
|
271
|
+
export const MULTI_MANIFEST_VERSION = 8
|
|
260
272
|
|
|
261
273
|
export function swiftArtifactHash(
|
|
262
274
|
input: SwiftCompileInput,
|
|
@@ -264,11 +276,12 @@ export function swiftArtifactHash(
|
|
|
264
276
|
moduleRoot: string,
|
|
265
277
|
): string {
|
|
266
278
|
const hash = createHash('sha256')
|
|
279
|
+
// v8: optional framework products and distribution objects link on import
|
|
267
280
|
// v7: runtime class lookup uses the same objc class registry as messages
|
|
268
281
|
// v6: app and scene delegate classes compile final
|
|
269
282
|
// (v5: a target declaring resources gets SwiftPM's Bundle.module accessor;
|
|
270
283
|
// v4: sources compile through swiftSourceAsIOS)
|
|
271
|
-
hash.update(`swift-compile/
|
|
284
|
+
hash.update(`swift-compile/v8\n${release}\n`)
|
|
272
285
|
if (input.oneModule) hash.update('one-module\n')
|
|
273
286
|
hash.update(swiftModuleDigest(moduleRoot))
|
|
274
287
|
for (const file of Object.keys(input.files).sort()) {
|
|
@@ -296,7 +309,7 @@ export function swiftArtifactHash(
|
|
|
296
309
|
hash.update(
|
|
297
310
|
JSON.stringify({
|
|
298
311
|
targets,
|
|
299
|
-
siblings: [...
|
|
312
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort((a, b) =>
|
|
300
313
|
String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0,
|
|
301
314
|
),
|
|
302
315
|
}),
|
|
@@ -315,6 +328,22 @@ export function emitSwiftPackageManifest(args: {
|
|
|
315
328
|
distribution?: SwiftDistributionManifest
|
|
316
329
|
}): string {
|
|
317
330
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args
|
|
331
|
+
const reachedFrameworks = new Set(
|
|
332
|
+
[...siblings.values()]
|
|
333
|
+
.flat()
|
|
334
|
+
.filter(
|
|
335
|
+
(name) =>
|
|
336
|
+
OPTIONAL_FRAMEWORKS.has(name) &&
|
|
337
|
+
!targets.some((target) => target.name === name),
|
|
338
|
+
),
|
|
339
|
+
)
|
|
340
|
+
// the distribution builder names each object lib/<target>-<file>.o.
|
|
341
|
+
// preserve link order while leaving unreached optional module objects out.
|
|
342
|
+
const distributionObjects = distribution?.objects.filter((object) =>
|
|
343
|
+
[...OPTIONAL_FRAMEWORKS].every(
|
|
344
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name),
|
|
345
|
+
),
|
|
346
|
+
)
|
|
318
347
|
const executable = targets.find((target) => target.executable)
|
|
319
348
|
if (!executable) throw new Error('swift-compile: no executable target to emit')
|
|
320
349
|
// each target compiles in the language mode and default isolation its
|
|
@@ -343,11 +372,18 @@ export function emitSwiftPackageManifest(args: {
|
|
|
343
372
|
...(oneModule ? [ONE_PRODUCT] : []),
|
|
344
373
|
...(spriteKit ? [SPRITEKIT_PRODUCT] : []),
|
|
345
374
|
]),
|
|
346
|
-
...(siblings.get(target.name) ?? []).
|
|
375
|
+
...(siblings.get(target.name) ?? []).flatMap((dependency) =>
|
|
376
|
+
OPTIONAL_FRAMEWORKS.has(dependency) &&
|
|
377
|
+
!targets.some((candidate) => candidate.name === dependency)
|
|
378
|
+
? distribution
|
|
379
|
+
? []
|
|
380
|
+
: [`.product(name: "${dependency}", package: "sootsim-swift")`]
|
|
381
|
+
: [`"${dependency}"`],
|
|
382
|
+
),
|
|
347
383
|
].join(', ')
|
|
348
384
|
const library = distribution
|
|
349
385
|
? [
|
|
350
|
-
...
|
|
386
|
+
...(distributionObjects ?? []).map((object) => path.join(moduleRoot, object)),
|
|
351
387
|
...distribution.link,
|
|
352
388
|
]
|
|
353
389
|
.map((flag) => `, ${JSON.stringify(flag)}`)
|
|
@@ -641,6 +677,22 @@ export function writeSwiftProject(
|
|
|
641
677
|
path.join(moduleRoot, 'scripts/contrast-app-Package.swift'),
|
|
642
678
|
'utf8',
|
|
643
679
|
).replaceAll('__SOOTSIM_SWIFT_PACKAGE__', moduleRoot)
|
|
680
|
+
const optionalProducts =
|
|
681
|
+
swiftTargetDependencies(input.files, [{ name: 'App', path: '.' }]).get('App') ?? []
|
|
682
|
+
if (optionalProducts.length > 0) {
|
|
683
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),'
|
|
684
|
+
if (!manifest.includes(product))
|
|
685
|
+
throw new Error('Swift app template lost its framework dependency anchor')
|
|
686
|
+
manifest = manifest.replace(
|
|
687
|
+
product,
|
|
688
|
+
[
|
|
689
|
+
product,
|
|
690
|
+
...optionalProducts.map(
|
|
691
|
+
(name) => `.product(name: "${name}", package: "sootsim-swift"),`,
|
|
692
|
+
),
|
|
693
|
+
].join('\n '),
|
|
694
|
+
)
|
|
695
|
+
}
|
|
644
696
|
if (input.oneModule) {
|
|
645
697
|
// anchored on lines the template already has, so the template stays a
|
|
646
698
|
// valid manifest for a compiler build that predates the One module
|
|
@@ -691,7 +743,10 @@ export function writeSwiftProject(
|
|
|
691
743
|
path.join(layout.root, 'Package.swift'),
|
|
692
744
|
emitSwiftPackageManifest({
|
|
693
745
|
targets,
|
|
694
|
-
siblings:
|
|
746
|
+
siblings: swiftTargetDependencies(
|
|
747
|
+
input.files,
|
|
748
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: '.' })),
|
|
749
|
+
),
|
|
695
750
|
moduleRoot,
|
|
696
751
|
oneModule: input.oneModule,
|
|
697
752
|
spriteKit: importsSpriteKit(input.files),
|