peachsim 0.1.2228 → 0.1.2229

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 (93) hide show
  1. package/cli/commands/device.ts +1 -1
  2. package/cli/commands/flow.ts +1 -1
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.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 +35 -9
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +1 -1
  26. package/dist-lib/detox/index.cjs +5 -2
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +33 -7
  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 +35 -9
  33. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  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 +7 -5
  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 +16 -14
  43. package/dist-lib/menu.mjs +16 -14
  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 +7 -5
  49. package/dist-lib/native-app-identity-project.cjs +5 -3
  50. package/dist-lib/native-app-identity-project.mjs +5 -3
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/pdfium-raster.cjs +1 -1
  56. package/dist-lib/pdfium-raster.mjs +1 -1
  57. package/dist-lib/plist.cjs +1 -1
  58. package/dist-lib/plist.mjs +1 -1
  59. package/dist-lib/profiles.cjs +1 -1
  60. package/dist-lib/public-brand.cjs +1 -1
  61. package/dist-lib/public-origins-lib-esm.json +25 -24
  62. package/dist-lib/public-origins-lib.json +55 -53
  63. package/dist-lib/react-native-host-modules.cjs +1 -1
  64. package/dist-lib/react-native-host-modules.mjs +1 -1
  65. package/dist-lib/reap-browser.cjs +1 -1
  66. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  67. package/dist-lib/sdk.cjs +1 -1
  68. package/dist-lib/sdk.mjs +1 -1
  69. package/dist-lib/skills.cjs +35 -9
  70. package/dist-lib/swift-compile.cjs +1 -1
  71. package/dist-lib/swift-compile.mjs +1 -1
  72. package/dist-lib/swift-package.cjs +1 -1
  73. package/dist-lib/swift-package.mjs +1 -1
  74. package/dist-lib/swift-submit.cjs +1 -1
  75. package/dist-lib/swift-submit.mjs +1 -1
  76. package/dist-lib/swift-toolchain.cjs +1 -1
  77. package/dist-lib/swift.cjs +1 -1
  78. package/dist-lib/vite-swift.cjs +32 -6
  79. package/dist-lib/vite.cjs +4 -4
  80. package/dist-lib/worklet-executable.cjs +1 -1
  81. package/dist-lib/worklet-executable.mjs +1 -1
  82. package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +3 -0
  83. package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +10 -3
  84. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
  85. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  86. package/package.json +1 -1
  87. package/runtime-companion.json +1 -1
  88. package/src/appPackageContract.ts +1 -1
  89. package/src/menu.ts +17 -99
  90. package/src/menuContract.ts +102 -0
  91. package/src/settingsContract.ts +8 -8
  92. package/src/swift-host.ts +27 -2
  93. package/src/xcode-project.ts +8 -2
