peachsim 0.1.1716 → 0.1.1728

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 (234) hide show
  1. package/README.md +21 -3
  2. package/cli/app-bundle-resources.ts +2 -1
  3. package/cli/app-fonts.ts +4 -4
  4. package/cli/app-splash.ts +4 -4
  5. package/cli/app-stubs.ts +17 -0
  6. package/cli/command-registry.ts +1 -0
  7. package/cli/commands/control.ts +82 -822
  8. package/cli/commands/daemon.ts +8 -0
  9. package/cli/commands/detox.ts +3 -0
  10. package/cli/commands/doctor.ts +19 -2
  11. package/cli/commands/inspect/actions.ts +74 -14
  12. package/cli/commands/inspect/core.ts +5 -1
  13. package/cli/commands/inspect/settling.ts +5 -2
  14. package/cli/commands/inspect/wait-ready.ts +6 -0
  15. package/cli/commands/inspect.ts +48 -45
  16. package/cli/commands/kotlin.ts +12 -2
  17. package/cli/commands/package.ts +750 -0
  18. package/cli/commands/serve.ts +6 -0
  19. package/cli/commands/shell-url.ts +834 -0
  20. package/cli/commands/swift.ts +42 -102
  21. package/cli/commands/test.ts +20 -0
  22. package/cli/commands/upload.ts +1 -1
  23. package/cli/device-option.ts +1 -1
  24. package/cli/main.ts +13 -1
  25. package/cli/native-input.ts +199 -0
  26. package/cli/outbound-endpoints.ts +26 -1
  27. package/cli/packaged-app-launcher.ts +95 -0
  28. package/cli/scene-video.ts +13 -6
  29. package/detox/index.ts +187 -23
  30. package/dist-lib/agent-daemon-client.cjs +1 -1
  31. package/dist-lib/agent-events.cjs +1 -1
  32. package/dist-lib/attached-projects.cjs +1 -1
  33. package/dist-lib/auth/shared-session.cjs +1 -1
  34. package/dist-lib/backend-origin.cjs +1 -1
  35. package/dist-lib/beta.cjs +1 -1
  36. package/dist-lib/beta.mjs +1 -1
  37. package/dist-lib/bridge-constants.cjs +1 -1
  38. package/dist-lib/bridge-contract-input.cjs +1 -1
  39. package/dist-lib/bridge-contract-input.mjs +1 -1
  40. package/dist-lib/bridge-contract.cjs +1 -1
  41. package/dist-lib/bridge-contract.mjs +1 -1
  42. package/dist-lib/bundle-channel.cjs +38000 -31658
  43. package/dist-lib/capture-contract.cjs +1 -1
  44. package/dist-lib/capture-contract.mjs +1 -1
  45. package/dist-lib/cloud-contract.cjs +1 -1
  46. package/dist-lib/cloud-contract.mjs +1 -1
  47. package/dist-lib/cloud-test-args.cjs +1 -1
  48. package/dist-lib/cloud-test-args.mjs +1 -1
  49. package/dist-lib/cloud.cjs +1 -1
  50. package/dist-lib/cloud.mjs +1 -1
  51. package/dist-lib/config.cjs +1 -1
  52. package/dist-lib/config.mjs +1 -1
  53. package/dist-lib/detox/index.cjs +184 -60
  54. package/dist-lib/dev-bundle-resolution.cjs +14 -13
  55. package/dist-lib/expo-swift-bundle.cjs +18199 -11834
  56. package/dist-lib/expo-swift-metadata.cjs +4 -1
  57. package/dist-lib/expo-swift-metadata.mjs +3 -1
  58. package/dist-lib/home-paths.cjs +21 -2
  59. package/dist-lib/host/bridge-host.cjs +26509 -23850
  60. package/dist-lib/host/fetch-proxy-handler.cjs +221 -222
  61. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  62. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  63. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  64. package/dist-lib/host/websocket-proxy.cjs +1 -1
  65. package/dist-lib/index.cjs +876 -389
  66. package/dist-lib/jump-to-source-babel.cjs +1 -1
  67. package/dist-lib/jump-to-source-native.cjs +1 -1
  68. package/dist-lib/kotlin-host.cjs +127 -16
  69. package/dist-lib/menu.cjs +7 -1
  70. package/dist-lib/menu.mjs +7 -1
  71. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  72. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  73. package/dist-lib/metro-production-bundle.cjs +1 -1
  74. package/dist-lib/metro-production-bundle.mjs +1 -1
  75. package/dist-lib/metro.cjs +883 -404
  76. package/dist-lib/native-app-identity-project.cjs +694 -280
  77. package/dist-lib/native-app-identity-project.mjs +490 -83
  78. package/dist-lib/native-app-identity.cjs +13 -2
  79. package/dist-lib/native-app-identity.mjs +13 -2
  80. package/dist-lib/native-firebase-metadata.cjs +1 -1
  81. package/dist-lib/native-firebase-metadata.mjs +1 -1
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +1 -1
  84. package/dist-lib/profiles.cjs +1 -1
  85. package/dist-lib/public-brand.cjs +1 -1
  86. package/dist-lib/public-origins-lib-esm.json +28 -23
  87. package/dist-lib/public-origins-lib.json +392 -224
  88. package/dist-lib/react-native-host-modules.cjs +32 -2
  89. package/dist-lib/react-native-host-modules.mjs +32 -2
  90. package/dist-lib/reap-browser.cjs +12 -4
  91. package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
  92. package/dist-lib/sdk.cjs +17 -7
  93. package/dist-lib/sdk.mjs +16 -7
  94. package/dist-lib/skills.cjs +61838 -47851
  95. package/dist-lib/swift-compile.cjs +583 -360
  96. package/dist-lib/swift-compile.mjs +496 -275
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +1 -1
  99. package/dist-lib/swift-submit.cjs +2 -2
  100. package/dist-lib/swift-submit.mjs +2 -2
  101. package/dist-lib/swift-toolchain.cjs +105 -17
  102. package/dist-lib/swift.cjs +1 -1
  103. package/dist-lib/vite-swift.cjs +4453 -2231
  104. package/dist-lib/vite.cjs +230 -228
  105. package/dist-lib/worklet-executable.cjs +1 -1
  106. package/dist-lib/worklet-executable.mjs +1 -1
  107. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
  108. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
  109. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +7 -5
  110. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +3 -1
  111. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -11
  112. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  113. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
  114. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  115. package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
  116. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +4 -0
  117. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  118. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +23 -1
  119. package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
  120. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
  121. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  122. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
  123. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
  124. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
  125. package/package.json +1 -1
  126. package/runtime-companion.json +1 -1
  127. package/scripts/dev-server-scanner.ts +12 -25
  128. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
  129. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
  130. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
  131. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
  132. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
  133. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
  134. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
  135. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
  136. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
  137. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
  138. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -0
  139. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
  140. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
  141. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +75 -9
  142. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
  143. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
  144. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
  145. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
  146. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
  147. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
  148. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
  149. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
  150. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
  151. package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
  152. package/sdk/ios/usr/include/module.modulemap +1 -0
  153. package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
  154. package/sdk/ios/usr/include/os.modulemap +5 -0
  155. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  156. package/sdk/ios/usr/include/sys/ioccom.h +99 -0
  157. package/sdk/ios/usr/include/sys/syslog.h +236 -0
  158. package/sdk/ios/usr/include/syslog.h +24 -0
  159. package/sdk/ios/wasm/include/fcntl.h +4 -2
  160. package/sdk/ios/wasm/include/stdio.h +24 -0
  161. package/sdk/ios/wasm/include/stdlib.h +32 -7
  162. package/sdk/ios/wasm/include/sys/file.h +7 -0
  163. package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
  164. package/sdk/ios/wasm/include/sys/syscall.h +9 -0
  165. package/sdk/ios/wasm/include/sys/time.h +10 -0
  166. package/sdk/ios/wasm/include/unistd.h +12 -3
  167. package/sdk/native-hashes.json +1 -0
  168. package/skills/contrast/SKILL.md +2 -1
  169. package/skills/peach-test/SKILL.md +7 -3
  170. package/src/admitted-mac-build.ts +3 -0
  171. package/src/android-app-identity.ts +18 -0
  172. package/src/android-root-module.ts +9 -9
  173. package/src/appPackageContract.ts +81 -0
  174. package/src/bridge-contract.ts +50 -0
  175. package/src/bundle-channel.mjs +21 -4
  176. package/src/dev-bundle-resolution.ts +7 -27
  177. package/src/dom-source-reference.ts +15 -0
  178. package/src/expo-discovery-cache.ts +127 -23
  179. package/src/expo-manifest-body.ts +33 -0
  180. package/src/expo-native-workspace.ts +38 -13
  181. package/src/expo-swift-host.ts +264 -62
  182. package/src/expoSwiftContract.ts +3 -0
  183. package/src/generated/swift-c-predefines.json +1 -1
  184. package/src/home-paths.ts +35 -1
  185. package/src/host/app-package-handler.ts +47 -0
  186. package/src/host/bridge-host.ts +3 -0
  187. package/src/host/staged-host-files.ts +18 -0
  188. package/src/index.ts +3 -0
  189. package/src/kotlin-host.ts +21 -18
  190. package/src/kotlin-instance-source.ts +126 -0
  191. package/src/menu.ts +7 -0
  192. package/src/native-app-identity-project.ts +7 -2
  193. package/src/native-app-identity.ts +11 -0
  194. package/src/native-firebase-config.ts +24 -1
  195. package/src/nitro-adapter.lock.json +268 -268
  196. package/src/nitro-bundle.ts +8 -0
  197. package/src/nitro-compile.ts +35 -9
  198. package/src/nitro-dependencies.ts +21 -19
  199. package/src/nitro-source.ts +4 -0
  200. package/src/nitroContract.ts +7 -0
  201. package/src/react-native-bridge-modules.ts +68 -42
  202. package/src/react-native-host-modules.ts +31 -1
  203. package/src/reactNativeConfigurationContract.ts +14 -0
  204. package/src/reap-browser.ts +15 -3
  205. package/src/sdk.ts +5 -0
  206. package/src/settingsContract.ts +27 -1
  207. package/src/sim-client.ts +4 -1
  208. package/src/storageSnapshotContract.ts +3 -0
  209. package/src/swift-compile.ts +221 -41
  210. package/src/swift-coverage/provenance.ts +1 -0
  211. package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
  212. package/src/swift-coverage/xcode-assets.ts +89 -131
  213. package/src/swift-coverage/xcode.ts +1 -1
  214. package/src/swift-cxx-reachable.ts +2 -1
  215. package/src/swift-distribution.lock.json +14 -13
  216. package/src/swift-host.ts +95 -22
  217. package/src/swift-icu.ts +1 -1
  218. package/src/swift-link-roots.ts +118 -0
  219. package/src/swift-objc-compile.ts +144 -22
  220. package/src/swift-objc-import.ts +6 -0
  221. package/src/swift-objc-standin.ts +2 -14
  222. package/src/swift-package-manifest.ts +14 -6
  223. package/src/swift-packages.ts +75 -11
  224. package/src/swift-pdf-raster.ts +1 -0
  225. package/src/swift-root-lock.ts +17 -1
  226. package/src/swift-source-pods.ts +2 -10
  227. package/src/swift-standin-emit.ts +592 -57
  228. package/src/swift-standins.ts +430 -49
  229. package/src/swift-submit.ts +3 -1
  230. package/src/swift-toolchain.ts +140 -17
  231. package/src/turbo-codegen-intake.ts +91 -0
  232. package/src/vite-plugin-one.ts +13 -9
  233. package/src/vite-plugin.ts +28 -15
  234. package/src/xcode-project.ts +223 -22
