peachsim 0.1.2222 → 0.1.2224

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 (95) 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/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +45 -29
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +43 -27
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +45 -29
  31. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +4 -4
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +4 -4
  47. package/dist-lib/native-app-identity-project.cjs +2 -2
  48. package/dist-lib/native-app-identity-project.mjs +2 -2
  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/pdfium-raster.cjs +1 -1
  54. package/dist-lib/pdfium-raster.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/public-origins-lib-esm.json +24 -24
  60. package/dist-lib/public-origins-lib.json +53 -53
  61. package/dist-lib/react-native-host-modules.cjs +1 -1
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/reap-browser.cjs +1 -1
  64. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  65. package/dist-lib/sdk.cjs +1 -1
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +46 -29
  68. package/dist-lib/swift-compile.cjs +24 -8
  69. package/dist-lib/swift-compile.mjs +24 -8
  70. package/dist-lib/swift-package.cjs +1 -1
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +1 -1
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +1 -1
  75. package/dist-lib/swift.cjs +1 -1
  76. package/dist-lib/vite-swift.cjs +41 -25
  77. package/dist-lib/vite.cjs +4 -4
  78. package/dist-lib/worklet-executable.cjs +1 -1
  79. package/dist-lib/worklet-executable.mjs +1 -1
  80. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +2 -1
  81. package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +4 -0
  82. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +3 -6
  83. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -0
  84. package/dist-types/packages/peach-globals/src/browser-object-url.d.ts +10 -0
  85. package/kotlin/sdk.tar.gz +0 -0
  86. package/package.json +1 -1
  87. package/runtime-companion.json +1 -1
  88. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISegmentedControl.h +1 -1
  89. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +1 -1
  90. package/src/conformance-comparison-contract.ts +9 -9
  91. package/src/conformance-pixel-comparison.ts +16 -3
  92. package/src/swift-compile.ts +4 -4
  93. package/src/swift-host.ts +23 -26
  94. package/src/swift-root-lock.ts +27 -4
  95. package/src/vite-plugin.ts +6 -1
