peachsim 0.1.822 → 0.1.823

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.
Files changed (77) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/agent-identity.cjs +1 -1
  4. package/dist-lib/agent-sessions.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/bundle-channel.cjs +169 -44
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cli-constants.cjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +169 -44
  29. package/dist-lib/expo-swift-metadata.cjs +1 -1
  30. package/dist-lib/expo-swift-metadata.mjs +1 -1
  31. package/dist-lib/home-paths.cjs +1 -1
  32. package/dist-lib/host/bridge-host.cjs +169 -44
  33. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  36. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  37. package/dist-lib/host/websocket-proxy.cjs +1 -1
  38. package/dist-lib/index.cjs +1 -1
  39. package/dist-lib/jump-to-source-babel.cjs +1 -1
  40. package/dist-lib/jump-to-source-native.cjs +1 -1
  41. package/dist-lib/kotlin-host.cjs +1 -1
  42. package/dist-lib/menu.cjs +1 -1
  43. package/dist-lib/menu.mjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  46. package/dist-lib/metro-production-bundle.cjs +1 -1
  47. package/dist-lib/metro-production-bundle.mjs +1 -1
  48. package/dist-lib/metro.cjs +1 -1
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/plist.cjs +1 -1
  54. package/dist-lib/plist.mjs +1 -1
  55. package/dist-lib/profiles.cjs +1 -1
  56. package/dist-lib/public-brand.cjs +1 -1
  57. package/dist-lib/react-native-host-modules.cjs +1 -1
  58. package/dist-lib/react-native-host-modules.mjs +1 -1
  59. package/dist-lib/render-mode.cjs +1 -1
  60. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  61. package/dist-lib/sdk.cjs +1 -1
  62. package/dist-lib/sdk.mjs +1 -1
  63. package/dist-lib/skills.cjs +169 -44
  64. package/dist-lib/swift-compile.cjs +169 -44
  65. package/dist-lib/swift-compile.mjs +169 -44
  66. package/dist-lib/swift-package.cjs +1 -1
  67. package/dist-lib/swift-package.mjs +1 -1
  68. package/dist-lib/swift-submit.cjs +1 -1
  69. package/dist-lib/swift-submit.mjs +1 -1
  70. package/dist-lib/swift-toolchain.cjs +1 -1
  71. package/dist-lib/swift.cjs +1 -1
  72. package/dist-lib/vite-swift.cjs +169 -44
  73. package/dist-lib/vite.cjs +1 -1
  74. package/dist-lib/worklet-executable.cjs +1 -1
  75. package/dist-lib/worklet-executable.mjs +1 -1
  76. package/package.json +1 -1
  77. package/src/swift-compile.ts +183 -48