@@ -107,6 +107,7 @@ interface CacheRow {
107
107
  resizeHeight: number | null;
108
108
  rasterTarget: RasterDecodeTarget | null;
109
109
  }
110
+ export declare function countWindowPendingFetches(reachesWindow: (node: SootSimNode) => boolean): number;
110
111
  export declare function getImageLoaderStats(): {
111
112
  cacheEntries: number;
112
113
  cacheRows: {
@@ -123,8 +124,8 @@ export declare function getImageLoaderStats(): {
123
124
  inImagePaint: boolean;
124
125
  cachePixelBudget: number;
125
126
  cacheMaxEntries: number;
126
- pendingFetches: number;
127
127
  pendingBytes: number;
128
+ fetchesInFlight: number;
128
129
  failedUris: number;
129
130
  snapshots: number;
130
131
  snapshotPerf: {
@@ -327,7 +328,7 @@ export declare function getImageNodeDecodedScale(node: SootSimNode): number | nu
327
328
  export declare function getImageNodeTransform(node: SootSimNode, transformKey: string): readonly (SkImage | null)[] | null;
328
329
  export declare function storeImageNodeTransform(node: SootSimNode, transformKey: string, images: readonly (SkImage | null)[]): boolean;
329
330
  export declare function getImageNodeRepeatShaders(node: SootSimNode, transformKey: string, tileModes: readonly (readonly [TileMode, TileMode])[]): readonly (SkShader | null)[] | null;
330
- export declare function getImageSize(uri: string, headers?: Record<string, string>): Promise<{
331
+ export declare function getImageSize(uri: string, headers?: Record<string, string>, nativeUserAgent?: string | null): Promise<{
331
332
  width: number;
332
333
  height: number;
333
334
  } | null>;
@@ -351,8 +352,9 @@ export declare function hasSootSimFile(uri: string): boolean;
351
352
  export declare function readSootSimFileBytes(uri: string): Uint8Array | null;
352
353
  export declare function storeImageBytes(uri: string, buffer: ArrayBuffer, headers?: Record<string, string>): void;
353
354
  export declare function registerRecordedImageBytes(uri: string, buffer: ArrayBuffer, headers?: Record<string, string>): void;
354
- export declare function awaitImageBytes(uri: string, headers?: Record<string, string>): Promise<ArrayBuffer>;
355
- export declare function loadBytesForUri(uri: string, headers?: Record<string, string>, signal?: AbortSignal, onProgress?: (event: ImageDownloadProgress) => void, downloadTimeoutMs?: number): Promise<Uint8Array>;
355
+ export declare function awaitImageBytes(uri: string, headers?: Record<string, string>, nativeUserAgent?: string | null): Promise<ArrayBuffer>;
356
+ export declare function loadBytesForUri(uri: string, headers?: Record<string, string>, signal?: AbortSignal, onProgress?: (event: ImageDownloadProgress) => void, downloadTimeoutMs?: number, nativeUserAgent?: string | null): Promise<Uint8Array>;
357
+ export declare function setNodeNativeUserAgentResolver(resolver: ((node: SootSimNode) => string | null) | null): void;
356
358
  export declare function setSvgRasterizeFallback(fallback: ((bytes: Uint8Array, targetWidth: number, targetHeight: number) => Promise<Uint8Array | null>) | null): void;
357
359
  export declare function isSvgUri(uri: string): boolean;
358
360
  export declare function looksLikeSvgBytes(bytes: Uint8Array): boolean;
@@ -369,7 +371,7 @@ export declare function clearImageRepeatShader(node: SootSimNode): void;
369
371
  export declare function clearImageNodeRepeatShaders(node: SootSimNode): void;
370
372
  export declare function releaseImageNode(node: SootSimNode): void;
371
373
  export declare function readImagePrefetchRequest(uri: string, exactCacheKey: string): ImageDecodeRequest | null;
372
- export declare function prefetchImage(uri: string, requestId?: number, exactCacheKey?: string, headers?: Record<string, string>, paintNode?: SootSimNode): Promise<boolean>;
374
+ export declare function prefetchImage(uri: string, requestId?: number, exactCacheKey?: string, headers?: Record<string, string>, paintNode?: SootSimNode, nativeUserAgent?: string | null): Promise<boolean>;
373
375
  export declare function sniffImageMediaType(bytes: Uint8Array): string | null;
374
376
  export declare function clearImageCache(uri: string): void;
375
377
  export declare function resolveSvgRasterTargetDimensions(intrinsicWidth: number, intrinsicHeight: number, resizeWidth?: number, resizeHeight?: number): {
@@ -15,7 +15,9 @@ export interface EngineMemoryCounts {
15
15
  detachedTypes: Record<string, number>;
16
16
  objects: ReturnType<typeof readLiveObjectCounts> & ReturnType<typeof hostLedger>;
17
17
  activeNativeAnimations: number;
18
- imageLoader: ReturnType<typeof getImageLoaderStats>;
18
+ imageLoader: ReturnType<typeof getImageLoaderStats> & {
19
+ pendingFetches: number;
20
+ };
19
21
  workerHeap: ReturnType<typeof readJsHeap>;
20
22
  wasmHeapBytes: number | null;
21
23
  swiftWasmHeapBytes: number | null;
@@ -30,17 +30,6 @@ export declare function hasParsedMetalEffects(): boolean;
30
30
  export declare function noteMetalEffects(style: {
31
31
  _filter?: readonly ParsedFilterOp[];
32
32
  }): void;
33
- declare class NodeRegistry {
34
- private map;
35
- private reaper;
36
- set(id: number, node: SootSimNode | SootSimTextNode): this;
37
- get(id: number): SootSimNode | SootSimTextNode | undefined;
38
- delete(id: number): boolean;
39
- values(): IterableIterator<SootSimNode | SootSimTextNode>;
40
- get size(): number;
41
- }
42
- declare const handleToNode: NodeRegistry;
43
- export { handleToNode };
44
33
  export declare function registerHoistUnlinker(unlinker: (node: SootSimNode) => void): void;
45
34
  export declare function registerBackdropGroupSyncer(syncer: (node: SootSimNode, style: Readonly<SootSimStyle> | null) => void): void;
46
35
  export declare function registerLottieNodeDisposer(disposer: (node: SootSimNode) => void): void;
@@ -540,6 +529,7 @@ export declare class SootSimNode {
540
529
  _paintBoundary?: import('./paint-boundary-types.d.ts').PaintBoundaryState | null;
541
530
  __lastBackdropSig?: string;
542
531
  constructor(type: SootSimNodeType, props?: Record<string, any>, nativeRenderer?: NativeRenderer, fabricTextEpsilon?: number, resolvedStyle?: SootSimStyle, svgCurrentColorUsesPaintOpacity?: boolean);
532
+ private hostChildrenChangePending;
543
533
  notifyHostChildrenChange(): void;
544
534
  appendChild(child: SootSimNode): void;
545
535
  insertBefore(child: SootSimNode, before: SootSimNode): void;
@@ -253,6 +253,8 @@ type SootSimLiquidGlassStyle = Omit<LiquidGlassConfig, 'cornerRadius' | 'bodyOpa
253
253
  interactionIntensity?: SootSimAnimatedNumber;
254
254
  };
255
255
  export interface SootSimStyle {
256
+ resizeMode?: 'cover' | 'contain' | 'stretch' | 'center' | 'repeat' | 'none';
257
+ objectFit?: 'contain' | 'cover' | 'fill' | 'scale-down' | 'none';
256
258
  _paragraphStyle?: AttributedParagraphStyle;
257
259
  userInterfaceStyle?: 'light' | 'dark';
258
260
  flex?: number;
@@ -553,6 +555,7 @@ export interface LayoutContext extends RenderContextBase {
553
555
  export interface PrewarmPass {
554
556
  requireProgress: boolean;
555
557
  completed: WeakSet<SootSimNode> | null;
558
+ nodesCompleted: number;
556
559
  reachSkips: number;
557
560
  deadlineMs: number;
558
561
  records: number;
@@ -1168,6 +1168,7 @@ export interface CompositorStats {
1168
1168
  };
1169
1169
  images: ImageLoaderStats & {
1170
1170
  totalCacheEntries: number;
1171
+ pendingFetches: number;
1171
1172
  memoryTrims: number;
1172
1173
  gpuCacheBytes: number | null;
1173
1174
  };
@@ -1350,6 +1351,7 @@ export type CompositorHostToWorker = {
1350
1351
  requestId: number;
1351
1352
  uri: string;
1352
1353
  headers?: Record<string, string>;
1354
+ appId?: string;
1353
1355
  } | {
1354
1356
  type: 'imagePrefetch';
1355
1357
  requestId: number;
@@ -1357,6 +1359,7 @@ export type CompositorHostToWorker = {
1357
1359
  imageRequestId?: number;
1358
1360
  exactCacheKey?: string;
1359
1361
  headers?: Record<string, string>;
1362
+ appId?: string;
1360
1363
  } | {
1361
1364
  type: 'imageStoreBytes';
1362
1365
  requestId: number;
@@ -1368,6 +1371,7 @@ export type CompositorHostToWorker = {
1368
1371
  requestId: number;
1369
1372
  uri: string;
1370
1373
  headers?: Record<string, string>;
1374
+ appId?: string;
1371
1375
  } | {
1372
1376
  type: 'imageAbort';
1373
1377
  requestId: number;
@@ -1530,6 +1534,7 @@ export type ShellToCompositorMessage = {
1530
1534
  surfaces: Array<{
1531
1535
  surfaceId: AuxAppSurfaceId;
1532
1536
  appId: string | null;
1537
+ nativeUserAgent: string | null;
1533
1538
  generation: number;
1534
1539
  paused: boolean;
1535
1540
  wantsChromeLuminance: boolean;
@@ -1762,6 +1767,10 @@ export type CompositorWorkerToHost = {
1762
1767
  key: string;
1763
1768
  } | {
1764
1769
  type: 'bootstrapped';
1770
+ } | {
1771
+ type: 'log';
1772
+ level: 'warn' | 'error';
1773
+ args: string[];
1765
1774
  } | {
1766
1775
  type: 'ready';
1767
1776
  adapter: GraphiteAdapterIdentity;
@@ -318,6 +318,7 @@ export type HostServiceRequest = {
318
318
  requestId: number;
319
319
  uri: string;
320
320
  headers?: Record<string, string>;
321
+ appId?: string;
321
322
  } | {
322
323
  type: 'rnVideoThumbnail';
323
324
  requestId: number;
@@ -330,6 +331,7 @@ export type HostServiceRequest = {
330
331
  imageRequestId?: number;
331
332
  exactCacheKey?: string;
332
333
  headers?: Record<string, string>;
334
+ appId?: string;
333
335
  } | {
334
336
  type: 'rnImageStoreBytes';
335
337
  requestId: number;
@@ -341,6 +343,7 @@ export type HostServiceRequest = {
341
343
  requestId: number;
342
344
  uri: string;
343
345
  headers?: Record<string, string>;
346
+ appId?: string;
344
347
  } | {
345
348
  type: 'rnImageAbort';
346
349
  requestId: number;
@@ -11,7 +11,7 @@ export declare function isNativeUICommandPresentation(request: NativeUIRequest):
11
11
  export declare function isNativeUICommandSettlement(event: NativeUIEvent): event is NativeUICommandSettlement;
12
12
  export declare function nativeUICommandPresentationKind(event: NativeUICommandSettlement): NativeUICommandPresentation['kind'];
13
13
  type NativeUIRead = Extract<ShellTestBridgeRequest, {
14
- method: 'listSemanticInspectable' | 'captureAccessibilityTree' | 'findByText' | 'resolveTapTarget' | 'queryAll';
14
+ method: 'listSemanticInspectable' | 'captureAccessibilityTree' | 'findByText' | 'resolveTapTarget' | 'verifyTapTargetAt' | 'queryAll';
15
15
  }>;
16
16
  export type NativeUICommand = NativeUIRead | {
17
17
  type: 'tap';
@@ -432,6 +432,10 @@ export type ShellHostToWorker = {
432
432
  type: 'registerAppFonts';
433
433
  requestId: number;
434
434
  specs: AppFontWireSpec[];
435
+ } | {
436
+ type: 'nativeFetchUserAgent';
437
+ appId: string;
438
+ userAgent: string | null;
435
439
  } | {
436
440
  type: 'scrollMirror';
437
441
  payload: import('./scroll-mirror.d.ts').ScrollMirrorEnvelope;
@@ -6,7 +6,7 @@ import type { HostToWorker } from './protocol.d.ts';
6
6
  import type { ShellHostToWorker } from './shell-protocol.d.ts';
7
7
  import type { WireSurfaceUpdate } from './shell-tree-wire.d.ts';
8
8
  export type TenantToShellPeerMessage = Extract<ShellHostToWorker, {
9
- type: 'worklet' | 'workletBatch' | 'scrollMirror' | 'scrollControl' | 'nativeUIRequest' | 'gestureSeamRequest' | 'gestureSeamRequestBatch' | 'nativeMenuGestureBegin' | 'cursorMirror' | 'editMenuMirror' | 'loupeMirror' | 'registerAppFonts' | 'requestEngineResource' | 'engineResource' | 'storageSync';
9
+ type: 'worklet' | 'workletBatch' | 'scrollMirror' | 'scrollControl' | 'nativeUIRequest' | 'gestureSeamRequest' | 'gestureSeamRequestBatch' | 'nativeMenuGestureBegin' | 'cursorMirror' | 'editMenuMirror' | 'loupeMirror' | 'registerAppFonts' | 'nativeFetchUserAgent' | 'requestEngineResource' | 'engineResource' | 'storageSync';
10
10
  }>;
11
11
  export type ShellToTenantPeerMessage = Extract<HostToWorker, {
12
12
  type: 'worklet' | 'scrollControl' | 'scrollSlotsRetired' | 'gestureSeamEvent' | 'screenEdgeSwipeCommit' | 'shellScreenInteractive' | 'screenFormSheetCommit' | 'screenTransitionStarted' | 'screenTransitionProgress' | 'cursorRectBack' | 'editMenuRectsBack' | 'imageLifecycleEvent' | 'lottieLifecycleEvent' | 'appFontsRegistered' | 'engineResource' | 'requestEngineResource';
@@ -274,6 +274,10 @@ export type AnimatedPropsWriteSlots = Record<string, {
274
274
  export type WorkletMessagePayload = ({
275
275
  type: 'runWorklet';
276
276
  reanimated2?: true;
277
+ reanimated2Surface?: {
278
+ surfaceId: string;
279
+ generation: number;
280
+ };
277
281
  runId: number;
278
282
  code: string;
279
283
  hash: number;
@@ -301,6 +305,10 @@ export type WorkletMessagePayload = ({
301
305
  } | {
302
306
  type: 'hostValueUpdates';
303
307
  updates: WorkletHostValueUpdate[];
308
+ } | {
309
+ type: 'workletBundleModules';
310
+ key: string;
311
+ modules: WorkletBundleModule[];
304
312
  } | {
305
313
  type: 'workletDone';
306
314
  runId: number;
@@ -560,6 +568,9 @@ export declare class WorkletRuntime {
560
568
  private uiSyncReply;
561
569
  private namedRuntimeDelegate;
562
570
  private readonly bundleModuleGraph;
571
+ private shippedBundleGraphs;
572
+ private shippedBundleSources;
573
+ private peerOwnedBundleKeys;
563
574
  private disposed;
564
575
  private channel;
565
576
  private sab;
@@ -651,6 +662,7 @@ export declare class WorkletRuntime {
651
662
  private frameCallbackSchedule;
652
663
  private frameCallbackRunToken;
653
664
  private nativeFrames;
665
+ private frameTail;
654
666
  private cssRuntime;
655
667
  private cssRuntimeLoadPromise;
656
668
  private pendingCSSMessages;
@@ -885,6 +897,7 @@ export declare class WorkletRuntime {
885
897
  private queueJSCallbackRelease;
886
898
  private serializeValueForDispatch;
887
899
  private serializeClosureForDispatch;
900
+ private shipBundleGraph;
888
901
  private serializeWorkletFunctionForDispatch;
889
902
  private serializeRemoteFunctionForDispatch;
890
903
  postJSCallback(id: number, args: unknown[]): void;
@@ -923,7 +936,10 @@ export declare class WorkletRuntime {
923
936
  private bindRemoteWorklet;
924
937
  }
925
938
  export declare function freezeReanimated2Records<T>(value: T, seen?: WeakSet<WeakKey>): T;
926
- export declare function invokeNativeWorklet(body: (...args: unknown[]) => unknown, receiver: unknown, args: unknown[], closure: object, reanimated2?: boolean): unknown;
939
+ export declare function invokeNativeWorklet(body: (...args: unknown[]) => unknown, receiver: unknown, args: unknown[], closure: object, reanimated2?: boolean, surface?: {
940
+ surfaceId: string;
941
+ generation: number;
942
+ }): unknown;
927
943
  export interface SharedValueProxy {
928
944
  _id: number;
929
945
  _isReanimatedSharedValue: true;
@@ -967,6 +983,12 @@ export declare function serializeValue(value: unknown): ValueSpec;
967
983
  export declare function serializeValueSnapshot(value: unknown): ValueSpec;
968
984
  export declare function serializeClosure(closure: WorkletClosure): ClosureSpec;
969
985
  export declare function markObjectSV(target: object): void;
986
+ interface WorkletBundleModule {
987
+ id: number;
988
+ source: string;
989
+ dependencyMap: number[];
990
+ name: string;
991
+ }
970
992
  interface SanitizeState {
971
993
  seen: WeakMap<object, unknown>;
972
994
  active: WeakSet<object>;
@@ -69,6 +69,7 @@ export type EngineWindowState = {
69
69
  showMenuBar: boolean;
70
70
  showRail: boolean;
71
71
  agentIndicator: boolean;
72
+ systemCursor: boolean;
72
73
  solidWindow: boolean;
73
74
  ambientGlow: AmbientGlowLevel;
74
75
  stageBackground: StageBackground;
@@ -29,5 +29,10 @@ export interface SootSimAudioRecorderBridge {
29
29
  export interface SootSimMediaSessionBridge {
30
30
  readonly session: Pick<MediaSession, 'metadata' | 'playbackState' | 'setActionHandler' | 'setPositionState'>;
31
31
  readonly MediaMetadata: new (init?: MediaMetadataInit) => MediaMetadata;
32
+ readonly stateVersions: Readonly<{
33
+ metadata: number;
34
+ playbackState: number;
35
+ }>;
36
+ setOwnedActionHandler(action: MediaSessionAction, handler: MediaSessionActionHandler): () => boolean;
32
37
  reset(): void;
33
38
  }
@@ -7,7 +7,7 @@ export { SOOTSIM_NATIVE_PUBLIC_INSTANCE, isSootSimNativePublicInstance, withSoot
7
7
  export type { NativeViewMeasureMode, NativeViewMeasure, PeachNativeWorkletEventDispatcher, SootSimNativePublicInstance, NumericTextPaintRequest, } from './nativeViewContract.d.ts';
8
8
  export { SOOTSIM_BOOT_STAGE_ORDER, SOOTSIM_TENANT_READY_MARK, SOOTSIM_BOOT_MARKS_GLOBAL, dispatchSootsimEvent, listenSootsimEvent, } from './eventBridgeContract.d.ts';
9
9
  export type { SootsimBridgeStatusDetail, SootsimActiveAppChangeDetail, SootsimSettingsPage, SootsimSettingsRoute, SootsimNavigateAppDetail, SootsimNavigateHomeDetail, SootsimEmbedVisibilityDetail, SootsimEmbedInteraction, SootsimEngineFailureDetail, SootsimBootStage, SootsimBootMarkName, SootsimBootMark, SootsimHostKeyDetail, SootsimHapticActivityDetail, SootsimColorScheme, SootsimTopOverlayKind, SootsimEventMap, SootsimEventName, } from './eventBridgeContract.d.ts';
10
- export type { SootSimTestQueryFilter, SootSimTextCandidatesOptions, SootSimTextCandidate, SootSimTextCandidatesResult, SootSimDumpTreeOptions, SootSimInspectPointOptions, SootSimListInspectableOptions, SootSimRequestEntry, SootSimRequestCounts, SootSimTestBridge, SootSimTestBridgeMethod, SootSimTestBridgeArgs, SootSimTestBridgeResult, } from './testBridgeContract.d.ts';
10
+ export type { SootSimTestQueryFilter, SootSimTextCandidatesOptions, SootSimTextCandidate, SootSimTextCandidatesResult, SootSimDumpTreeOptions, SootSimInspectPointOptions, SootSimTapTargetOptions, SootSimListInspectableOptions, SootSimRequestEntry, SootSimRequestCounts, SootSimTestBridge, SootSimTestBridgeMethod, SootSimTestBridgeArgs, SootSimTestBridgeResult, } from './testBridgeContract.d.ts';
11
11
  export type { SootSimInspectNeighborDirection, SootSimGestureCallback, SootSimTapPathEntry, SootSimTapRefusal, SootSimTapTargetMatch, SootSimTapTargetVerification, SootSimNativePresentationInfo, SootSimTapResult, SootSimTapTargetStrategy, SootSimTapTargetInfo, SootSimRouteInfo, SootSimUndeclaredScreen, SootSimScrollToResult, SootSimCursorState, SootSimLoupeState, SootSimEditMenuRect, SootSimEditMenuItem, SootSimEditMenuState, SootSimTextSelection, SootSimTextSelectionHandles, SootSimAnimationSource, SootSimAnimationInfo, SootSimAnimationTraceSample, SootSimAnimationTraceStatus, SootSimRuntimeState, SootSimScreenTransitionWaitOptions, SootSimScreenTransitionWaitResult, SootSimInspectDeviceInfo, SootSimInspectAncestor, SootSimInspectBoxModel, SootSimInspectImageSource, SootSimInspectHookKind, SootSimInspectHookSummary, SootSimInspectCommitCause, SootSimInspectLastCommit, SootSimInspectReactInfo, SootSimInspectNavigationInfo, SootSimInspectTimelineEntry, SootSimInspectTreeNode, SootSimInspectInfo, PeachSemanticInspectInfo, PointerDispatchOptions, PeachAccessibilityNode, PeachSwiftUiAccessibility, PeachDebugSnapshotOperation, SootSimTargetMatcher, SootSimTargetObservation, PeachPeerStatsProgress, PeachPeerStats, SootSimAccessibilityState, SootSimAccessibilityValue, SootSimAccessibilityLiveRegion, SootSimFocusedNodeInfo, SootSimAccessibilityInput, SootSimNodeInfo, SootSimStyleTokenBinding, SootSimCapturedTextSegment, SootSimCapturedTextLine, SootSimRenderTreeNode, SootSimRenderTreeSnapshot, SootSimCaptureTransactionReceipt, SootSimCaptureBoundLongPressReceipt, SootSimCaptureBoundTapReceipt, SootSimDebugNodeInfo, SootSimVisibleFrame, SootSimVisibilityNodeRef, SootSimVisibleFrameHidden, SootSimLayout, SootSimDeviceSpec, } from './nodeContract.d.ts';
12
12
  export type { SootSimInteractBridge } from './interactionBridgeContract.d.ts';
13
13
  export { isTextInputEditCommand } from './keyboardBridgeContract.d.ts';
@@ -31,9 +31,20 @@ export interface SootSimKeyboardBridge {
31
31
  hasHostedEditorFocus?(): MaybeAsync<boolean>;
32
32
  getMode?(): MaybeAsync<string>;
33
33
  getLayout?(): {
34
+ visible: boolean;
34
35
  spec: {
35
36
  secureTextEntry: boolean;
36
37
  } | null;
38
+ mode: string;
39
+ shifted: boolean;
40
+ capsLock: boolean;
41
+ accessoryBarId: string | null;
42
+ frame: {
43
+ screenX: number;
44
+ screenY: number;
45
+ width: number;
46
+ height: number;
47
+ };
37
48
  };
38
49
  getKeyRect?(label: string): MaybeAsync<{
39
50
  x: number;
@@ -63,6 +63,7 @@ export interface SootSimMainShellBridge {
63
63
  toggleLock?(): MaybeAsync<unknown>;
64
64
  setTopOverlay?(overlay: 'none' | 'notification-center' | 'control-center'): MaybeAsync<unknown>;
65
65
  getState?(): MaybeAsync<Record<string, unknown> | null>;
66
+ callTestBridge?(method: string, ...args: unknown[]): MaybeAsync<unknown>;
66
67
  postNativeUIRequest?(request: unknown): MaybeAsync<unknown>;
67
68
  onNativeUIEvent?(cb: (event: unknown) => void): () => void;
68
69
  }
@@ -51,6 +51,9 @@ export interface SootSimInspectPointOptions {
51
51
  excludeTestId?: string;
52
52
  excludeTestIds?: string[];
53
53
  }
54
+ export interface SootSimTapTargetOptions {
55
+ includeUnreachable?: boolean;
56
+ }
54
57
  export interface SootSimListInspectableOptions {
55
58
  excludeTestIds?: string[];
56
59
  }
@@ -72,6 +75,10 @@ export interface SootSimRequestCounts {
72
75
  total: number;
73
76
  failed: number;
74
77
  inFlight: number;
78
+ imageLoads: {
79
+ total: number;
80
+ inFlight: number;
81
+ };
75
82
  }
76
83
  export interface SootSimTestBridge {
77
84
  resolveViewTags?(tags: readonly number[]): MaybeAsync<Record<number, {
@@ -91,8 +98,8 @@ export interface SootSimTestBridge {
91
98
  findByText(text: string): MaybeAsync<SootSimNodeInfo | null>;
92
99
  findByTextOrLabel(text: string): MaybeAsync<SootSimNodeInfo | null>;
93
100
  queryMatchingNodes(matcher: SootSimTargetMatcher): MaybeAsync<SootSimNodeInfo[]>;
94
- observeTapTarget(matcher: SootSimTargetMatcher): MaybeAsync<SootSimTargetObservation | null>;
95
- resolveTapTarget(nodeId: number): MaybeAsync<SootSimTapTargetInfo | null>;
101
+ observeTapTarget(matcher: SootSimTargetMatcher, opts?: SootSimTapTargetOptions): MaybeAsync<SootSimTargetObservation | null>;
102
+ resolveTapTarget(nodeId: number, opts?: SootSimTapTargetOptions): MaybeAsync<SootSimTapTargetInfo | null>;
96
103
  verifyTapTargetAt(x: number, y: number, target: SootSimReplayTarget, nativeWindowRoot?: number): MaybeAsync<SootSimTapTargetVerification>;
97
104
  debugByText(text: string): MaybeAsync<SootSimDebugNodeInfo[] | null>;
98
105
  debugByTestId(testId: string): MaybeAsync<SootSimDebugNodeInfo[] | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.1716",
3
+ "version": "0.1.1728",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"a0dede25c849ecabd639fbb0a0c4edd8e62a34bf12090932dba19832f2369659","file":"node/cli-a0dede25c849ecabd639fbb0a0c4edd8e62a34bf12090932dba19832f2369659.cjs"}
1
+ {"abi":1,"sha256":"aca3aa069c8104a207ce2d98944ba1ed096878d12c25e9e9d44c3df0e2a63323","file":"node/cli-aca3aa069c8104a207ce2d98944ba1ed096878d12c25e9e9d44c3df0e2a63323.cjs"}
@@ -25,7 +25,7 @@ import {
25
25
  } from '../src/backend-origin.ts'
26
26
  import { applyPeachConfigToUrl } from '../src/config.ts'
27
27
  import { fetchDevManifest } from '../src/dev-bundle-resolution'
28
- import { parseExpoManifestBody } from '../src/expo-manifest-body'
28
+ import { parseExpoManifestBody, readExpoManifestFields } from '../src/expo-manifest-body'
29
29
  import {
30
30
  KOTLIN_DISCOVERY_PATH,
31
31
  KOTLIN_GUEST_PATH,
@@ -971,9 +971,9 @@ function applyManifest(
971
971
  if (!manifestRes) return result
972
972
  try {
973
973
  const manifest = parseExpoManifestBody(manifestRes.body)
974
- const client = manifest?.extra?.expoClient || manifest?.extra || {}
974
+ const { launchUrl: manifestLaunchUrl, client } = readExpoManifestFields(manifest)
975
975
  const root = client._internal?.projectRoot
976
- if (manifest?.launchAsset || client.name)
976
+ if (manifestLaunchUrl || client.name)
977
977
  result.manifestProjectRoot =
978
978
  typeof root === 'string' && root.length > 0 ? root : null
979
979
  if (client.name) result.projectName = client.name
@@ -985,14 +985,12 @@ function applyManifest(
985
985
  // (hardcoded by @expo/cli — see metroOptions.ts). keep its path and query
986
986
  // so metro shares the iOS bundle cache. when both hosts are loopback, keep
987
987
  // the host that answered discovery so address-family drift stays reachable.
988
- const rawLaunchUrl = manifest?.launchAsset?.url
989
- const launchUrl =
990
- typeof rawLaunchUrl === 'string'
991
- ? alignLoopbackBundleUrlWithProbe(
992
- rawLaunchUrl,
993
- buildLoopbackProbeBaseUrl('http:', manifestRes.hostname, result.port),
994
- )
995
- : undefined
988
+ const launchUrl = manifestLaunchUrl
989
+ ? alignLoopbackBundleUrlWithProbe(
990
+ manifestLaunchUrl,
991
+ buildLoopbackProbeBaseUrl('http:', manifestRes.hostname, result.port),
992
+ )
993
+ : undefined
996
994
  if (launchUrl && !result.patched && !isDirectOneBundleUrl(result.bundleUrl)) {
997
995
  result.bundleUrl = withRuntimeConfig(result.port, launchUrl, result.cwd)
998
996
  }
@@ -1234,20 +1232,9 @@ export async function probePort(
1234
1232
  // burns its web build. a packager is the metro status body, other than one
1235
1233
  // whose manifest names a One entry, which `/__server-scan` still identifies; a
1236
1234
  // spa fallback answers 200 html to every path and never matches the status body.
1237
- const manifestParsed = manifestRes
1238
- ? (safeParseManifest(manifestRes.body) as {
1239
- launchAsset?: { url?: unknown }
1240
- extra?: { expoClient?: { name?: unknown }; name?: unknown }
1241
- } | null)
1242
- : null
1243
- const manifestLaunchUrl =
1244
- typeof manifestParsed?.launchAsset?.url === 'string'
1245
- ? manifestParsed.launchAsset.url
1246
- : null
1247
- const manifestClient =
1248
- (manifestParsed?.extra?.expoClient as { name?: unknown } | undefined) ||
1249
- (manifestParsed?.extra as { name?: unknown } | undefined) ||
1250
- {}
1235
+ const manifestParsed = manifestRes ? safeParseManifest(manifestRes.body) : null
1236
+ const { launchUrl: manifestLaunchUrl, client: manifestClient } =
1237
+ readExpoManifestFields(manifestParsed)
1251
1238
  // `manifestRes === null` means the probe got NO answer — it timed out or the
1252
1239
  // connection failed. that is not the same fact as a server that answered and
1253
1240
  // turned out to have no manifest, and only the second one licenses the
@@ -0,0 +1,52 @@
1
+ //
2
+ // ASFoundation.h
3
+ // AuthenticationServices Framework
4
+ //
5
+ // Copyright © 2018 Apple Inc. All rights reserved.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ #ifdef __cplusplus
11
+ #define AS_EXTERN extern "C" __attribute__((visibility ("default")))
12
+ #else
13
+ #define AS_EXTERN extern __attribute__((visibility ("default")))
14
+ #endif
15
+
16
+ #ifdef NS_HEADER_AUDIT_BEGIN
17
+ #define AS_HEADER_AUDIT_BEGIN NS_HEADER_AUDIT_BEGIN
18
+ #define AS_HEADER_AUDIT_END NS_HEADER_AUDIT_END
19
+ #else
20
+ #define AS_HEADER_AUDIT_BEGIN(...) NS_ASSUME_NONNULL_BEGIN
21
+ #define AS_HEADER_AUDIT_END(...) NS_ASSUME_NONNULL_END
22
+ #endif
23
+
24
+ #ifdef NS_SWIFT_SENDABLE
25
+ #define AS_SWIFT_SENDABLE NS_SWIFT_SENDABLE
26
+ #else
27
+ #define AS_SWIFT_SENDABLE
28
+ #endif
29
+
30
+ #ifdef __AS_INTERNAL_AVAILABILITY
31
+ #define AS_API_AVAILABLE(...)
32
+ #else
33
+ #define AS_API_AVAILABLE API_AVAILABLE
34
+ #endif
35
+
36
+ #if __has_include(<UIKit/UIKit.h>)
37
+ #import <UIKit/UIKit.h>
38
+ #if __has_include(<UIKit/UIWindow.h>)
39
+ typedef UIWindow * ASPresentationAnchor API_UNAVAILABLE(watchos);
40
+ #endif
41
+ #if __has_include(<UIKit/UIViewController.h>) && !defined(ASViewController)
42
+ typedef UIViewController ASViewController API_UNAVAILABLE(watchos);
43
+ #endif
44
+ typedef UIImage ASImage API_UNAVAILABLE(watchos);
45
+ #elif __has_include(<AppKit/AppKit.h>)
46
+ #import <AppKit/AppKit.h>
47
+ typedef NSWindow * ASPresentationAnchor;
48
+ #if !defined(ASViewController)
49
+ typedef NSViewController ASViewController;
50
+ typedef NSImage ASImage;
51
+ #endif
52
+ #endif
@@ -0,0 +1,128 @@
1
+ //
2
+ // ASWebAuthenticationSession.h
3
+ // AuthenticationServices Framework
4
+ //
5
+ // Copyright © 2018 Apple Inc. All rights reserved.
6
+ //
7
+
8
+ #import <AuthenticationServices/ASFoundation.h>
9
+ #import <Foundation/Foundation.h>
10
+
11
+ @class ASWebAuthenticationSessionCallback;
12
+
13
+ NS_ASSUME_NONNULL_BEGIN
14
+
15
+ @protocol ASWebAuthenticationPresentationContextProviding;
16
+
17
+ AS_EXTERN API_AVAILABLE(ios(12.0), macCatalyst(13.0), macos(10.15), watchos(6.2), tvos(16.0))
18
+ NSErrorDomain const ASWebAuthenticationSessionErrorDomain;
19
+
20
+ /*! @enum ASWebAuthenticationSessionErrorCode
21
+ @abstract Error code of the NSError object passed in by ASWebAuthenticationSessionCompletionHandler.
22
+ @constant ASWebAuthenticationSessionErrorCodeCanceledLogin The user has canceled login by cancelling the
23
+ alert asking for permission to log in to this app, or by dismissing the view controller for loading the
24
+ authentication webpage.
25
+ @constant ASWebAuthenticationSessionErrorCodePresentationContextNotProvided A valid presentationContextProvider
26
+ was not found when -start was called. Ensure this property was not nil when -start was called.
27
+ @constant ASWebAuthenticationSessionErrorCodePresentationContextInvalid The presentation context returned
28
+ was not elligible to show the authentication UI. For iOS, validate that the UIWindow is in a foreground scene.
29
+ */
30
+ typedef NS_ERROR_ENUM(ASWebAuthenticationSessionErrorDomain, ASWebAuthenticationSessionErrorCode) {
31
+ ASWebAuthenticationSessionErrorCodeCanceledLogin = 1,
32
+ ASWebAuthenticationSessionErrorCodePresentationContextNotProvided API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(watchos, tvos) = 2,
33
+ ASWebAuthenticationSessionErrorCodePresentationContextInvalid API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(watchos, tvos) = 3,
34
+ } API_AVAILABLE(ios(12.0), macCatalyst(13.0), macos(10.15), watchos(6.2), tvos(16.0));
35
+
36
+ typedef void (^ASWebAuthenticationSessionCompletionHandler)(NSURL *_Nullable callbackURL, NSError *_Nullable error) NS_SWIFT_NAME(ASWebAuthenticationSession.CompletionHandler);
37
+
38
+ /*!
39
+ @class ASWebAuthenticationSession
40
+ An ASWebAuthenticationSession object can be used to authenticate a user with a web service, even if the web service is run
41
+ by a third party. ASWebAuthenticationSession puts the user in control of whether they want to use their existing logged-in
42
+ session from Safari. The app provides a URL that points to the authentication webpage. The page will be loaded in a secure
43
+ view controller. From the webpage, the user can authenticate herself and grant access to the app.
44
+ On completion, the service will send a callback URL with an authentication token, and this URL will be passed to the app by
45
+ ASWebAuthenticationSessionCompletionHandler.
46
+
47
+ The callback URL usually has a custom URL scheme. For the app to receive the callback URL, it needs to either register the
48
+ custom URL scheme in its Info.plist, or set the scheme to callbackURLScheme argument in the initializer.
49
+
50
+ If the user has already logged into the web service in Safari or other apps via ASWebAuthenticationSession, it is possible to
51
+ share the existing login information. An alert will be presented to get the user's consent for sharing their existing login
52
+ information. If the user cancels the alert, the session will be canceled, and the completion handler will be called with
53
+ the error code ASWebAuthenticationSessionErrorCodeCanceledLogin.
54
+
55
+ If the user taps Cancel when showing the login webpage for the web service, the session will be canceled, and the completion
56
+ handler will be called with the error code ASWebAuthenticationSessionErrorCodeCanceledLogin.
57
+
58
+ The app can cancel the session by calling -[ASWebAuthenticationSession cancel]. This will also dismiss the view controller that
59
+ is showing the web service's login page.
60
+ */
61
+ AS_EXTERN API_AVAILABLE(ios(12.0), macCatalyst(13.0), macos(10.15), watchos(6.2), tvos(16.0))
62
+ @interface ASWebAuthenticationSession : NSObject
63
+
64
+ /*! @abstract Returns an ASWebAuthenticationSession object.
65
+ @param URL the initial URL pointing to the authentication webpage. Only supports URLs with http:// or https:// schemes.
66
+ @param callbackURLScheme the custom URL scheme that the app expects in the callback URL.
67
+ @param completionHandler the completion handler which is called when the session is completed successfully or canceled by user.
68
+ */
69
+ - (instancetype)initWithURL:(NSURL *)URL callbackURLScheme:(nullable NSString *)callbackURLScheme completionHandler:(ASWebAuthenticationSessionCompletionHandler)completionHandler API_DEPRECATED("Use initWithURL:callback:completionHandler: instead", ios(12.0, API_TO_BE_DEPRECATED), macCatalyst(13.0, API_TO_BE_DEPRECATED), macos(10.15, API_TO_BE_DEPRECATED), watchos(6.2, API_TO_BE_DEPRECATED), tvos(16.0, API_TO_BE_DEPRECATED));
70
+
71
+ - (instancetype)initWithURL:(NSURL *)URL callback:(ASWebAuthenticationSessionCallback *)callback completionHandler:(ASWebAuthenticationSessionCompletionHandler)completionHandler API_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4), visionos(1.1));
72
+
73
+ /*! @abstract Provides context to target where in an application's UI the authorization view should be shown. A provider
74
+ must be set prior to calling -start, otherwise the authorization view cannot be displayed. If deploying to iOS prior to
75
+ 13.0, the desired window is inferred by the application's key window.
76
+ */
77
+ @property (nonatomic, weak) id <ASWebAuthenticationPresentationContextProviding> presentationContextProvider API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(watchos, tvos);
78
+
79
+ /*! @abstract Indicates whether this session should ask the browser for an ephemeral session.
80
+ @discussion Ephemeral web browser sessions do not not share cookies or other browsing data with a user's normal browser session.
81
+ This value is NO by default. Setting this property after calling -[ASWebAuthenticationSession start] has no effect.
82
+ */
83
+ @property (nonatomic) BOOL prefersEphemeralWebBrowserSession API_AVAILABLE(ios(13.0), macos(10.15), watchos(6.2)) API_UNAVAILABLE(tvos);
84
+
85
+ /// Any additional header fields to be set when loading the initial URL.
86
+ /// All header field names must start with the "X-" prefix.
87
+ @property (nonatomic, nullable) NSDictionary<NSString *, NSString *> *additionalHeaderFields API_AVAILABLE(ios(17.4), macos(14.4), tvos(17.4), watchos(10.4), visionos(1.1));
88
+
89
+ /*! @abstract Returns whether the session can be successfully started. This property returns the same value as calling -start,
90
+ but without the side effect of actually starting the session.
91
+ */
92
+ @property (nonatomic, readonly) BOOL canStart API_AVAILABLE(ios(13.4), macos(10.15.4), watchos(6.2));
93
+
94
+ /*! @abstract Starts the ASWebAuthenticationSession instance after it is instantiated.
95
+ @discussion start can only be called once for an ASWebAuthenticationSession instance. This also means calling start on a
96
+ canceled session will fail.
97
+ @result Returns YES if the session starts successfully.
98
+ */
99
+ - (BOOL)start;
100
+
101
+ /*! @abstract Cancel an ASWebAuthenticationSession. If the view controller is already presented to load the webpage for
102
+ authentication, it will be dismissed. Calling cancel on an already canceled session will have no effect.
103
+ */
104
+ - (void)cancel API_UNAVAILABLE(tvos);
105
+
106
+ + (instancetype)new NS_UNAVAILABLE;
107
+ - (instancetype)init NS_UNAVAILABLE;
108
+
109
+ @end
110
+
111
+ /*! @abstract Provides context to target where in an application's UI the authorization view should be shown.
112
+ */
113
+ API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(tvos, watchos)
114
+ NS_SWIFT_UI_ACTOR
115
+ @protocol ASWebAuthenticationPresentationContextProviding <NSObject>
116
+
117
+ #if !TARGET_OS_WATCH
118
+ /*! @abstract Return the ASPresentationAnchor in the closest proximity to where a user interacted with your app to trigger
119
+ authentication. If starting an ASWebAuthenticationSession on first launch, use the application's main window.
120
+ @param session The session requesting a presentation anchor.
121
+ @result The ASPresentationAnchor most closely associated with the UI used to trigger authentication.
122
+ */
123
+ - (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session;
124
+ #endif
125
+
126
+ @end
127
+
128
+ NS_ASSUME_NONNULL_END