peachsim 0.1.1815 → 0.1.1817

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 (97) hide show
  1. package/cli/commands/package.ts +82 -31
  2. package/cli/outbound-endpoints.ts +1 -1
  3. package/cli/packaged-app-launcher.ts +6 -1
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +4418 -5235
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +12 -3
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +3932 -4526
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +3289 -4175
  34. package/dist-lib/host/fetch-proxy-handler.cjs +12 -3
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +13 -24
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +13 -24
  50. package/dist-lib/native-app-identity-project.cjs +2 -22
  51. package/dist-lib/native-app-identity-project.mjs +2 -22
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +74 -66
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +3793 -4671
  71. package/dist-lib/swift-compile.cjs +216 -242
  72. package/dist-lib/swift-compile.mjs +216 -242
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +251 -236
  80. package/dist-lib/vite.cjs +12 -3
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/package.json +1 -1
  84. package/src/answeredNativePackages.ts +41 -0
  85. package/src/cli-runtime.ts +2 -9
  86. package/src/expo-discovery-cache.ts +2 -0
  87. package/src/expo-kotlin-host.ts +11 -9
  88. package/src/expo-swift-host.ts +10 -6
  89. package/src/nitro-bundle.ts +8 -6
  90. package/src/nitro-compiler-digest.ts +2 -4
  91. package/src/nitro-superset.lock.json +19 -251
  92. package/src/nitro-superset.ts +59 -63
  93. package/src/react-native-bridge-modules.ts +2 -4
  94. package/src/swift-compile.ts +258 -254
  95. package/src/swift-objc-standin.ts +10 -6
  96. package/src/swift-standins.ts +36 -12
  97. package/src/turbo-source.ts +2 -3
@@ -1,4 +1,4 @@
1
- import { execFileSync } from 'node:child_process'
1
+ import { execFileSync, spawn, spawnSync } from 'node:child_process'
2
2
  import { createHash, randomUUID } from 'node:crypto'
3
3
  import fs from 'node:fs'
4
4
  import os from 'node:os'
@@ -44,6 +44,7 @@ import {
44
44
  readPackageVersionsFooter,
45
45
  type PackageVersions,
46
46
  } from '../../src/packageVersionsContract'
47
+ import { terminateProcessGroup } from '../../src/process-group'
47
48
  import { resolveActiveRuntimeRoot } from '../../src/runtime-assets'
48
49
  import { discoverAppCatalog } from '../app-catalog'
49
50
  import { loadRNXAppConfig } from '../app-config'