@@ -1427,10 +1427,29 @@ export function tableProtocolConformances(sources: string[]): Map<string, Set<st
1427
1427
  for (const source of sources) {
1428
1428
  const code = swiftCodeMask(source)
1429
1429
  for (const owner of code.matchAll(
1430
- /\b(?:class|extension)\s+([A-Za-z_]\w*)\s*:\s*([^{}]+)\{/g,
1430
+ /\b(?:class|extension|protocol)\s+(?!(?:func|var)\b)([A-Za-z_]\w*)([^{}]*)\{/g,
1431
1431
  )) {
1432
+ // generic constraints are not inheritance. find the colon outside <...>.
1433
+ const header = owner[2]!
1434
+ let depth = 0
1435
+ let colon = -1
1436
+ for (let at = 0; at < header.length; at++) {
1437
+ if (header[at] === '<') depth++
1438
+ else if (header[at] === '>') depth--
1439
+ else if (header[at] === ':' && depth === 0) {
1440
+ colon = at
1441
+ break
1442
+ }
1443
+ }
1444
+ if (colon === -1) continue
1432
1445
  const inherited = parents.get(owner[1]!) ?? new Set<string>()
1433
- for (const type of owner[2]!.matchAll(/\b[A-Za-z_]\w*\b/g)) inherited.add(type[0])
1446
+ for (const type of splitTopLevel(header.slice(colon + 1).split(/\bwhere\b/)[0]!)) {
1447
+ const name = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1]
1448
+ // Swift does not infer optional Objective-C witnesses through a
1449
+ // specialized generic superclass. explicit @objc remains exposed by
1450
+ // the normal attribute lowering below.
1451
+ if (name && !type.includes('<')) inherited.add(name)
1452
+ }
1434
1453
  parents.set(owner[1]!, inherited)
1435
1454
  }
1436
1455
  }
@@ -1457,51 +1476,151 @@ function lowerTableProtocolMethods(
1457
1476
  conformances: Map<string, Set<string>>,
1458
1477
  ): string {
1459
1478
  const code = swiftCodeMask(source)
1460
- const dataSource: Record<string, string> = {
1461
- numberOfRowsInSection: 'tableView:numberOfRowsInSection:',
1462
- cellForRowAt: 'tableView:cellForRowAtIndexPath:',
1463
- titleForHeaderInSection: 'tableView:titleForHeaderInSection:',
1464
- titleForFooterInSection: 'tableView:titleForFooterInSection:',
1465
- canEditRowAt: 'tableView:canEditRowAtIndexPath:',
1466
- commit: 'tableView:commitEditingStyle:forRowAtIndexPath:',
1467
- }
1468
- const delegate: Record<string, string> = {
1469
- willDisplay: 'tableView:willDisplayCell:forRowAtIndexPath:',
1470
- didEndDisplaying: 'tableView:didEndDisplayingCell:forRowAtIndexPath:',
1471
- heightForRowAt: 'tableView:heightForRowAtIndexPath:',
1472
- estimatedHeightForRowAt: 'tableView:estimatedHeightForRowAtIndexPath:',
1473
- heightForHeaderInSection: 'tableView:heightForHeaderInSection:',
1474
- heightForFooterInSection: 'tableView:heightForFooterInSection:',
1475
- estimatedHeightForHeaderInSection: 'tableView:estimatedHeightForHeaderInSection:',
1476
- estimatedHeightForFooterInSection: 'tableView:estimatedHeightForFooterInSection:',
1477
- viewForHeaderInSection: 'tableView:viewForHeaderInSection:',
1478
- viewForFooterInSection: 'tableView:viewForFooterInSection:',
1479
- willDisplayHeaderView: 'tableView:willDisplayHeaderView:forSection:',
1480
- willDisplayFooterView: 'tableView:willDisplayFooterView:forSection:',
1481
- didEndDisplayingHeaderView: 'tableView:didEndDisplayingHeaderView:forSection:',
1482
- didEndDisplayingFooterView: 'tableView:didEndDisplayingFooterView:forSection:',
1483
- shouldHighlightRowAt: 'tableView:shouldHighlightRowAtIndexPath:',
1484
- didHighlightRowAt: 'tableView:didHighlightRowAtIndexPath:',
1485
- didUnhighlightRowAt: 'tableView:didUnhighlightRowAtIndexPath:',
1486
- willSelectRowAt: 'tableView:willSelectRowAtIndexPath:',
1487
- willDeselectRowAt: 'tableView:willDeselectRowAtIndexPath:',
1488
- didSelectRowAt: 'tableView:didSelectRowAtIndexPath:',
1489
- didDeselectRowAt: 'tableView:didDeselectRowAtIndexPath:',
1490
- accessoryButtonTappedForRowWith:
1479
+ const dataSource: Record<string, readonly [string, string]> = {
1480
+ numberOfRowsInSection: [
1481
+ 'tableView:numberOfRowsInSection:',
1482
+ '_:UITableView,numberOfRowsInSection:Int->Int',
1483
+ ],
1484
+ cellForRowAt: [
1485
+ 'tableView:cellForRowAtIndexPath:',
1486
+ '_:UITableView,cellForRowAt:IndexPath->UITableViewCell',
1487
+ ],
1488
+ titleForHeaderInSection: [
1489
+ 'tableView:titleForHeaderInSection:',
1490
+ '_:UITableView,titleForHeaderInSection:Int->String?',
1491
+ ],
1492
+ titleForFooterInSection: [
1493
+ 'tableView:titleForFooterInSection:',
1494
+ '_:UITableView,titleForFooterInSection:Int->String?',
1495
+ ],
1496
+ canEditRowAt: [
1497
+ 'tableView:canEditRowAtIndexPath:',
1498
+ '_:UITableView,canEditRowAt:IndexPath->Bool',
1499
+ ],
1500
+ commit: [
1501
+ 'tableView:commitEditingStyle:forRowAtIndexPath:',
1502
+ '_:UITableView,commit:UITableViewCell.EditingStyle,forRowAt:IndexPath->Void',
1503
+ ],
1504
+ }
1505
+ const delegate: Record<string, readonly [string, string]> = {
1506
+ willDisplay: [
1507
+ 'tableView:willDisplayCell:forRowAtIndexPath:',
1508
+ '_:UITableView,willDisplay:UITableViewCell,forRowAt:IndexPath->Void',
1509
+ ],
1510
+ didEndDisplaying: [
1511
+ 'tableView:didEndDisplayingCell:forRowAtIndexPath:',
1512
+ '_:UITableView,didEndDisplaying:UITableViewCell,forRowAt:IndexPath->Void',
1513
+ ],
1514
+ heightForRowAt: [
1515
+ 'tableView:heightForRowAtIndexPath:',
1516
+ '_:UITableView,heightForRowAt:IndexPath->CGFloat',
1517
+ ],
1518
+ estimatedHeightForRowAt: [
1519
+ 'tableView:estimatedHeightForRowAtIndexPath:',
1520
+ '_:UITableView,estimatedHeightForRowAt:IndexPath->CGFloat',
1521
+ ],
1522
+ heightForHeaderInSection: [
1523
+ 'tableView:heightForHeaderInSection:',
1524
+ '_:UITableView,heightForHeaderInSection:Int->CGFloat',
1525
+ ],
1526
+ heightForFooterInSection: [
1527
+ 'tableView:heightForFooterInSection:',
1528
+ '_:UITableView,heightForFooterInSection:Int->CGFloat',
1529
+ ],
1530
+ estimatedHeightForHeaderInSection: [
1531
+ 'tableView:estimatedHeightForHeaderInSection:',
1532
+ '_:UITableView,estimatedHeightForHeaderInSection:Int->CGFloat',
1533
+ ],
1534
+ estimatedHeightForFooterInSection: [
1535
+ 'tableView:estimatedHeightForFooterInSection:',
1536
+ '_:UITableView,estimatedHeightForFooterInSection:Int->CGFloat',
1537
+ ],
1538
+ viewForHeaderInSection: [
1539
+ 'tableView:viewForHeaderInSection:',
1540
+ '_:UITableView,viewForHeaderInSection:Int->UIView?',
1541
+ ],
1542
+ viewForFooterInSection: [
1543
+ 'tableView:viewForFooterInSection:',
1544
+ '_:UITableView,viewForFooterInSection:Int->UIView?',
1545
+ ],
1546
+ willDisplayHeaderView: [
1547
+ 'tableView:willDisplayHeaderView:forSection:',
1548
+ '_:UITableView,willDisplayHeaderView:UIView,forSection:Int->Void',
1549
+ ],
1550
+ willDisplayFooterView: [
1551
+ 'tableView:willDisplayFooterView:forSection:',
1552
+ '_:UITableView,willDisplayFooterView:UIView,forSection:Int->Void',
1553
+ ],
1554
+ didEndDisplayingHeaderView: [
1555
+ 'tableView:didEndDisplayingHeaderView:forSection:',
1556
+ '_:UITableView,didEndDisplayingHeaderView:UIView,forSection:Int->Void',
1557
+ ],
1558
+ didEndDisplayingFooterView: [
1559
+ 'tableView:didEndDisplayingFooterView:forSection:',
1560
+ '_:UITableView,didEndDisplayingFooterView:UIView,forSection:Int->Void',
1561
+ ],
1562
+ shouldHighlightRowAt: [
1563
+ 'tableView:shouldHighlightRowAtIndexPath:',
1564
+ '_:UITableView,shouldHighlightRowAt:IndexPath->Bool',
1565
+ ],
1566
+ didHighlightRowAt: [
1567
+ 'tableView:didHighlightRowAtIndexPath:',
1568
+ '_:UITableView,didHighlightRowAt:IndexPath->Void',
1569
+ ],
1570
+ didUnhighlightRowAt: [
1571
+ 'tableView:didUnhighlightRowAtIndexPath:',
1572
+ '_:UITableView,didUnhighlightRowAt:IndexPath->Void',
1573
+ ],
1574
+ willSelectRowAt: [
1575
+ 'tableView:willSelectRowAtIndexPath:',
1576
+ '_:UITableView,willSelectRowAt:IndexPath->IndexPath?',
1577
+ ],
1578
+ willDeselectRowAt: [
1579
+ 'tableView:willDeselectRowAtIndexPath:',
1580
+ '_:UITableView,willDeselectRowAt:IndexPath->IndexPath?',
1581
+ ],
1582
+ didSelectRowAt: [
1583
+ 'tableView:didSelectRowAtIndexPath:',
1584
+ '_:UITableView,didSelectRowAt:IndexPath->Void',
1585
+ ],
1586
+ didDeselectRowAt: [
1587
+ 'tableView:didDeselectRowAtIndexPath:',
1588
+ '_:UITableView,didDeselectRowAt:IndexPath->Void',
1589
+ ],
1590
+ accessoryButtonTappedForRowWith: [
1491
1591
  'tableView:accessoryButtonTappedForRowWithIndexPath:',
1492
- editingStyleForRowAt: 'tableView:editingStyleForRowAtIndexPath:',
1493
- leadingSwipeActionsConfigurationForRowAt:
1592
+ '_:UITableView,accessoryButtonTappedForRowWith:IndexPath->Void',
1593
+ ],
1594
+ editingStyleForRowAt: [
1595
+ 'tableView:editingStyleForRowAtIndexPath:',
1596
+ '_:UITableView,editingStyleForRowAt:IndexPath->UITableViewCell.EditingStyle',
1597
+ ],
1598
+ leadingSwipeActionsConfigurationForRowAt: [
1494
1599
  'tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:',
1495
- trailingSwipeActionsConfigurationForRowAt:
1600
+ '_:UITableView,leadingSwipeActionsConfigurationForRowAt:IndexPath->UISwipeActionsConfiguration?',
1601
+ ],
1602
+ trailingSwipeActionsConfigurationForRowAt: [
1496
1603
  'tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:',
1497
- willBeginEditingRowAt: 'tableView:willBeginEditingRowAtIndexPath:',
1498
- didEndEditingRowAt: 'tableView:didEndEditingRowAtIndexPath:',
1604
+ '_:UITableView,trailingSwipeActionsConfigurationForRowAt:IndexPath->UISwipeActionsConfiguration?',
1605
+ ],
1606
+ willBeginEditingRowAt: [
1607
+ 'tableView:willBeginEditingRowAtIndexPath:',
1608
+ '_:UITableView,willBeginEditingRowAt:IndexPath->Void',
1609
+ ],
1610
+ didEndEditingRowAt: [
1611
+ 'tableView:didEndEditingRowAtIndexPath:',
1612
+ '_:UITableView,didEndEditingRowAt:IndexPath?->Void',
1613
+ ],
1499
1614
  }
1500
1615
  const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index)
1501
1616
  const edits: [number, string][] = []
1502
1617
  for (const owner of code.matchAll(/\b(?:class|extension)\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
1503
1618
  const conforms = conformances.get(owner[1]!)
1504
1619
  if (!conforms) continue
1620
+ // direct generic conformances dispatch through their Swift witness;
1621
+ // inferred selector records apply to nongeneric class declarations.
1622
+ if (/^\s*</.test(owner[0].slice(owner[0].indexOf(owner[1]!) + owner[1]!.length)))
1623
+ continue
1505
1624
  const selectors = {
1506
1625
  ...(conforms.has('UITableViewDataSource') ? dataSource : {}),
1507
1626
  ...(conforms.has('UITableViewDelegate') ? delegate : {}),
@@ -1527,19 +1646,35 @@ function lowerTableProtocolMethods(
1527
1646
  if (/\b(?:override|static|class)\b|@(?:objc|ObjC|IBAction)\b/.test(attributes))
1528
1647
  continue
1529
1648
  let selector: string | undefined
1530
- if (
1531
- conforms.has('UITableViewDataSource') &&
1532
- /^func\s+numberOfSections\s*\(\s*in\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*\)/.test(
1649
+ const method =
1650
+ /^func\s+(tableView|numberOfSections)\s*\(([^()]*)\)\s*(?:->\s*([\w.?!]+|\(\s*\)))?\s*$/.exec(
1533
1651
  signature,
1534
1652
  )
1535
- )
1536
- selector = 'numberOfSectionsInTableView:'
1537
- else {
1538
- const match =
1539
- /^func\s+tableView\s*\(\s*_\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*,\s*(\w+)\b/.exec(
1540
- signature,
1653
+ if (method) {
1654
+ const parameters = splitTopLevel(method[2]!)
1655
+ .map((parameter) => {
1656
+ const match = /^(?:(\w+)\s+)?(\w+)\s*:\s*([\w.?]+)\s*$/.exec(parameter)
1657
+ return match ? `${match[1] ?? match[2]}:${match[3]}` : ''
1658
+ })
1659
+ .join(',')
1660
+ .replace(/\b(?:UIKit|UIKitCore|Foundation|CoreGraphics|Swift)\./g, '')
1661
+ const result = (method[3] ?? 'Void')
1662
+ .replace(/\(\s*\)/, 'Void')
1663
+ .replaceAll('!', '?')
1664
+ .replace(/\b(?:UIKit|UIKitCore|Foundation|CoreGraphics|Swift)\./g, '')
1665
+ if (method[1] === 'numberOfSections') {
1666
+ if (
1667
+ conforms.has('UITableViewDataSource') &&
1668
+ parameters === 'in:UITableView' &&
1669
+ result === 'Int'
1541
1670
  )
1542
- if (match) selector = selectors[match[1]!]
1671
+ selector = 'numberOfSectionsInTableView:'
1672
+ } else {
1673
+ const label = /^_:UITableView,(\w+):/.exec(parameters)?.[1]
1674
+ const requirement = label ? selectors[label] : undefined
1675
+ if (requirement && `${parameters}->${result}` === requirement[1])
1676
+ selector = requirement[0]
1677
+ }
1543
1678
  }
1544
1679
  if (selector)
1545
1680
  edits.push([