( device: Pick<DeviceInfo, 'platform' | 'appleOs'>, selector: PlatformSelector | undefined, )
| 152 | } |
| 153 | |
| 154 | export function matchesPlatformSelector( |
| 155 | device: Pick<DeviceInfo, 'platform' | 'appleOs'>, |
| 156 | selector: PlatformSelector | undefined, |
| 157 | ): boolean { |
| 158 | if (!selector) return true; |
| 159 | if (selector === 'apple') return isApplePlatform(device.platform); |
| 160 | // Legacy leaf selectors resolve within the collapsed `apple` platform via `appleOs`, |
| 161 | // preserving the pre-collapse `--platform ios|macos` device sets exactly. |
| 162 | if (selector === 'ios') return isApplePlatform(device.platform) && !isMacOs(device); |
| 163 | if (selector === 'macos') return isApplePlatform(device.platform) && isMacOs(device); |
| 164 | return device.platform === selector; |
| 165 | } |
| 166 | |
| 167 | export function resolveApplePlatformName( |
| 168 | platformOrTarget: ApplePlatform | DeviceTarget | undefined, |
no test coverage detected