peachsim 0.1.2301 → 0.1.2302

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 (89) hide show
  1. package/cli/commands/inspect.ts +2 -1
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/attached-projects.cjs +1 -1
  5. package/dist-lib/auth/shared-session.cjs +1 -1
  6. package/dist-lib/backend-origin.cjs +1 -1
  7. package/dist-lib/beta.cjs +1 -1
  8. package/dist-lib/beta.mjs +1 -1
  9. package/dist-lib/bridge-constants.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.mjs +1 -1
  12. package/dist-lib/bridge-contract.cjs +1 -1
  13. package/dist-lib/bridge-contract.mjs +1 -1
  14. package/dist-lib/bundle-channel.cjs +375 -292
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cloud-contract.cjs +1 -1
  18. package/dist-lib/cloud-contract.mjs +1 -1
  19. package/dist-lib/cloud-test-args.cjs +1 -1
  20. package/dist-lib/cloud-test-args.mjs +1 -1
  21. package/dist-lib/cloud.cjs +1 -1
  22. package/dist-lib/cloud.mjs +1 -1
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/config.mjs +1 -1
  25. package/dist-lib/detox/index.cjs +2 -2
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/expo-swift-bundle.cjs +326 -243
  28. package/dist-lib/expo-swift-metadata.cjs +1 -1
  29. package/dist-lib/expo-swift-metadata.mjs +1 -1
  30. package/dist-lib/home-paths.cjs +1 -1
  31. package/dist-lib/host/bridge-host.cjs +372 -289
  32. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  33. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  35. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  36. package/dist-lib/host/websocket-proxy.cjs +1 -1
  37. package/dist-lib/index.cjs +2 -2
  38. package/dist-lib/jump-to-source-babel.cjs +1 -1
  39. package/dist-lib/jump-to-source-native.cjs +1 -1
  40. package/dist-lib/kotlin-host.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +2 -2
  48. package/dist-lib/native-app-identity-project.cjs +1 -1
  49. package/dist-lib/native-app-identity-project.mjs +1 -1
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/pdfium-raster.cjs +1 -1
  55. package/dist-lib/pdfium-raster.mjs +1 -1
  56. package/dist-lib/plist.cjs +1 -1
  57. package/dist-lib/plist.mjs +1 -1
  58. package/dist-lib/profiles.cjs +1 -1
  59. package/dist-lib/public-brand.cjs +1 -1
  60. package/dist-lib/public-origins-lib-esm.json +24 -24
  61. package/dist-lib/public-origins-lib.json +53 -53
  62. package/dist-lib/react-native-host-modules.cjs +1 -1
  63. package/dist-lib/react-native-host-modules.mjs +1 -1
  64. package/dist-lib/reap-browser.cjs +1 -1
  65. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  66. package/dist-lib/sdk.cjs +1 -1
  67. package/dist-lib/sdk.mjs +1 -1
  68. package/dist-lib/skills.cjs +425 -342
  69. package/dist-lib/swift-compile.cjs +1 -1
  70. package/dist-lib/swift-compile.mjs +1 -1
  71. package/dist-lib/swift-package.cjs +1 -1
  72. package/dist-lib/swift-package.mjs +1 -1
  73. package/dist-lib/swift-submit.cjs +1 -1
  74. package/dist-lib/swift-submit.mjs +1 -1
  75. package/dist-lib/swift-toolchain.cjs +1 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +1 -1
  78. package/dist-lib/vite.cjs +2 -2
  79. package/dist-lib/worklet-executable.cjs +1 -1
  80. package/dist-lib/worklet-executable.mjs +1 -1
  81. package/dist-types/packages/peach-engine/src/components/native-ui/webview-frame-bridge.d.ts +1 -0
  82. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
  83. package/dist-types/packages/peach-kit/src/capabilities.d.ts +4 -0
  84. package/java-platform/licenses/fdlibm.txt +3 -0
  85. package/kotlin/sdk.tar.gz +0 -0
  86. package/package.json +1 -1
  87. package/runtime-companion.json +1 -1
  88. package/src/expo-native-workspace.ts +85 -37
  89. package/src/one-sdk-preparation.ts +61 -5
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function swiftManifestSettings(target) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/is-record.ts
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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;
@@ -2742,7 +2742,7 @@ var init_src = __esm({
2742
2742
  var runtime_companion_default;
2743
2743
  var init_runtime_companion = __esm({
2744
2744
  "runtime-companion.json"() {
2745
- runtime_companion_default = { abi: 1, sha256: "60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2", file: "node/cli-60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2.cjs" };
2745
+ runtime_companion_default = { abi: 1, sha256: "0688d30cb1cc3cd8d500d66cefa68e1e54456e3a4cd15b621932e4800fc69b1d", file: "node/cli-0688d30cb1cc3cd8d500d66cefa68e1e54456e3a4cd15b621932e4800fc69b1d.cjs" };
2746
2746
  }
2747
2747
  });
2748
2748
 
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (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.2301 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2302 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -13,6 +13,7 @@ export type WebViewFrameBridgeConfig = {
13
13
  webKit?: SootSimWebKitConfiguration;
14
14
  defaultStyle: string;
15
15
  colorScheme: 'light' | 'dark';
16
+ iosWebKitCss: boolean;
16
17
  deviceScale?: number;
17
18
  injectedObjectJson?: string;
18
19
  expoDomWebViewGlobalsSource?: string;
@@ -439,6 +439,7 @@ export interface CompositorFramePhaseSample {
439
439
  javascriptMs: number;
440
440
  layoutMs: number;
441
441
  paintMs: number;
442
+ layersMs: number;
442
443
  prewarmMs: number;
443
444
  textureUploadMs: number;
444
445
  gpuSubmitMs: number;
@@ -475,6 +476,7 @@ export interface CompositorProductionStats {
475
476
  javascript: CompositorTimingSummary;
476
477
  layout: CompositorTimingSummary;
477
478
  paint: CompositorTimingSummary;
479
+ layers: CompositorTimingSummary;
478
480
  prewarm: CompositorTimingSummary;
479
481
  textureUpload: CompositorTimingSummary;
480
482
  gpuSubmit: CompositorTimingSummary;
@@ -1214,6 +1216,8 @@ export interface CompositorStats {
1214
1216
  transactions: number;
1215
1217
  commits: number;
1216
1218
  ops: number;
1219
+ rasters: number;
1220
+ rephased: number;
1217
1221
  };
1218
1222
  layerClaims: {
1219
1223
  live: Readonly<Record<string, number>>;
@@ -752,6 +752,10 @@ export interface NotificationBusInterface {
752
752
  getCategories: () => NotifCategory[];
753
753
  deleteCategory: (id: string) => void;
754
754
  getInitialNotification: () => NotifSpec | null;
755
+ getLastResponse: () => NotifEvent | null;
756
+ clearLastResponse: () => void;
757
+ getPendingResponses: () => NotifEvent[];
758
+ acknowledgeResponse: (identifier: string) => void;
755
759
  on: (type: NotifEventType, cb: (event: NotifEvent) => void) => () => void;
756
760
  onAny: (cb: (event: NotifEvent) => void) => () => void;
757
761
  }
@@ -70,3 +70,6 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70
70
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71
71
  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72
72
  SUCH DAMAGE.
73
+
74
+ JavaHypot.kt is derived from Bionic/FreeBSD e_hypot.c under the SunSoft notice.
75
+ https://android.googlesource.com/platform/bionic/+/refs/heads/android17-release/libm/upstream-freebsd/lib/msun/src/e_hypot.c
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.2301",
3
+ "version": "0.1.2302",
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":"60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2","file":"node/cli-60900a3af6e6213c855e6682baa0ebdb6a6865510e4e3a51a24d4c584b3fdec2.cjs"}
1
+ {"abi":1,"sha256":"0688d30cb1cc3cd8d500d66cefa68e1e54456e3a4cd15b621932e4800fc69b1d","file":"node/cli-0688d30cb1cc3cd8d500d66cefa68e1e54456e3a4cd15b621932e4800fc69b1d.cjs"}
@@ -75,13 +75,23 @@ const NATIVE_CONFIG_FILE =
75
75
  // native sources steer pod install by existing, not by content: an edit to one
76
76
  // is copied into the prepared workspace, an added or removed one rebuilds it.
77
77
  const NATIVE_SOURCE_FILE = /\.(swift|mm?|hpp?|c|cc|cpp|kt|java)$/
78
+
79
+ // every load hashes each workspace byte; a file whose inode, size and both
80
+ // timestamps are unchanged keeps the digest of its last read.
81
+ type FileDigest = {
82
+ ino: number
83
+ size: number
84
+ mtimeMs: number
85
+ ctimeMs: number
86
+ digest: string
87
+ }
88
+ const fileDigests = new Map<string, FileDigest>()
78
89
  const NATIVE_PACKAGE_ENTRY =
79
90
  /^(ios|android|.*\.podspec|expo-module\.config\.json|react-native\.config\.[cm]?[jt]s|app\.plugin\.[cm]?js)$/
80
91
 
81
92
  // every file the native prepare can read, plus the toolchain that reads it.
82
93
  // node_modules stays out: the js install reconciles it with the hashed
83
94
  // lockfiles, and the discovery cache keys the live native inventory separately.
84
- // the walk yields so the bridge that runs it keeps answering its other requests.
85
95
  export async function hashExpoWorkspace(app: string, signal?: AbortSignal) {
86
96
  if (process.platform !== 'darwin') {
87
97
  const source = await hashExpoSourceWorkspace(app, signal)
@@ -281,40 +291,78 @@ async function hashWorkspaceInputs(
281
291
  relative === directory ||
282
292
  relative.startsWith(directory + path.sep),
283
293
  )
284
- const walk = async (directory: string) => {
285
- const entries = await fs.promises.readdir(directory, { withFileTypes: true })
286
- for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
294
+ // the walk lists and stats synchronously: each await of an async walk queues
295
+ // behind the bridge's other native preparation, across tens of thousands of
296
+ // files. only content changed since its last read is read, overlapping.
297
+ const steps: (() => void)[] = []
298
+ const unread: { file: string; content: FileDigest }[] = []
299
+ const walk = (directory: string) => {
300
+ const entries = fs
301
+ .readdirSync(directory, { withFileTypes: true })
302
+ .sort((a, b) => a.name.localeCompare(b.name))
303
+ for (const entry of entries) {
287
304
  signal?.throwIfAborted()
288
305
  const file = path.join(directory, entry.name)
289
306
  const relative = path.relative(root, file)
290
307
  if (excluded(relative, entry.isDirectory())) continue
291
- hash.update(`${relative}\0`)
308
+ steps.push(() => hash.update(`${relative}\0`))
292
309
  if (entry.isSymbolicLink()) {
293
- const link = `link\0${await fs.promises.readlink(file)}\0`
294
- hash.update(link)
295
- if (steersNative(relative)) native.update(`${relative}\0${link}`)
310
+ const link = `link\0${fs.readlinkSync(file)}\0`
311
+ steps.push(() => {
312
+ hash.update(link)
313
+ if (steersNative(relative)) native.update(`${relative}\0${link}`)
314
+ })
296
315
  } else if (entry.isDirectory()) {
297
- hash.update('directory\0')
298
- await walk(file)
316
+ steps.push(() => hash.update('directory\0'))
317
+ walk(file)
299
318
  } else if (entry.isFile()) {
300
319
  const posix = relative.split(path.sep).join('/')
301
320
  if (NATIVE_CONFIG_FILE.test(posix)) {
302
- const bytes = await fs.promises.readFile(file)
303
- if (everyByte) hash.update(`file\0${bytes.length}\0`).update(bytes)
304
- if (steersNative(relative))
305
- native.update(`${posix}\0`).update(nativeConfigBytes(posix, bytes))
306
- } else {
307
- if (everyByte) {
308
- const bytes = await fs.promises.readFile(file)
309
- hash.update(`file\0${bytes.length}\0`).update(bytes)
310
- }
311
- if (NATIVE_SOURCE_FILE.test(posix) && steersNative(relative))
312
- native.update(`${posix}\0`)
321
+ const bytes = fs.readFileSync(file)
322
+ steps.push(() => {
323
+ if (everyByte) hash.update(`file\0${bytes.length}\0`).update(bytes)
324
+ if (steersNative(relative))
325
+ native.update(`${posix}\0`).update(nativeConfigBytes(posix, bytes))
326
+ })
327
+ continue
313
328
  }
329
+ if (everyByte) {
330
+ const stat = fs.statSync(file)
331
+ const known = fileDigests.get(file)
332
+ const content =
333
+ known?.ino === stat.ino &&
334
+ known.size === stat.size &&
335
+ known.mtimeMs === stat.mtimeMs &&
336
+ known.ctimeMs === stat.ctimeMs
337
+ ? known
338
+ : {
339
+ ino: stat.ino,
340
+ size: stat.size,
341
+ mtimeMs: stat.mtimeMs,
342
+ ctimeMs: stat.ctimeMs,
343
+ digest: '',
344
+ }
345
+ if (content !== known) unread.push({ file, content })
346
+ steps.push(() => hash.update(`file\0${content.size}\0${content.digest}`))
347
+ }
348
+ if (NATIVE_SOURCE_FILE.test(posix) && steersNative(relative))
349
+ steps.push(() => native.update(`${posix}\0`))
314
350
  }
315
351
  }
316
352
  }
317
- await walk(root)
353
+ walk(root)
354
+ for (let start = 0; start < unread.length; start += 32) {
355
+ signal?.throwIfAborted()
356
+ await Promise.all(
357
+ unread.slice(start, start + 32).map(async ({ file, content }) => {
358
+ const bytes = await fs.promises.readFile(file)
359
+ content.size = bytes.length
360
+ content.digest = createHash('sha256').update(bytes).digest('hex')
361
+ fileDigests.set(file, content)
362
+ }),
363
+ )
364
+ }
365
+ for (const step of steps) step()
318
366
  if (sourceOnly) {
319
367
  hash.update(`\0${appRelative}\0`)
320
368
  return {
@@ -327,9 +375,14 @@ async function hashWorkspaceInputs(
327
375
  }
328
376
  // cocoapods and xcode exist only on a Mac; elsewhere only the prebuild stage runs
329
377
  const execFileAsync = promisify(execFile)
330
- const mac =
378
+ const pinnedNode =
379
+ typeof manifest.engines?.node === 'string' &&
380
+ /^\d+(\.\d+){0,2}$/.test(manifest.engines.node)
381
+ ? `node@${manifest.engines.node}`
382
+ : null
383
+ const [mac, node] = await Promise.all([
331
384
  process.platform === 'darwin'
332
- ? await Promise.all([
385
+ ? Promise.all([
333
386
  // runner-toolchain-platform: darwin
334
387
  execFileAsync('pod', ['--version'], { env: utf8Env, signal }).catch(
335
388
  (cause: unknown) => {
@@ -341,23 +394,18 @@ async function hashWorkspaceInputs(
341
394
  // runner-toolchain-platform: darwin
342
395
  execFileAsync('xcodebuild', ['-version'], { env: utf8Env, signal }),
343
396
  ]).then(([pod, xcode]) => ({ podVersion: pod.stdout, xcode: xcode.stdout }))
344
- : {}
345
- const pinnedNode =
346
- typeof manifest.engines?.node === 'string' &&
347
- /^\d+(\.\d+){0,2}$/.test(manifest.engines.node)
348
- ? `node@${manifest.engines.node}`
349
- : null
397
+ : {},
398
+ execFileAsync(
399
+ pinnedNode ? 'mise' : 'node',
400
+ pinnedNode ? ['exec', pinnedNode, '--', 'node', '--version'] : ['--version'],
401
+ { cwd: root, signal },
402
+ ),
403
+ ])
350
404
  const toolchain = JSON.stringify({
351
405
  preparation: 7,
352
406
  appRelative,
353
407
  ...mac,
354
- node: (
355
- await execFileAsync(
356
- pinnedNode ? 'mise' : 'node',
357
- pinnedNode ? ['exec', pinnedNode, '--', 'node', '--version'] : ['--version'],
358
- { cwd: root, signal },
359
- )
360
- ).stdout.trim(),
408
+ node: node.stdout.trim(),
361
409
  packageManager: workspacePackageManager(root, manifest.packageManager, excluded),
362
410
  podsEnvironment,
363
411
  })
@@ -1,6 +1,8 @@
1
+ import { spawn } from 'node:child_process'
1
2
  import { createHash } from 'node:crypto'
2
3
  import fs from 'node:fs'
3
4
  import { createRequire } from 'node:module'
5
+ import os from 'node:os'
4
6
  import path from 'node:path'
5
7
  import { pathToFileURL } from 'node:url'
6
8
  import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
@@ -12,10 +14,61 @@ import {
12
14
 
13
15
  interface SDKGenerator {
14
16
  importedFrameworks(root: string): string[]
15
- generateAppSdk(frameworks: string[]): Promise<{
16
- files: Map<string, string>
17
- generation: string
18
- }>
17
+ }
18
+
19
+ // the generator reads symbol graphs and runs compiler passes in this thread for
20
+ // minutes on a cold cache, and the dev bridge that serves every peach command
21
+ // calls it, so it runs in its own process.
22
+ const GENERATE_SCRIPT = `
23
+ import { writeFileSync } from 'node:fs'
24
+ import { pathToFileURL } from 'node:url'
25
+ const [generatorFile, resultFile, frameworks] = process.argv.slice(1)
26
+ const generator = await import(pathToFileURL(generatorFile).href)
27
+ const { files, generation } = await generator.generateAppSdk(JSON.parse(frameworks))
28
+ writeFileSync(resultFile, JSON.stringify({ generation, files: [...files] }))
29
+ `
30
+
31
+ async function generateAppSdkInChild(
32
+ generatorFile: string,
33
+ frameworks: string[],
34
+ ): Promise<{ generation: string; files: Map<string, string> }> {
35
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-one-sdk-'))
36
+ const resultFile = path.join(directory, 'result.json')
37
+ try {
38
+ const child = spawn(
39
+ 'node',
40
+ [
41
+ '--input-type=module',
42
+ '-e',
43
+ GENERATE_SCRIPT,
44
+ generatorFile,
45
+ resultFile,
46
+ JSON.stringify(frameworks),
47
+ ],
48
+ { stdio: ['ignore', 'ignore', 'pipe'] },
49
+ )
50
+ let stderr = ''
51
+ child.stderr.setEncoding('utf8')
52
+ child.stderr.on('data', (chunk: string) => {
53
+ stderr += chunk
54
+ })
55
+ const [status, signal] = await new Promise<[number | null, NodeJS.Signals | null]>(
56
+ (resolve, reject) => {
57
+ child.once('error', reject)
58
+ child.once('close', (code, closeSignal) => resolve([code, closeSignal]))
59
+ },
60
+ )
61
+ if (status !== 0)
62
+ throw new Error(
63
+ `One SDK source generation failed (${signal ?? `exit ${status}`})${stderr ? `: ${stderr.trim().slice(-2000)}` : ''}`,
64
+ )
65
+ const result: { generation: string; files: [string, string][] } = JSON.parse(
66
+ fs.readFileSync(resultFile, 'utf8'),
67
+ )
68
+ return { generation: result.generation, files: new Map(result.files) }
69
+ } finally {
70
+ fs.rmSync(directory, { recursive: true, force: true })
71
+ }
19
72
  }
20
73
 
21
74
  export async function selectOneSDK(appRoot: string) {
@@ -88,7 +141,10 @@ export async function prepareOneSDKSources(appRoot: string, output?: string) {
88
141
  fs.copyFileSync(path.join(published, name), path.join(directory, name))
89
142
  return
90
143
  }
91
- const generated = await selected.generator.generateAppSdk(selected.frameworks)
144
+ const generated = await generateAppSdkInChild(
145
+ path.join(selected.one, 'dist/sdk/app.mjs'),
146
+ selected.frameworks,
147
+ )
92
148
  if (generated.generation !== generation)
93
149
  throw new Error('One SDK source generation differs from the installed facades')
94
150
  fs.rmSync(directory, { recursive: true, force: true })