@@ -0,0 +1,102 @@
1
+ // the values and event names the menu protocol carries. kept apart from the menu builder so a
2
+ // runtime that only validates a setting or names an event does not carry the menus at boot.
3
+
4
+ export const SOOTSIM_ENGINE_EVENT_NAME = 'sootsim:engine-event'
5
+ export const SOOTSIM_SHELL_COMMAND_NAME = 'sootsim:shell-command'
6
+
7
+ export type SootSimMenuPlatform = 'browser' | 'electron'
8
+ export type SootSimScaleMode = 'physical' | 'point' | 'pixel' | 'fit'
9
+
10
+ // ambient glow strength. one setting with three states rather than an on/off
11
+ // pair plus a separate strength: every host that carries the preference (the
12
+ // menus, the persisted setting, the ?ambientGlow= boot seed, the live
13
+ // set-ambient-glow push, electron's shared config) then carries exactly one
14
+ // value and cannot end up half-configured.
15
+ export type SootSimAmbientGlowLevel = 'off' | 'soft' | 'full'
16
+ export const SOOTSIM_AMBIENT_GLOW_LEVELS = ['off', 'soft', 'full'] as const
17
+
18
+ export function isSootSimAmbientGlowLevel(
19
+ value: unknown,
20
+ ): value is SootSimAmbientGlowLevel {
21
+ return value === 'off' || value === 'soft' || value === 'full'
22
+ }
23
+
24
+ export const SOOTSIM_AMBIENT_GLOW_LABELS: Record<SootSimAmbientGlowLevel, string> = {
25
+ off: 'Off',
26
+ soft: 'Soft',
27
+ full: 'Full',
28
+ }
29
+
30
+ // the stage behind the device: system follows the mac's appearance (white in
31
+ // light mode, black in dark), or one pinned color. one value per host, like
32
+ // the glow level above.
33
+ export type SootSimStageBackground = 'system' | 'light' | 'dark' | 'gray'
34
+ export const SOOTSIM_STAGE_BACKGROUNDS = ['system', 'light', 'dark', 'gray'] as const
35
+
36
+ export function isSootSimStageBackground(
37
+ value: unknown,
38
+ ): value is SootSimStageBackground {
39
+ return value === 'system' || value === 'light' || value === 'dark' || value === 'gray'
40
+ }
41
+
42
+ export const SOOTSIM_STAGE_BACKGROUND_LABELS: Record<SootSimStageBackground, string> = {
43
+ system: 'System',
44
+ light: 'Light',
45
+ dark: 'Dark',
46
+ gray: 'Gray',
47
+ }
48
+
49
+ // render resolution: how many pixels peach renders per iphone point. one
50
+ // setting with three states, carried by every host exactly like the ambient
51
+ // glow level above: the menus, the persisted setting, the ?renderResolution=
52
+ // boot seed, the live set-render-resolution push, electron's shared config.
53
+ export type SootSimRenderResolution = 'high' | 'medium' | 'low'
54
+ export const SOOTSIM_RENDER_RESOLUTION_LEVELS = ['high', 'medium', 'low'] as const
55
+
56
+ // the installed desktop app presents the phone scaled to fit its window, so a
57
+ // fixed 2 px/pt canvas is browser-resampled and its icons read soft. its
58
+ // default is the level that tracks the pixels on screen; browsers and capture
59
+ // keep medium, whose 2 px/pt is the deterministic capture contract.
60
+ export const DESKTOP_RENDER_RESOLUTION: SootSimRenderResolution = 'low'
61
+
62
+ export function isSootSimRenderResolution(
63
+ value: unknown,
64
+ ): value is SootSimRenderResolution {
65
+ return value === 'high' || value === 'medium' || value === 'low'
66
+ }
67
+
68
+ export const SOOTSIM_RENDER_RESOLUTION_LABELS: Record<SootSimRenderResolution, string> = {
69
+ high: 'High',
70
+ medium: 'Medium',
71
+ low: 'Low',
72
+ }
73
+
74
+ // screen effect: the real rendering, or one of the presentation looks the
75
+ // engine's wireframe store draws. 'wireframe' is the clean structural sketch;
76
+ // the others are its screen-space styles that ship as named effects.
77
+ export type SootSimScreenEffect = 'none' | 'wireframe' | 'blueprint' | 'panel' | 'green'
78
+ export const SOOTSIM_SCREEN_EFFECTS = [
79
+ 'none',
80
+ 'wireframe',
81
+ 'blueprint',
82
+ 'panel',
83
+ 'green',
84
+ ] as const
85
+
86
+ export function isSootSimScreenEffect(value: unknown): value is SootSimScreenEffect {
87
+ return (
88
+ value === 'none' ||
89
+ value === 'wireframe' ||
90
+ value === 'blueprint' ||
91
+ value === 'panel' ||
92
+ value === 'green'
93
+ )
94
+ }
95
+
96
+ export const SOOTSIM_SCREEN_EFFECT_LABELS: Record<SootSimScreenEffect, string> = {
97
+ none: 'None',
98
+ wireframe: 'Wireframe',
99
+ blueprint: 'Blueprint',
100
+ panel: 'Panel',
101
+ green: 'Green',
102
+ }
@@ -2,14 +2,6 @@ import {
2
2
  DEFAULT_PROFILER_CATEGORIES,
3
3
  formatProfilerCategories,
4
4
  } from '@peach/globals/profiler'