@@ -0,0 +1,10 @@
1
+ export declare const BrowserURL: {
2
+ new (url: string | URL, base?: string | URL): URL;
3
+ prototype: URL;
4
+ canParse(url: string | URL, base?: string | URL): boolean;
5
+ createObjectURL(obj: Blob | MediaSource): string;
6
+ parse(url: string | URL, base?: string | URL): URL | null;
7
+ revokeObjectURL(url: string): void;
8
+ };
9
+ export declare const createBrowserObjectURL: (obj: Blob | MediaSource) => string;
10
+ export declare const revokeBrowserObjectURL: (url: string) => void;
package/kotlin/sdk.tar.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2222",
3
+ "version": "0.1.2224",
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":"6b48c0f7ae1d87e581af7cf445b2eaad2e1a4aa8fad23a00e1ae90916b2bbc02","file":"node/cli-6b48c0f7ae1d87e581af7cf445b2eaad2e1a4aa8fad23a00e1ae90916b2bbc02.cjs"}
1
+ {"abi":1,"sha256":"ef38a3e8be87c77f4035640cf265efa9aff735577a2de14feb63c8a09afabd42","file":"node/cli-ef38a3e8be87c77f4035640cf265efa9aff735577a2de14feb63c8a09afabd42.cjs"}
@@ -40,7 +40,7 @@ typedef NS_ENUM(NSInteger, UISegmentedControlSegment) {
40
40
  @class UIImage, UIColor;
41
41
 
42
42
  UIKIT_EXTERN API_AVAILABLE(ios(2.0)) API_UNAVAILABLE(watchos) NS_SWIFT_UI_ACTOR
43
- @interface UISegmentedControl : UIControl <NSCoding>
43
+ PEACH_SWIFT_CLASS(UIKitCore) @interface UISegmentedControl : UIControl <NSCoding>
44
44
 
45
45
  - (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
46
46
  - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
@@ -22,7 +22,7 @@ NS_HEADER_AUDIT_BEGIN(nullability, sendability)
22
22
  @protocol UITabBarDelegate;
23
23
 
24
24
  UIKIT_EXTERN API_AVAILABLE(ios(2.0)) API_UNAVAILABLE(watchos) NS_SWIFT_UI_ACTOR
25
- @interface UITabBar : UIView
25
+ PEACH_SWIFT_CLASS(UIKitCore) @interface UITabBar : UIView
26
26
 
27
27
  @property(nullable, nonatomic, weak) id<UITabBarDelegate> delegate; // weak reference. default is nil
28
28
  @property(nullable, nonatomic, copy) NSArray<UITabBarItem *> *items; // get/set visible UITabBarItems. default is nil. changes not animated. shown in order
@@ -121,15 +121,6 @@ export function outsideDisplayPixels(
121
121
  height: number,
122
122
  ): Uint8Array | null {
123
123
  const count = width * height
124
- let anyTransparent = false
125
- for (let i = 0; i < count; i++) {
126
- if (candidate[i * 4 + 3] !== 255) {
127
- anyTransparent = true
128
- break
129
- }
130
- }
131
- if (!anyTransparent) return null
132
-
133
124
  // a compared frame is the physical framebuffer or a one-pixel common-area
134
125
  // crop of it (commonAreaSize), so the lookup probes the crop back up.
135
126
  const spec =
@@ -168,6 +159,15 @@ export function outsideDisplayPixels(
168
159
  return null
169
160
  }
170
161
 
162
+ let anyTransparent = false
163
+ for (let i = 0; i < count; i++) {
164
+ if (candidate[i * 4 + 3] !== 255) {
165
+ anyTransparent = true
166
+ break
167
+ }
168
+ }
169
+ if (!anyTransparent) return null
170
+
171
171
  const outside = new Uint8Array(count)
172
172
  const corners = [
173
173
  { x0: 0, y0: 0, cx: radiiPx.topLeft, cy: radiiPx.topLeft, r: radiiPx.topLeft },
@@ -132,11 +132,24 @@ export function compareConformancePixels(options: {
132
132
  }
133
133
  if (identical) {
134
134
  options.diff?.fill(0)
135
+ const columns = Math.ceil(options.width)
136
+ const excludedColumns =
137
+ region.cornerRadius > 0
138
+ ? Math.min(
139
+ columns,
140
+ Math.ceil(region.cornerRadius) +
141
+ columns -
142
+ Math.max(0, Math.ceil(options.width - region.cornerRadius)),
143
+ )
144
+ : 0
135
145
  let totalPixels = 0
136
146
  for (let y = region.yStart; y < region.yEnd; y++) {
137
- for (let x = 0; x < options.width; x++) {
138
- if (!excluded(x, y)) totalPixels++
139
- }
147
+ const globalY = region.globalYStart + y
148
+ totalPixels +=
149
+ globalY < region.cornerRadius ||
150
+ globalY >= region.fullHeight - region.cornerRadius
151
+ ? columns - excludedColumns
152
+ : columns
140
153
  }
141
154
  return { differingPixels: 0, totalPixels }
142
155
  }
@@ -5337,10 +5337,10 @@ export function writeSwiftProject(
5337
5337
  const moduleName = swiftTargetModuleName(name)
5338
5338
  const originalMap = originalMaps.get(moduleName)
5339
5339
  const stagedMap = sourceModuleMaps.get(moduleName)
5340
- const originalPath = originalMap
5341
- ? path.join(layout.root, originalMap)
5342
- : stagedMap?.path
5343
- const originalContents = originalMap ? input.files[originalMap]! : stagedMap?.contents
5340
+ const originalPath =
5341
+ stagedMap?.path ?? (originalMap ? path.join(layout.root, originalMap) : undefined)
5342
+ const originalContents =
5343
+ stagedMap?.contents ?? (originalMap && input.files[originalMap])
5344
5344
  const originalTokens = originalContents ? moduleMapTokens(originalContents) : []
5345
5345
  if (
5346
5346
  originalPath &&
package/src/swift-host.ts CHANGED
@@ -2812,6 +2812,28 @@ export function compileInput(
2812
2812
  )
2813
2813
  }
2814
2814
 
2815
+ export function swiftBuildRoot(packagePath: string, moduleRoot: string): string {
2816
+ if (process.env.CONTRAST_SWIFT_BUILD_ROOT) return process.env.CONTRAST_SWIFT_BUILD_ROOT
2817
+ const resolvedPath = path.resolve(packagePath)
2818
+ const parts = resolvedPath.split(path.sep)
2819
+ const scopedAt = Math.max(
2820
+ parts.lastIndexOf('peach-expo-swift'),
2821
+ parts.lastIndexOf('peach-nitro-swift'),
2822
+ )
2823
+ const buildKeyPath =
2824
+ scopedAt >= 0 && parts.length >= scopedAt + 3
2825
+ ? parts.slice(0, scopedAt + 2).join(path.sep)
2826
+ : (sourceEntries().get(resolvedPath) ?? resolvedPath)
2827
+ return path.join(
2828
+ swiftCacheDir(),
2829
+ 'swift-builds',
2830
+ createHash('sha256')
2831
+ .update(`${moduleRoot}\0${buildKeyPath}`)
2832
+ .digest('hex')
2833
+ .slice(0, 16),
2834
+ )
2835
+ }
2836
+
2815
2837
  // the compile input of an installed workspace with the binary frameworks its
2816
2838
  // pods and project vendor, read from one layout.
2817
2839
  export function installedWorkspaceInput(
@@ -2922,32 +2944,7 @@ async function compile(
2922
2944
  // building each other's sources. each app and module checkout still gets
2923
2945
  // its own root, so they do not queue and the same app keeps its
2924
2946
  // incremental build across restarts.
2925
- buildRoot: (() => {
2926
- if (process.env.CONTRAST_SWIFT_BUILD_ROOT)
2927
- return process.env.CONTRAST_SWIFT_BUILD_ROOT
2928
- const resolvedPath = path.resolve(packagePath)
2929
- // units of one app or nitro module share a root so the module cache stays
2930
- // warm across server restarts: peach-expo-swift/<app>/<scope>/<package>
2931
- // and peach-nitro-swift/<module>/<scope> share <app> or <module>.
2932
- // servers on one app or module queue on the root lock.
2933
- const parts = resolvedPath.split(path.sep)
2934
- const scopedAt = Math.max(
2935
- parts.lastIndexOf('peach-expo-swift'),
2936
- parts.lastIndexOf('peach-nitro-swift'),
2937
- )
2938
- const buildKeyPath =
2939
- scopedAt >= 0 && parts.length >= scopedAt + 3
2940
- ? parts.slice(0, scopedAt + 2).join(path.sep)
2941
- : (sourceEntries().get(resolvedPath) ?? resolvedPath)
2942
- return path.join(
2943
- swiftCacheDir(),
2944
- 'swift-builds',
2945
- createHash('sha256')
2946
- .update(`${moduleRoot}\0${buildKeyPath}`)
2947
- .digest('hex')
2948
- .slice(0, 16),
2949
- )
2950
- })(),
2947
+ buildRoot: swiftBuildRoot(packagePath, moduleRoot),
2951
2948
  moduleRoot,
2952
2949
  ...toolchain,
2953
2950
  signal,
@@ -20,6 +20,7 @@ import { readProcessTable, type ProcessRow } from './process-table.ts'
20
20
  import type { Readable, Writable } from 'node:stream'
21
21
 
22
22
  const POLL_MS = 250
23
+ const INSPECT_ATTEMPTS = 5
23
24
  // ps derives a start time from the boot time, which drifts by a second or two
24
25
  // on linux; a reused pid starts later than this.
25
26
  const START_TOLERANCE_MS = 2_000
@@ -53,6 +54,24 @@ function processTable(pid?: number): ProcessRow[] {
53
54
  }
54
55
  }
55
56
 
57
+ // a loaded host can stall ps past its deadline once without the table being
58
+ // broken, and the lock only ever waits on that answer, so lock acquisition
59
+ // asks again before giving up.
60
+ async function processTableWithRetry(
61
+ pid: number | undefined,
62
+ signal: AbortSignal | undefined,
63
+ ): Promise<ProcessRow[]> {
64
+ for (let attempt = 1; ; attempt++) {
65
+ try {
66
+ return processTable(pid)
67
+ } catch (error) {
68
+ if (attempt >= INSPECT_ATTEMPTS) throw error
69
+ await pause(POLL_MS * attempt, signal)
70
+ signal?.throwIfAborted()
71
+ }
72
+ }
73
+ }
74
+
56
75
  function sameProcess(row: ProcessRow, identity: Identity): boolean {
57
76
  return (
58
77
  row.pid === identity.pid && Math.abs(row.start - identity.start) <= START_TOLERANCE_MS
@@ -204,7 +223,11 @@ export async function withSwiftRootLock<T>(
204
223
  )
205
224
  mkdirSync(directory, { recursive: true })
206
225
  const token = randomUUID()
207
- const owner = JSON.stringify(ownIdentity(process.pid))
226
+ const ownRow = (await processTableWithRetry(process.pid, signal)).find(
227
+ (candidate) => candidate.pid === process.pid && !candidate.zombie,
228
+ )
229
+ if (!ownRow) throw new Error(`swift root lock cannot find process ${process.pid}`)
230
+ const owner = JSON.stringify({ pid: process.pid, start: ownRow.start })
208
231
  const pending = path.join(directory, `pending.${token}`)
209
232
  let held = 0
210
233
  for (;;) {
@@ -213,15 +236,15 @@ export async function withSwiftRootLock<T>(
213
236
  const current = newest > 0 ? readGeneration(directory, newest) : null
214
237
  if (newest > 0 && !current) continue
215
238
  if (current && !current.released) {
216
- const owner = processTable(current.holder.pid)
217
- if (owner.some((row) => !row.zombie && sameProcess(row, current.holder))) {
239
+ const holder = await processTableWithRetry(current.holder.pid, signal)
240
+ if (holder.some((row) => !row.zombie && sameProcess(row, current.holder))) {
218
241
  if (!wait) return undefined
219
242
  await pause(POLL_MS, signal)
220
243
  continue
221
244
  }
222
245
  const children = readChildren(directory, newest)
223
246
  if (children.length) {
224
- const table = processTable()
247
+ const table = await processTableWithRetry(undefined, signal)
225
248
  if (children.some((child) => groupAlive(table, child))) {
226
249
  if (!wait) return undefined
227
250
  await pause(POLL_MS, signal)
@@ -839,11 +839,16 @@ export function hostBootChunkPlugin(): Plugin {
839
839
  }
840
840
  },
841
841
  outputOptions(options) {
842
+ const chunkFileNames = options.chunkFileNames ?? 'assets/[name]-[hash].js'
842
843
  return {
843
844
  ...options,
844
845
  // host resource urls are relative to the runtime root.
845
846
  chunkFileNames: (chunk) =>
846
- chunk.name === 'host-home' ? 'host-home-[hash].js' : 'assets/[name]-[hash].js',
847
+ chunk.name === 'host-home'
848
+ ? 'host-home-[hash].js'
849
+ : typeof chunkFileNames === 'function'
850
+ ? chunkFileNames(chunk)
851
+ : chunkFileNames,
847
852
  strictExecutionOrder: true,
848
853
  codeSplitting: {
849
854
  groups: [