peachsim 0.1.1966 → 0.1.1968
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/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 +92 -15
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +90 -13
- 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 +91 -14
- 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 +2 -2
- 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 +2 -2
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +92 -15
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +89 -12
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/swift-objc-standin.ts +77 -4
- package/src/swift-standin-emit.ts +25 -3
- package/src/swift-standins.ts +7 -1
|
@@ -22,7 +22,11 @@ import { isRecord } from './is-record'
|
|
|
22
22
|
import { swiftObjCPlatformFlags } from './swift-objc-platform'
|
|
23
23
|
import { IOS_SDK_HEADERS, IOS_SDK_OVERLAYS, IOS_SDK_TARGET } from './swift-objc-sdk'
|
|
24
24
|
import { clangImportNames, moduleMapTokens } from './swift-package'
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
objcProtocolsInSwiftSignatures,
|
|
27
|
+
type GraphSymbol,
|
|
28
|
+
type SymbolGraph,
|
|
29
|
+
} from './swift-standin-emit'
|
|
26
30
|
import { swiftEnvironment, withoutCoreDump } from './swift-toolchain'
|
|
27
31
|
|
|
28
32
|
/** a module map and the headers it reaches: a framework's, or a library
|
|
@@ -53,6 +57,16 @@ export interface ObjcView {
|
|
|
53
57
|
imports: string[]
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
const REFINED_CONSTANT_TYPES = new Map([
|
|
61
|
+
['NSInteger', 'Int'],
|
|
62
|
+
['NSUInteger', 'UInt'],
|
|
63
|
+
['NSTimeInterval', 'TimeInterval'],
|
|
64
|
+
['double', 'Double'],
|
|
65
|
+
['CGFloat', 'CGFloat'],
|
|
66
|
+
['BOOL', 'Bool'],
|
|
67
|
+
['NSString*', 'String'],
|
|
68
|
+
])
|
|
69
|
+
|
|
56
70
|
export const NATIVE_GRAPH_SDK_VERSION = '27.1'
|
|
57
71
|
|
|
58
72
|
/** the installed libc's emulated surfaces: its signal.h is an #error without them,
|
|
@@ -482,13 +496,22 @@ export function objcView(
|
|
|
482
496
|
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
483
497
|
fs.writeFileSync(file, text)
|
|
484
498
|
}
|
|
499
|
+
const interfaceCopies: string[] = []
|
|
485
500
|
if (framework) {
|
|
486
501
|
fs.mkdirSync(path.join(frameworks, `${surface.module}.framework`, 'Modules'), {
|
|
487
502
|
recursive: true,
|
|
488
503
|
})
|
|
489
|
-
|
|
490
|
-
|
|
504
|
+
// the swift overlay owns what the generated -Swift.h header re-imports
|
|
505
|
+
// under swift_name, so a mixed framework's intake map drops that submodule
|
|
506
|
+
const modulemap = fs.readFileSync(surface.modulemap, 'utf8')
|
|
507
|
+
fs.writeFileSync(
|
|
491
508
|
path.join(frameworks, `${surface.module}.framework`, 'Modules', 'module.modulemap'),
|
|
509
|
+
surface.interface
|
|
510
|
+
? modulemap.replace(
|
|
511
|
+
new RegExp(`\\n\\s*module\\s+${surface.module}\\.Swift\\s*\\{[^}]*\\}`),
|
|
512
|
+
'',
|
|
513
|
+
)
|
|
514
|
+
: modulemap,
|
|
492
515
|
)
|
|
493
516
|
// a mixed framework's swift overlay loads over the same learned headers.
|
|
494
517
|
// the intake reads CoreFoundation's headers textually, so a type the
|
|
@@ -504,13 +527,16 @@ export function objcView(
|
|
|
504
527
|
)
|
|
505
528
|
fs.mkdirSync(to, { recursive: true })
|
|
506
529
|
for (const name of fs.readdirSync(from))
|
|
507
|
-
if (name.endsWith('.swiftinterface'))
|
|
530
|
+
if (name.endsWith('.swiftinterface')) {
|
|
531
|
+
interfaceCopies.push(path.join(to, name))
|
|
508
532
|
fs.writeFileSync(
|
|
509
533
|
path.join(to, name),
|
|
510
534
|
fs
|
|
511
535
|
.readFileSync(path.join(from, name), 'utf8')
|
|
512
536
|
.replace(/\bCoreFoundation\.(?=CG)/g, 'CoreGraphics.')
|
|
513
537
|
.replace(/\bCoreFoundation\.(?=\w)/g, 'Foundation.')
|
|
538
|
+
// the intake has no Darwin module; OSStatus is its Int32
|
|
539
|
+
.replace(/\bDarwin\.OSStatus\b/g, 'Swift.Int32')
|
|
514
540
|
// Data's base64 option sets live in the swift overlay; the
|
|
515
541
|
// intake only has their NSData spelling, which Data aliases.
|
|
516
542
|
.replace(
|
|
@@ -518,6 +544,7 @@ export function objcView(
|
|
|
518
544
|
'Foundation.NSData.',
|
|
519
545
|
),
|
|
520
546
|
)
|
|
547
|
+
}
|
|
521
548
|
}
|
|
522
549
|
} else {
|
|
523
550
|
fs.copyFileSync(surface.modulemap, path.join(headersDir, 'module.modulemap'))
|
|
@@ -690,6 +717,7 @@ export function objcView(
|
|
|
690
717
|
: /^\s*\*/.test(after)
|
|
691
718
|
? 'class'
|
|
692
719
|
: 'struct'
|
|
720
|
+
const selectors = new Set<string>()
|
|
693
721
|
for (let round = 0; ; round++) {
|
|
694
722
|
fs.rmSync(out, { recursive: true, force: true })
|
|
695
723
|
fs.mkdirSync(out, { recursive: true })
|
|
@@ -727,6 +755,25 @@ export function objcView(
|
|
|
727
755
|
`original Objective-C declarations do not import as Swift: ${run.stderr.trim() || run.stdout.trim()}`,
|
|
728
756
|
)
|
|
729
757
|
let progress = false
|
|
758
|
+
// a class named like its module shadows the module qualifier, which a module selector
|
|
759
|
+
// still reaches
|
|
760
|
+
for (const [, shadowed, same] of run.stderr.matchAll(
|
|
761
|
+
/is not a member type of class '(\w+)\.(\w+)'/g,
|
|
762
|
+
))
|
|
763
|
+
if (shadowed === same && !selectors.has(shadowed!)) {
|
|
764
|
+
selectors.add(shadowed!)
|
|
765
|
+
progress = true
|
|
766
|
+
for (const file of interfaceCopies)
|
|
767
|
+
fs.writeFileSync(
|
|
768
|
+
file,
|
|
769
|
+
fs
|
|
770
|
+
.readFileSync(file, 'utf8')
|
|
771
|
+
.replace(
|
|
772
|
+
new RegExp(`\\b${shadowed}\\.(?=[A-Za-z_])`, 'g'),
|
|
773
|
+
`${shadowed}::`,
|
|
774
|
+
),
|
|
775
|
+
)
|
|
776
|
+
}
|
|
730
777
|
const learn = (name: string, kind: 'class' | 'protocol' | 'struct' | 'macro') => {
|
|
731
778
|
if (missing.has(name)) return
|
|
732
779
|
missing.set(name, kind)
|
|
@@ -904,6 +951,32 @@ export function objcView(
|
|
|
904
951
|
inherit(pairs[Number(match[1])]!.superclass[0], 's:s8SendableP')
|
|
905
952
|
}
|
|
906
953
|
}
|
|
954
|
+
// a refined extern constant imports under a double-underscore name, which the symbol
|
|
955
|
+
// graph hides, while a swift interface still names it in a default argument.
|
|
956
|
+
const refined: GraphSymbol[] = [...originals.values()].flatMap((text) =>
|
|
957
|
+
[
|
|
958
|
+
...text.matchAll(
|
|
959
|
+
/\b(?:FOUNDATION_EXTERN|FOUNDATION_EXPORT|extern)\s+([\w\s*]+?)\s+const\s+(\w+)\s+NS_REFINED_FOR_SWIFT\s*;/g,
|
|
960
|
+
),
|
|
961
|
+
].flatMap(([, ctype, name]) => {
|
|
962
|
+
const type = REFINED_CONSTANT_TYPES.get(ctype!.replace(/\s+/g, ''))
|
|
963
|
+
if (!type) return []
|
|
964
|
+
return [
|
|
965
|
+
{
|
|
966
|
+
kind: { identifier: 'swift.var' },
|
|
967
|
+
identifier: { precise: `c:@${name}` },
|
|
968
|
+
pathComponents: [`__${name}`],
|
|
969
|
+
declarationFragments: [
|
|
970
|
+
{ kind: 'keyword', spelling: 'let' },
|
|
971
|
+
{ kind: 'text', spelling: ` __${name}: ${type}` },
|
|
972
|
+
],
|
|
973
|
+
accessLevel: 'public',
|
|
974
|
+
} satisfies GraphSymbol,
|
|
975
|
+
]
|
|
976
|
+
}),
|
|
977
|
+
)
|
|
978
|
+
if (refined.length > 0)
|
|
979
|
+
graphs.push({ module: { name: surface.module }, symbols: refined, relationships: [] })
|
|
907
980
|
const imports = new Set<string>(['Foundation', 'UIKit'])
|
|
908
981
|
for (const text of originals.values())
|
|
909
982
|
for (const name of clangImportNames(text)) imports.add(name)
|
|
@@ -38,6 +38,7 @@ export type GraphRelationship = {
|
|
|
38
38
|
source: string
|
|
39
39
|
target: string
|
|
40
40
|
targetFallback?: string
|
|
41
|
+
swiftConstraints?: { kind: string; lhs: string; rhs: string }[]
|
|
41
42
|
sourceOrigin?: { identifier: string; displayName: string }
|
|
42
43
|
}
|
|
43
44
|
export type SymbolGraph = {
|
|
@@ -703,6 +704,7 @@ export function emitSwiftStandin(
|
|
|
703
704
|
const superclass = new Map<string, string>()
|
|
704
705
|
const superId = new Map<string, string>()
|
|
705
706
|
const conforms = new Map<string, string[]>()
|
|
707
|
+
const conditional: { source: GraphSymbol; name: string; where: string }[] = []
|
|
706
708
|
const conformanceTargets = new Map<string, Map<string, string>>()
|
|
707
709
|
const objectConformers = new Set<string>()
|
|
708
710
|
const conformIds = new Map<string, string[]>()
|
|
@@ -721,7 +723,10 @@ export function emitSwiftStandin(
|
|
|
721
723
|
const module = parts[0] === 'SwiftUICore' ? 'SwiftUI' : parts[0]!
|
|
722
724
|
const unqualified = parts.slice(1).join('.') || parts[0]!
|
|
723
725
|
const name =
|
|
724
|
-
family.has(parts[0]!) && parts[0] !== 'SwiftUICore'
|
|
726
|
+
parts.length > 1 && family.has(parts[0]!) && parts[0] !== 'SwiftUICore'
|
|
727
|
+
? // a module selector reaches past a class named like its module
|
|
728
|
+
`${parts[0]}::${unqualified}`
|
|
729
|
+
: unqualified
|
|
725
730
|
return { name, module, local: false }
|
|
726
731
|
}
|
|
727
732
|
const nsObject = nameOf('c:objc(cs)NSObject', 'ObjectiveC.NSObject')!.name
|
|
@@ -736,6 +741,8 @@ export function emitSwiftStandin(
|
|
|
736
741
|
if (edge.sourceOrigin) origins.set(edge.source, edge.sourceOrigin.displayName)
|
|
737
742
|
switch (edge.kind) {
|
|
738
743
|
case 'memberOf': {
|
|
744
|
+
// a synthesized alias shares its enum's id, so its edge can name itself
|
|
745
|
+
if (edge.source === edge.target) break
|
|
739
746
|
const parent = byId.get(edge.target)
|
|
740
747
|
if (parent) {
|
|
741
748
|
owner.set(edge.source, edge.target)
|
|
@@ -779,7 +786,17 @@ export function emitSwiftStandin(
|
|
|
779
786
|
path: pathOf(source),
|
|
780
787
|
reason: `unsupported Objective-C protocol parent ${edge.target}`,
|
|
781
788
|
})
|
|
782
|
-
if (name) {
|
|
789
|
+
if (name && edge.swiftConstraints?.length) {
|
|
790
|
+
conditional.push({
|
|
791
|
+
source,
|
|
792
|
+
name,
|
|
793
|
+
where: edge.swiftConstraints
|
|
794
|
+
.map(({ kind, lhs, rhs }) =>
|
|
795
|
+
kind === 'sameType' ? `${lhs} == ${rhs}` : `${lhs}: ${rhs}`,
|
|
796
|
+
)
|
|
797
|
+
.join(', '),
|
|
798
|
+
})
|
|
799
|
+
} else if (name) {
|
|
783
800
|
conforms.set(edge.source, [...(conforms.get(edge.source) ?? []), name])
|
|
784
801
|
const targets =
|
|
785
802
|
conformanceTargets.get(edge.source) ?? new Map<string, string>()
|
|
@@ -1464,7 +1481,10 @@ export function emitSwiftStandin(
|
|
|
1464
1481
|
const open =
|
|
1465
1482
|
symbol.accessLevel === 'open' &&
|
|
1466
1483
|
(!parentSymbol || parentSymbol.accessLevel === 'open')
|
|
1467
|
-
|
|
1484
|
+
// swift rejects an explicit objc name on a generic subclass of an objc class
|
|
1485
|
+
const objcName = shape.generics
|
|
1486
|
+
? undefined
|
|
1487
|
+
: /^c:objc\(cs\)(\w+)$/.exec(id)?.[1]
|
|
1468
1488
|
emit(
|
|
1469
1489
|
`${indent}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ''}${shape.final}${open ? 'open' : 'public'} class ${shape.name}${shape.generics}${list.length ? `: ${list.join(', ')}` : ''}${selfConforming(shape.where)} {`,
|
|
1470
1490
|
)
|
|
@@ -2001,6 +2021,8 @@ export function emitSwiftStandin(
|
|
|
2001
2021
|
emitWitness(witness.member, ' ', witness.path)
|
|
2002
2022
|
emit('}')
|
|
2003
2023
|
}
|
|
2024
|
+
for (const { source, name, where } of conditional)
|
|
2025
|
+
emitAt(pathOf(source), `extension ${pathOf(source)}: ${name} where ${where} {}`)
|
|
2004
2026
|
const banner = [
|
|
2005
2027
|
...(options.placeholder
|
|
2006
2028
|
? [
|
package/src/swift-standins.ts
CHANGED
|
@@ -1247,7 +1247,13 @@ function mixedStandin(
|
|
|
1247
1247
|
})),
|
|
1248
1248
|
}
|
|
1249
1249
|
})
|
|
1250
|
-
const imports = [
|
|
1250
|
+
const imports = [
|
|
1251
|
+
...new Set([
|
|
1252
|
+
...swiftImportNames(interfaceText),
|
|
1253
|
+
...view.imports.filter((name) => !STANDIN_IMPORTS.includes(name)),
|
|
1254
|
+
...owners,
|
|
1255
|
+
]),
|
|
1256
|
+
].filter(
|
|
1251
1257
|
(module) =>
|
|
1252
1258
|
module !== surface.module && (provided.has(module) || siblings.has(module)),
|
|
1253
1259
|
)
|