5
- import {
6
- SOOTSIM_AMBIENT_GLOW_LEVELS,
7
- SOOTSIM_RENDER_RESOLUTION_LEVELS,
8
- SOOTSIM_STAGE_BACKGROUNDS,
9
- type SootSimAmbientGlowLevel,
10
- type SootSimRenderResolution,
11
- type SootSimStageBackground,
12
- } from 'peachsim/menu'
13
5
  import {
14
6
  type DeviceModel,
15
7
  type DevicePosture,
@@ -19,6 +11,14 @@ import {
19
11
  DYNAMIC_WINDOW_LIMITS,
20
12
  devices,
21
13
  } from './device-catalog.ts'
14
+ import {
15
+ SOOTSIM_AMBIENT_GLOW_LEVELS,
16
+ SOOTSIM_RENDER_RESOLUTION_LEVELS,
17
+ SOOTSIM_STAGE_BACKGROUNDS,
18
+ type SootSimAmbientGlowLevel,
19
+ type SootSimRenderResolution,
20
+ type SootSimStageBackground,
21
+ } from './menuContract'
22
22
  import { DEFAULT_REACT_NATIVE_CONFIGURATION } from './reactNativeConfigurationContract.ts'
23
23
  import {
24
24
  BACKGROUND_PRESET_NAMES,
package/src/swift-host.ts CHANGED
@@ -132,8 +132,10 @@ import {
132
132
  } from './swiftContract'
133
133
  import {
134
134
  enclosingXcodeWorkspace,
135
+ expandXcodeBuildSetting,
135
136
  readXcodeAppTarget,
136
137
  resolveXcodeSwiftPackages,
138
+ xcodeFileListEntries,
137
139
  type XcodeAppTarget,
138
140
  type XcodeModuleTarget,
139
141
  } from './xcode-project'
@@ -2312,11 +2314,34 @@ export function buildSwiftBundleFiles(
2312
2314
  CONTENTS_FOLDER_PATH: wrapper,
2313
2315
  UNLOCALIZED_RESOURCES_FOLDER_PATH: wrapper,
2314
2316
  INFOPLIST_PATH: `${wrapper}/Info.plist`,
2315
- SCRIPT_INPUT_FILE_COUNT: '0',
2316
- SCRIPT_INPUT_FILE_LIST_COUNT: '0',
2317
+ SCRIPT_INPUT_FILE_COUNT: String(phase.inputPaths.length),
2318
+ SCRIPT_INPUT_FILE_LIST_COUNT: String(phase.inputFileListPaths.length),
2317
2319
  SCRIPT_OUTPUT_FILE_COUNT: '0',
2318
2320
  SCRIPT_OUTPUT_FILE_LIST_COUNT: '0',
2319
2321
  }
2322
+ const inputPath = (raw: string) => {
2323
+ const file = path.resolve(
2324
+ phase.directory,
2325
+ expandXcodeBuildSetting(raw, (key) => env[key] ?? ''),
2326
+ )
2327
+ if (!fs.existsSync(file))
2328
+ throw new Error(
2329
+ `${xcode.app.name}: Run Script "${phase.name}" missing input ${file}`,
2330
+ )
2331
+ if (!file.startsWith(`${dir}${path.sep}`))
2332
+ watched.push(path.relative(packagePath, file).split(path.sep).join('/'))
2333
+ return file
2334
+ }
2335
+ phase.inputPaths.forEach((raw, index) => {
2336
+ env[`SCRIPT_INPUT_FILE_${index}`] = inputPath(raw)
2337
+ })
2338
+ phase.inputFileListPaths.forEach((raw, index) => {
2339
+ const source = inputPath(raw)
2340
+ const entries = xcodeFileListEntries(source, inputPath)
2341
+ const expanded = path.join(dir, `Input-${index}.xcfilelist`)
2342
+ fs.writeFileSync(expanded, `${entries.join('\n')}\n`)
2343
+ env[`SCRIPT_INPUT_FILE_LIST_${index}`] = expanded
2344
+ })
2320
2345
  try {
2321
2346
  const [shell, ...args] = phase.command
2322
2347
  execFileSync(shell, args, {
@@ -180,6 +180,8 @@ export interface XcodeAppTarget extends XcodeModuleTarget {
180
180
  command: [string, ...string[]]
181
181
  directory: string
182
182
  environment: Record<string, string>
183
+ inputPaths: string[]
184
+ inputFileListPaths: string[]
183
185
  }[]
184
186
  appIconName: string
185
187
  /** the app project PBXProject developmentRegion, xcode's "en" when it declares none. */
@@ -890,6 +892,8 @@ function compilationConditions(settings: (key: string) => string): string[] {
890
892
  ]
891
893
  }
892
894
 
895
+ export { expand as expandXcodeBuildSetting }
896
+
893
897
  function expand(value: string, lookup: (name: string) => string): string {
894
898
  return value.replace(
895
899
  /\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
@@ -1013,6 +1017,8 @@ function shellCopies(
1013
1017
  }
1014
1018
 
1015
1019
  // an xcfilelist names one path per line; blank lines and comments are skipped.
1020
+ export { fileListEntries as xcodeFileListEntries }
1021
+
1016
1022
  function fileListEntries(file: string, absolute: (raw: string) => string): string[] {
1017
1023
  return fs
1018
1024
  .readFileSync(file, 'utf8')
@@ -2851,8 +2857,6 @@ export function readXcodeAppTarget(
2851
2857
  const phase = app.project.object(id)
2852
2858
  if (
2853
2859
  phase?.isa !== 'PBXShellScriptBuildPhase' ||
2854
- list(phase.inputPaths).length ||
2855
- list(phase.inputFileListPaths).length ||
2856
2860
  list(phase.outputPaths).length ||
2857
2861
  list(phase.outputFileListPaths).length
2858
2862
  )
@@ -2864,6 +2868,8 @@ export function readXcodeAppTarget(
2864
2868
  str(phase.shellScript) ?? '',
2865
2869
  ),
2866
2870
  directory: app.project.projectDir,
2871
+ inputPaths: list(phase.inputPaths),
2872
+ inputFileListPaths: list(phase.inputFileListPaths),
2867
2873
  environment: Object.fromEntries(
2868
2874
  [...settingKeys]
2869
2875
  .filter((key) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(key))