@@ -65,6 +66,71 @@ import {
65
66
 
66
67
  const origin = APP_PACKAGE_ORIGIN
67
68
 
69
+ // a launch compiles every script the app runs as it starts. the bytecode v8 keeps from one launch
70
+ // here ships in the bundle, where the realms read it (peach-desktop node/realm.mjs), so the first
71
+ // launch on any mac skips that compile. realms write their cache as they close.
72
+ async function primeCodeCache(app: string, home: string): Promise<void> {
73
+ const peach = path.join(app, 'Contents', 'Resources', 'bin', 'peach')
74
+ const env = {
75
+ ...process.env,
76
+ PEACH_HOME: home,
77
+ PEACH_CLI_CURRENT_SIM_PATH: path.join(home, 'current-sim.json'),
78
+ }
79
+ fs.mkdirSync(home)
80
+ const host = spawn(
81
+ path.join(app, 'Contents', 'MacOS', 'PeachApp'),
82
+ ['--peach-app-home', home],
83
+ { stdio: 'ignore', detached: true },
84
+ )
85
+ const exited = new Promise<NodeJS.Signals | null>((resolve) =>
86
+ host.once('exit', (_code, signal) => resolve(signal)),
87
+ )
88
+ // the cli finds no sim until the host's page reaches the app's service
89
+ const deadline = Date.now() + 120_000
90
+ for (;;) {
91
+ const ready = spawnSync(
92
+ peach,
93
+ ['wait', 'ready', '--max-ms', String(Math.max(1000, deadline - Date.now()))],
94
+ { env, encoding: 'utf8' },
95
+ )
96
+ if (ready.status === 0) break
97
+ if (Date.now() > deadline) {
98
+ await terminateProcessGroup(host, 'SIGKILL')
99
+ throw new Error(
100
+ `the packaged app did not start: ${(ready.stderr + ready.stdout).slice(-400)}`,
101
+ )
102
+ }
103
+ await new Promise((resolve) => setTimeout(resolve, 500))
104
+ }
105
+ // what the first screen runs once its data arrives belongs in the cache too
106
+ spawnSync(peach, ['wait', 'idle', '--max-ms', '10000'], { env })
107
+ host.kill('SIGTERM')
108
+ const quit = setTimeout(() => void terminateProcessGroup(host, 'SIGKILL'), 30_000)
109
+ if ((await exited) === 'SIGKILL') throw new Error('the packaged app did not quit')
110
+ clearTimeout(quit)
111
+ const service: unknown = JSON.parse(
112
+ fs.readFileSync(path.join(home, 'app-runtime.json'), 'utf8'),
113
+ )
114
+ if (isRecord(service) && typeof service.pid === 'number')
115
+ spawnSync('/bin/kill', [String(service.pid)])
116
+ const seeded = path.join(app, 'Contents', 'Resources', 'code-cache')
117
+ fs.mkdirSync(seeded)
118
+ for (const entry of fs.readdirSync(path.join(home, 'desktop', 'node-host'), {
119
+ recursive: true,
120
+ withFileTypes: true,
121
+ }))
122
+ // a partial write carries its thread's suffix
123
+ if (
124
+ entry.isFile() &&
125
+ path.basename(entry.parentPath) === 'code-cache' &&
126
+ !entry.name.includes('.')
127
+ )
128
+ fs.copyFileSync(
129
+ path.join(entry.parentPath, entry.name),
130
+ path.join(seeded, entry.name),
131
+ )
132
+ }
133
+
68
134
  async function projectIcon(
69
135
  project: string,
70
136
  scratch: string,
@@ -703,20 +769,18 @@ export async function runPackage(args: string[]): Promise<void> {
703
769
  return file
704
770
  }
705
771
  const appEntitlements = entitlementsOf(`MacOS/${hostExecutable}`)
772
+ const sign = (target: string, entitlements?: string) =>
773
+ execFileSync('/usr/bin/codesign', [
774
+ '--force',
775
+ '--sign',
776
+ identity ?? '-',
777
+ ...(identity ? ['--options', 'runtime', '--timestamp'] : []),
778
+ ...(entitlements ? ['--entitlements', entitlements] : []),
779
+ target,
780
+ ])
706
781
  if (identity) {
707
782
  // the release order of the host's own signing: every nested binary, then
708
783
  // nested bundles deepest first, then the entitled binaries and the app
709
- const sign = (target: string, entitlements?: string) =>
710
- execFileSync('/usr/bin/codesign', [
711
- '--force',
712
- '--sign',
713
- identity,
714
- '--options',
715
- 'runtime',
716
- '--timestamp',
717
- ...(entitlements ? ['--entitlements', entitlements] : []),
718
- target,
719
- ])
720
784
  const files = fs
721
785
  .readdirSync(contents, { recursive: true, withFileTypes: true })
722
786
  .filter((entry) => entry.isFile())
@@ -740,25 +804,12 @@ export async function runPackage(args: string[]): Promise<void> {
740
804
  sign(bundle)
741
805
  sign(path.join(resources, 'bin', 'peach'), entitlementsOf('Resources/bin/peach'))
742
806
  sign(path.join(contents, 'Frameworks', 'node'), entitlementsOf('Frameworks/node'))
743
- // the launcher script is the bundle executable, so the host binary
744
- // needs its jit entitlements signed on directly
745
- sign(path.join(contents, 'MacOS', hostExecutable), appEntitlements)
746
- sign(temporary, appEntitlements)
747
- } else {
748
- for (const executable of [
749
- path.join(contents, 'MacOS', hostExecutable),
750
- path.join(resources, 'bin', 'peach'),
751
- ])
752
- execFileSync('/usr/bin/codesign', [
753
- '--force',
754
- '--sign',
755
- '-',
756
- '--entitlements',
757
- appEntitlements,
758
- executable,
759
- ])
760
- execFileSync('/usr/bin/codesign', ['--force', '--sign', '-', temporary])
761
- }
807
+ } else sign(path.join(resources, 'bin', 'peach'), appEntitlements)
808
+ // the launcher script is the bundle executable, so the host binary
809
+ // needs its jit entitlements signed on directly
810
+ sign(path.join(contents, 'MacOS', hostExecutable), appEntitlements)
811
+ await primeCodeCache(temporary, path.join(scratch, 'prime-home'))
812
+ sign(temporary, identity ? appEntitlements : undefined)
762
813
  execFileSync('/usr/bin/codesign', ['--verify', '--deep', '--strict', temporary])
763
814
  const notarize = (file: string) => {
764
815
  const result: unknown = JSON.parse(
@@ -507,7 +507,7 @@ export const DECLARED_OUTBOUND_CALLS: Record<string, OutboundCallDeclaration> =
507
507
  category: 'local_development',
508
508
  count: 1,
509
509
  },
510
- // the shared Nitro executable: one HEAD of its registry address, once per
510
+ // the shared Nitro executable: one GET of its key's metadata, once per
511
511
  // process, before an app points its metadata at it; no project or app data.
512
512
  'packages/peachsim/src/nitroAdapterContract.ts :: fetch :: url': {
513
513
  category: 'nitro_published_headers',
@@ -88,7 +88,12 @@ async function main() {
88
88
  const source = path.join(resources, 'payload', name);
89
89
  const destination = path.join(staged, name);
90
90
  if (manifest.relocatableFiles.includes(name)) fs.writeFileSync(destination, relocate(fs.readFileSync(source, 'utf8')));
91
- else fs.copyFileSync(source, destination);
91
+ // a payload file is named by its content, so a staged one from an earlier launch already holds it
92
+ else if (!fs.existsSync(destination)) {
93
+ const partial = destination + '.' + process.pid;
94
+ fs.copyFileSync(source, partial, fs.constants.COPYFILE_FICLONE);
95
+ fs.renameSync(partial, destination);
96
+ }
92
97
  }
93
98
  const url = new URL(relocate(manifest.launchUrl));
94
99
  url.searchParams.set('peachPackage', JSON.stringify({ id: manifest.identifier, name: manifest.name, icon: manifest.iconUrl ? relocate(manifest.iconUrl) : '' }));
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/beta.ts
4
4
  var IS_BETA = true;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/bridge-contract.ts
4
4
  var SIM_LONG_PRESS_MAX_MS = 5e3;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1815 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/bridge-contract.ts
4
4
  var REFUSED_PERFORM_STEP_TYPES = [