peachsim 0.1.2182 → 0.1.2185
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/outbound-endpoints.ts +11 -1
- 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 +321 -31
- 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 +288 -26
- 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 +314 -31
- package/dist-lib/host/fetch-proxy-handler.cjs +7 -4
- 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 +7 -4
- 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 +7 -4
- package/dist-lib/native-app-identity-project.cjs +6 -3
- package/dist-lib/native-app-identity-project.mjs +6 -3
- 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 +25 -24
- package/dist-lib/public-origins-lib.json +63 -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 +321 -31
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- package/dist-lib/swift-package.cjs +26 -1
- package/dist-lib/swift-package.mjs +25 -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 +286 -24
- package/dist-lib/vite.cjs +7 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/sdk/ios/System/Library/Frameworks/ActivityKit.framework/Headers/ActivityKit.h +1 -0
- package/sdk/ios/System/Library/Frameworks/ActivityKit.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/usr/lib/swift/ActivityKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +14 -0
- package/sdk/ios/usr/lib/swift/CoreGraphics.swiftmodule/arm64-apple-ios-simulator.swiftinterface +14 -0
- package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -0
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +147 -16
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +5 -0
- package/src/expo-native-workspace.ts +2 -1
- package/src/swift-interface-bodies.ts +165 -0
- package/src/swift-objc-standin.ts +73 -13
- package/src/swift-package.ts +26 -0
- package/src/swift-source-pods.ts +27 -4
- package/src/swift-standin-emit.ts +30 -3
- package/src/swift-standins.ts +75 -12
|
@@ -74,7 +74,7 @@ export function restoreSwiftInterfaceSPI(
|
|
|
74
74
|
for (const line of interfaceText.split('\n')) {
|
|
75
75
|
const enclosing = scopes.at(-1)?.path ?? []
|
|
76
76
|
const declaration =
|
|
77
|
-
/^\s*(?:@[\w.]+(?:\([^)]*\))?\s+|\w+\s+)*?(class(?!\s+(?:func|var|subscript)\b)|struct|enum|protocol|actor|extension|func|var|let|init|subscript|typealias|case)\b\s*([\w.`]*)/.exec(
|
|
77
|
+
/^\s*(?:@[\w.]+(?:\([^)]*\))?\s+|\w+\s+)*?(class(?!\s+(?:func|var|subscript)\b)|struct|enum|protocol|actor|extension|func|var|let|init|subscript|typealias|case)\b\s*([/=\-+!*%<>&|^~?]+|[\w.`]*)/.exec(
|
|
78
78
|
line.replace(/::/g, '.'),
|
|
79
79
|
)
|
|
80
80
|
if (declaration) {
|
|
@@ -178,6 +178,8 @@ export type StandinOptions = {
|
|
|
178
178
|
plain?: ReadonlySet<string>
|
|
179
179
|
/** paths whose type the guest cannot represent in objective-c: emitted without @objc */
|
|
180
180
|
unobjc?: ReadonlySet<string>
|
|
181
|
+
/** class path → objective-c protocols the compiler found its witnesses mismatch (nullability a swift protocol checks); the class drops the conformance */
|
|
182
|
+
unconformed?: ReadonlyMap<string, ReadonlySet<string>>
|
|
181
183
|
/** paths the compiler says must be marked override */
|
|
182
184
|
forcedOverride?: ReadonlySet<string>
|
|
183
185
|
/** class path → its generic superclass with arguments, from the swiftinterface */
|
|
@@ -267,6 +269,25 @@ const KEEP_EXTERNAL = new Map([
|
|
|
267
269
|
['s:Se', 'Decodable'],
|
|
268
270
|
['s:s23CustomStringConvertibleP', 'CustomStringConvertible'],
|
|
269
271
|
['s:s9CodingKeyP', 'CodingKey'],
|
|
272
|
+
['s:SL', 'Comparable'],
|
|
273
|
+
['s:ST', 'Sequence'],
|
|
274
|
+
['s:St', 'IteratorProtocol'],
|
|
275
|
+
['s:Sl', 'Collection'],
|
|
276
|
+
['s:SK', 'BidirectionalCollection'],
|
|
277
|
+
['s:Sk', 'RandomAccessCollection'],
|
|
278
|
+
['s:SM', 'MutableCollection'],
|
|
279
|
+
['s:Sm', 'RangeReplaceableCollection'],
|
|
280
|
+
['s:s28CustomDebugStringConvertibleP', 'CustomDebugStringConvertible'],
|
|
281
|
+
['s:s25LosslessStringConvertibleP', 'LosslessStringConvertible'],
|
|
282
|
+
['s:s20TextOutputStreamableP', 'TextOutputStreamable'],
|
|
283
|
+
['s:Sx', 'Strideable'],
|
|
284
|
+
['s:s18AdditiveArithmeticP', 'AdditiveArithmetic'],
|
|
285
|
+
['s:s25ExpressibleByArrayLiteralP', 'ExpressibleByArrayLiteral'],
|
|
286
|
+
['s:s30ExpressibleByDictionaryLiteralP', 'ExpressibleByDictionaryLiteral'],
|
|
287
|
+
['s:s26ExpressibleByStringLiteralP', 'ExpressibleByStringLiteral'],
|
|
288
|
+
['s:s27ExpressibleByIntegerLiteralP', 'ExpressibleByIntegerLiteral'],
|
|
289
|
+
['s:s25ExpressibleByFloatLiteralP', 'ExpressibleByFloatLiteral'],
|
|
290
|
+
['s:s27ExpressibleByBooleanLiteralP', 'ExpressibleByBooleanLiteral'],
|
|
270
291
|
])
|
|
271
292
|
const LEADING_ATTRS = /^((?:@\w+(?:\([^)]*\))?\s*|nonisolated\s+)*)(.*)$/s
|
|
272
293
|
|
|
@@ -1488,9 +1509,15 @@ export function emitSwiftStandin(
|
|
|
1488
1509
|
!(
|
|
1489
1510
|
parent &&
|
|
1490
1511
|
objectConformers.has(id) &&
|
|
1491
|
-
[
|
|
1512
|
+
[
|
|
1513
|
+
'Hashable',
|
|
1514
|
+
'Equatable',
|
|
1515
|
+
'CustomStringConvertible',
|
|
1516
|
+
'CustomDebugStringConvertible',
|
|
1517
|
+
].includes(name)
|
|
1492
1518
|
) &&
|
|
1493
|
-
!(name === nsObjectProtocol && externalRoot(id) === nsObject)
|
|
1519
|
+
!(name === nsObjectProtocol && externalRoot(id) === nsObject) &&
|
|
1520
|
+
!options.unconformed?.get(path)?.has(name),
|
|
1494
1521
|
),
|
|
1495
1522
|
].filter((name, at, all) => all.indexOf(name) === at)
|
|
1496
1523
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)!) : undefined
|
package/src/swift-standins.ts
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
} from './swift-objc-standin'
|
|
46
46
|
import {
|
|
47
47
|
clangImportNames,
|
|
48
|
+
moduleMapModules,
|
|
48
49
|
moduleMapName,
|
|
49
50
|
swiftManifestDeclarations,
|
|
50
51
|
swiftTargetModuleName,
|
|
@@ -674,6 +675,22 @@ function cxxOnly(surface: Surface): boolean {
|
|
|
674
675
|
})
|
|
675
676
|
}
|
|
676
677
|
|
|
678
|
+
// the surfaces of a library slice's module map, one per module it declares: a
|
|
679
|
+
// uniffi xcframework ships a module per generated header in one map, and an
|
|
680
|
+
// app imports each by name.
|
|
681
|
+
function mapSurfaces(modulemap: string): SliceSurface[] {
|
|
682
|
+
const text = fs.readFileSync(modulemap, 'utf8')
|
|
683
|
+
const headers = path.dirname(modulemap)
|
|
684
|
+
const modules = moduleMapModules(text)
|
|
685
|
+
if (modules.length <= 1) {
|
|
686
|
+
const module = moduleMapName(text)
|
|
687
|
+
return module ? [headerSurface(module, modulemap, headers)] : []
|
|
688
|
+
}
|
|
689
|
+
return modules.map((module) =>
|
|
690
|
+
headerSurface(module.name, generatedModuleMap(`${module.text}\n`, false), headers),
|
|
691
|
+
)
|
|
692
|
+
}
|
|
693
|
+
|
|
677
694
|
function simulatorSlice(xcframeworkDir: string): string | null {
|
|
678
695
|
const slice = fs
|
|
679
696
|
.readdirSync(xcframeworkDir)
|
|
@@ -762,8 +779,7 @@ function surfaces(
|
|
|
762
779
|
const headers = path.join(root, 'Headers')
|
|
763
780
|
for (const map of files(headers, (name) => name === 'module.modulemap')) {
|
|
764
781
|
const modulemap = path.join(headers, map)
|
|
765
|
-
|
|
766
|
-
if (module) found.push(headerSurface(module, modulemap, path.dirname(modulemap)))
|
|
782
|
+
found.push(...mapSurfaces(modulemap))
|
|
767
783
|
}
|
|
768
784
|
if (found.length === 0 && files(headers, (name) => name.endsWith('.h')).length) {
|
|
769
785
|
const module = swiftTargetModuleName(target)
|
|
@@ -964,13 +980,22 @@ export function swiftInterfaceForWasm(text: string, cFlags: readonly string[]):
|
|
|
964
980
|
])
|
|
965
981
|
return `${interop} ${xcc.join(' ')}`
|
|
966
982
|
})
|
|
967
|
-
|
|
968
|
-
|
|
983
|
+
const lines = retargeted.split('\n')
|
|
984
|
+
// an optional requirement stays @objc, so a type its signature names must be
|
|
985
|
+
// objective-c representable: an enum it names keeps its own @objc
|
|
986
|
+
const required = lines.filter((line) => OPTIONAL_REQUIREMENT.test(line)).join('\n')
|
|
987
|
+
return lines
|
|
969
988
|
.map((line) => {
|
|
970
989
|
// an enum's @objc only bridges it to objective-c, which wasm has no
|
|
971
990
|
// runtime for, and an @objc error enum loses its raw-value Hashable.
|
|
972
|
-
if (/\benum\s/.test(line) && TYPE_DECLARATION.test(line))
|
|
973
|
-
|
|
991
|
+
if (/\benum\s/.test(line) && TYPE_DECLARATION.test(line)) {
|
|
992
|
+
const name = /\benum\s+(\w+)/.exec(line)?.[1]
|
|
993
|
+
return name &&
|
|
994
|
+
new RegExp(`\\b${name}\\b`).test(required) &&
|
|
995
|
+
!/\bSwift\.Error\b/.test(line)
|
|
996
|
+
? line
|
|
997
|
+
: line.replace(/@objc(?:\s*\([^()]*\))?\s+/g, '')
|
|
998
|
+
}
|
|
974
999
|
if (TYPE_DECLARATION.test(line)) return line.replace(/@objcMembers\b/g, '')
|
|
975
1000
|
if (OPTIONAL_REQUIREMENT.test(line)) return line
|
|
976
1001
|
return line.replace(OBJC_ATTRIBUTE, '')
|
|
@@ -1522,6 +1547,18 @@ function graphStandin(
|
|
|
1522
1547
|
const plain = new Set<string>()
|
|
1523
1548
|
const unobjc = new Set<string>()
|
|
1524
1549
|
const trapped = new Set<string>()
|
|
1550
|
+
const unconformed = new Map<string, Set<string>>()
|
|
1551
|
+
const objcProtocols = new Set(
|
|
1552
|
+
graphs.flatMap((graph) =>
|
|
1553
|
+
graph.symbols
|
|
1554
|
+
.filter(
|
|
1555
|
+
(symbol) =>
|
|
1556
|
+
symbol.kind.identifier === 'swift.protocol' &&
|
|
1557
|
+
symbol.identifier.precise.startsWith('c:'),
|
|
1558
|
+
)
|
|
1559
|
+
.map((symbol) => symbol.pathComponents.join('.')),
|
|
1560
|
+
),
|
|
1561
|
+
)
|
|
1525
1562
|
const file = path.join(work, `${module}.swift`)
|
|
1526
1563
|
// a source target whose implementation compiles keeps inert bodies, and a
|
|
1527
1564
|
// placeholder sends nothing. a target replaced because assembly cannot
|
|
@@ -1540,6 +1577,7 @@ function graphStandin(
|
|
|
1540
1577
|
omit,
|
|
1541
1578
|
plain,
|
|
1542
1579
|
unobjc,
|
|
1580
|
+
unconformed,
|
|
1543
1581
|
trapped,
|
|
1544
1582
|
inert,
|
|
1545
1583
|
imports: [...(placeholder?.peachImports ?? []), ...imports],
|
|
@@ -1589,7 +1627,7 @@ function graphStandin(
|
|
|
1589
1627
|
files: { [`${module}.swift`]: source },
|
|
1590
1628
|
...(imports.length ? { dependencies: imports } : {}),
|
|
1591
1629
|
}
|
|
1592
|
-
const before = omit.size + plain.size + unobjc.size + trapped.size
|
|
1630
|
+
const before = omit.size + plain.size + unobjc.size + trapped.size + unconformed.size
|
|
1593
1631
|
const elsewhere: string[] = []
|
|
1594
1632
|
for (const match of check.stderr.matchAll(/^(\S+?):(\d+):\d+: error: (.*)$/gm)) {
|
|
1595
1633
|
const owner = match[1] === file ? owners[Number(match[2]) - 1] : undefined
|
|
@@ -1599,6 +1637,15 @@ function graphStandin(
|
|
|
1599
1637
|
unobjc.add(owner)
|
|
1600
1638
|
continue
|
|
1601
1639
|
}
|
|
1640
|
+
// an objective-c protocol the guest adapts to a swift one checks the
|
|
1641
|
+
// nullability a swift class's exported witness differs in
|
|
1642
|
+
const conformance = /^type '\w+' does not conform to protocol '(\w+)'$/.exec(
|
|
1643
|
+
match[3]!,
|
|
1644
|
+
)?.[1]
|
|
1645
|
+
if (owner && conformance && objcProtocols.has(conformance)) {
|
|
1646
|
+
unconformed.set(owner, new Set([...(unconformed.get(owner) ?? []), conformance]))
|
|
1647
|
+
continue
|
|
1648
|
+
}
|
|
1602
1649
|
if (owner && swiftPaths.has(owner))
|
|
1603
1650
|
throw new Error(
|
|
1604
1651
|
`Swift declaration ${module}.${owner} does not typecheck: ${match[3]}`,
|
|
@@ -1615,7 +1662,7 @@ function graphStandin(
|
|
|
1615
1662
|
else if (owner) omit.set(owner, `rejected by swiftc: ${match[3]}`)
|
|
1616
1663
|
else elsewhere.push(match[3]!)
|
|
1617
1664
|
}
|
|
1618
|
-
if (omit.size + plain.size + unobjc.size + trapped.size === before)
|
|
1665
|
+
if (omit.size + plain.size + unobjc.size + trapped.size + unconformed.size === before)
|
|
1619
1666
|
throw new Error(
|
|
1620
1667
|
`its generated source does not typecheck: ${elsewhere.slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
|
|
1621
1668
|
)
|
|
@@ -1788,7 +1835,20 @@ function cStandin(
|
|
|
1788
1835
|
toolchain: Toolchain,
|
|
1789
1836
|
work: string,
|
|
1790
1837
|
): SwiftStandin {
|
|
1791
|
-
const
|
|
1838
|
+
const everyHeader = files(surface.headers, (name) => name.endsWith('.h'))
|
|
1839
|
+
const moduleRoots = moduleMapHeaders(surface.modulemap, everyHeader)
|
|
1840
|
+
// the module's headers and the local headers they include: a map of several modules
|
|
1841
|
+
// (one per uniffi header) gives each its own
|
|
1842
|
+
const headers = [...moduleRoots]
|
|
1843
|
+
for (let at = 0; at < headers.length; at++)
|
|
1844
|
+
for (const [, local] of fs
|
|
1845
|
+
.readFileSync(path.join(surface.headers, headers[at]!), 'utf8')
|
|
1846
|
+
.matchAll(/^\s*#\s*(?:include|import)\s*["<]([^">]+)[">]/gm)) {
|
|
1847
|
+
const file = path.posix.normalize(
|
|
1848
|
+
path.posix.join(path.posix.dirname(headers[at]!), local!),
|
|
1849
|
+
)
|
|
1850
|
+
if (everyHeader.includes(file) && !headers.includes(file)) headers.push(file)
|
|
1851
|
+
}
|
|
1792
1852
|
const framework = path.basename(path.dirname(surface.modulemap)) === 'Modules'
|
|
1793
1853
|
const headerDirectory = framework ? `${surface.module}.framework/Headers` : '.'
|
|
1794
1854
|
const texts = new Map(
|
|
@@ -1804,9 +1864,7 @@ function cStandin(
|
|
|
1804
1864
|
fs.mkdirSync(path.dirname(path.join(include, file)), { recursive: true })
|
|
1805
1865
|
fs.writeFileSync(path.join(include, file), text)
|
|
1806
1866
|
}
|
|
1807
|
-
const roots =
|
|
1808
|
-
path.posix.join(headerDirectory, file),
|
|
1809
|
-
)
|
|
1867
|
+
const roots = moduleRoots.map((file) => path.posix.join(headerDirectory, file))
|
|
1810
1868
|
const frameworkMap = `${surface.module}.framework/Modules/module.modulemap`
|
|
1811
1869
|
const modulemap = `module ${surface.module} {\n${roots.map((file) => ` header "${file}"\n`).join('')} export *\n}\n`
|
|
1812
1870
|
const probe = path.join(work, 'declarations.c')
|
|
@@ -2728,9 +2786,14 @@ async function binaryStandins(
|
|
|
2728
2786
|
fs.rmSync(work, { recursive: true, force: true })
|
|
2729
2787
|
return error instanceof Error ? error.message : String(error)
|
|
2730
2788
|
}
|
|
2789
|
+
// a framework whose module map names headers it does not ship declares nothing
|
|
2731
2790
|
const found = all.filter(
|
|
2732
2791
|
(surface) =>
|
|
2733
2792
|
!provided.has(surface.module) &&
|
|
2793
|
+
(surface.kind === 'swift' ||
|
|
2794
|
+
surface.kind === 'mixed' ||
|
|
2795
|
+
surface.kind === 'source' ||
|
|
2796
|
+
files(surface.headers, (name) => name.endsWith('.h')).length > 0) &&
|
|
2734
2797
|
!(binary.cxxHeaders === undefined && cxxOnly(surface)),
|
|
2735
2798
|
)
|
|
2736
2799
|
if (found.length === 0) {
|