peachsim 0.1.639 → 0.1.640

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 (67) hide show
  1. package/cli/commands/control.ts +33 -1
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/agent-identity.cjs +1 -1
  5. package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/home-paths.cjs +1 -1
  29. package/dist-lib/host/bridge-host.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  32. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  33. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  34. package/dist-lib/host/websocket-proxy.cjs +1 -1
  35. package/dist-lib/index.cjs +1 -1
  36. package/dist-lib/jump-to-source-babel.cjs +1 -1
  37. package/dist-lib/jump-to-source-native.cjs +1 -1
  38. package/dist-lib/kotlin-host.cjs +1 -1
  39. package/dist-lib/menu.cjs +1 -1
  40. package/dist-lib/menu.mjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  43. package/dist-lib/metro-production-bundle.cjs +1 -1
  44. package/dist-lib/metro-production-bundle.mjs +1 -1
  45. package/dist-lib/metro.cjs +1 -1
  46. package/dist-lib/native-app-identity.cjs +1 -1
  47. package/dist-lib/native-app-identity.mjs +1 -1
  48. package/dist-lib/profiles.cjs +1 -1
  49. package/dist-lib/public-brand.cjs +1 -1
  50. package/dist-lib/react-native-host-modules.cjs +1 -1
  51. package/dist-lib/react-native-host-modules.mjs +1 -1
  52. package/dist-lib/render-mode.cjs +1 -1
  53. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  54. package/dist-lib/sdk.cjs +1 -1
  55. package/dist-lib/sdk.mjs +1 -1
  56. package/dist-lib/skills.cjs +342 -200
  57. package/dist-lib/swift-compile.cjs +1 -1
  58. package/dist-lib/swift-compile.mjs +1 -1
  59. package/dist-lib/swift-package.cjs +1 -1
  60. package/dist-lib/swift-package.mjs +1 -1
  61. package/dist-lib/swift-submit.cjs +1 -1
  62. package/dist-lib/swift-submit.mjs +1 -1
  63. package/dist-lib/swift.cjs +1 -1
  64. package/dist-lib/vite-swift.cjs +1 -1
  65. package/dist-lib/vite.cjs +1 -1
  66. package/package.json +1 -1
  67. package/src/dot-env.ts +148 -0
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/swift-compile.ts
4
4
  import { execFile as execFile2 } from "node:child_process";
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function isSwiftManifestFile(file) {
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/swift-submit.ts
4
4
  var SWIFT_COMPILE_PATH = "/api/swift-compile";
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.639 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.640 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.639",
3
+ "version": "0.1.640",
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",
package/src/dot-env.ts ADDED
@@ -0,0 +1,148 @@
1
+ // the env file an iOS build compiles into the binary for react-native-config,
2
+ // read the way its build phase reads it (`ios/ReactNativeConfig/ReadDotEnv.rb`
3
+ // and `BuildDotenvConfig.rb`, 1.7.2). `peach open --load-env` hands the result
4
+ // to the tenant, where the RNCConfigModule seam answers `getConfig()` with it.
5
+ //
6
+ // the build picks `/tmp/envfile`, then `ENVFILE` (expanding `$(VAR)`, `${VAR}`
7
+ // and `$VAR` from the environment), then `.env`, and falls back to `.env` when
8
+ // the requested file is missing. each value is written into an Objective-C
9
+ // string literal with only `"` escaped, so the compiler then decodes any
10
+ // backslash escape the value carries; a value that ends the literal early
11
+ // fails the build.
12
+
13
+ import fs from 'node:fs'
14
+ import path from 'node:path'
15
+
16
+ const DEFAULT_ENV_FILE = '.env'
17
+ // ReadDotEnv.rb's dotenv_pattern. Ruby's [[:alnum:]] is Unicode alphabetic or
18
+ // decimal digit, \s is [ \t\n\v\f\r], and `.` matches anything but \n.
19
+ const DOTENV_PATTERN =
20
+ /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u
21
+ const BUILD_SETTING_PATTERN =
22
+ /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g
23
+ const INVALID_ENTRY =
24
+ 'Invalid entry in .env file. Please verify your .env file is correctly formatted.'
25
+
26
+ export type DotEnvResult = {
27
+ config: Record<string, string>
28
+ // what the build phase prints, for the caller to show
29
+ notices: string[]
30
+ }
31
+
32
+ function selectEnvFile(env: NodeJS.ProcessEnv, notices: string[]) {
33
+ if (fs.existsSync('/tmp/envfile')) {
34
+ return { name: fs.readFileSync('/tmp/envfile', 'utf8').trim(), fromEnvfile: false }
35
+ }
36
+ const requested = env.ENVFILE
37
+ if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false }
38
+ const unset: string[] = []
39
+ const name = requested.replace(BUILD_SETTING_PATTERN, (_, braced, bare) => {
40
+ const variable: string = braced ?? bare
41
+ const value = env[variable]
42
+ if (!value) unset.push(variable)
43
+ return value ?? ''
44
+ })
45
+ notices.push(`ENVFILE=${requested}`)
46
+ if (name !== requested) notices.push(` expands to ${name}`)
47
+ if (unset.length) {
48
+ notices.push(
49
+ ` note: ${[...new Set(unset)].join(', ')} resolved to nothing. Outside Xcode these build settings are not set - pass the file name directly, or run the build through Xcode.`,
50
+ )
51
+ }
52
+ return { name, fromEnvfile: true }
53
+ }
54
+
55
+ // how clang reads the value inside `@"..."`
56
+ function decodeObjCStringLiteral(source: string): string {
57
+ let out = ''
58
+ for (let i = 0; i < source.length; i++) {
59
+ const char = source[i]
60
+ if (char === '"') throw new Error(`GeneratedDotEnv.m does not compile: ${source}`)
61
+ if (char !== '\\') {
62
+ out += char
63
+ continue
64
+ }
65
+ const next = source[++i]
66
+ if (next === undefined)
67
+ throw new Error(`GeneratedDotEnv.m does not compile: ${source}`)
68
+ const simple: Record<string, string> = {
69
+ n: '\n',
70
+ t: '\t',
71
+ r: '\r',
72
+ a: '\x07',
73
+ b: '\b',
74
+ f: '\f',
75
+ v: '\v',
76
+ e: '\x1b',
77
+ }
78
+ if (next in simple) out += simple[next]
79
+ else if (/[0-7]/.test(next)) {
80
+ const digits = /^[0-7]{1,3}/.exec(source.slice(i))![0]
81
+ out += String.fromCodePoint(Number.parseInt(digits, 8))
82
+ i += digits.length - 1
83
+ } else if (next === 'x' || next === 'u' || next === 'U') {
84
+ const digits =
85
+ next === 'x'
86
+ ? (/^[0-9a-fA-F]+/.exec(source.slice(i + 1))?.[0] ?? '')
87
+ : source.slice(i + 1, i + 1 + (next === 'u' ? 4 : 8))
88
+ const code = Number.parseInt(digits, 16)
89
+ if (!/^[0-9a-fA-F]+$/.test(digits) || code > (next === 'x' ? 0xff : 0x10ffff)) {
90
+ throw new Error(`GeneratedDotEnv.m does not compile: ${source}`)
91
+ }
92
+ out += String.fromCodePoint(code)
93
+ i += digits.length
94
+ } else out += next
95
+ }
96
+ return out
97
+ }
98
+
99
+ export function readProjectDotEnv(
100
+ envsRoot: string,
101
+ env: NodeJS.ProcessEnv = process.env,
102
+ ): DotEnvResult {
103
+ const notices: string[] = []
104
+ const selection = selectEnvFile(env, notices)
105
+ // File.expand_path(File.join(root, name)) joins even an absolute name onto root
106
+ const requestedPaths = [
107
+ path.resolve(path.join(envsRoot, selection.name)),
108
+ path.resolve(selection.name),
109
+ ]
110
+ const candidates = [
111
+ ...requestedPaths,
112
+ path.resolve(path.join(envsRoot, DEFAULT_ENV_FILE)),
113
+ ]
114
+ if (!fs.existsSync(candidates[2])) candidates.push(path.resolve(DEFAULT_ENV_FILE))
115
+ const tried = [...new Set(candidates)]
116
+ const resolved = tried.find((candidate) => fs.existsSync(candidate))
117
+ if (!resolved) {
118
+ notices.push(
119
+ '*** Missing .env file ****',
120
+ 'Tried, in order:',
121
+ ...tried.map((candidate) => ` - ${candidate}`),
122
+ 'The build will succeed and Config will be empty at runtime.',
123
+ )
124
+ return { config: {}, notices }
125
+ }
126
+ if (selection.fromEnvfile && !requestedPaths.includes(resolved)) {
127
+ notices.push(
128
+ '*** ENVFILE was set, but that file is missing ',
129
+ `Asked for: ${selection.name}`,
130
+ 'Not found at:',
131
+ ...requestedPaths.map((candidate) => ` - ${candidate}`),
132
+ `Falling back to: ${resolved}`,
133
+ )
134
+ }
135
+ const config: Record<string, string> = {}
136
+ for (const line of fs.readFileSync(resolved, 'utf8').split('\n')) {
137
+ if (!line.trim()) continue
138
+ if (/^[ \t\n\v\f\r]*#/.test(line)) continue
139
+ const match = DOTENV_PATTERN.exec(line)
140
+ if (!match?.groups) throw new Error(INVALID_ENTRY)
141
+ // BuildDotenvConfig.rb writes @"#{v.chomp}" after escaping `"`
142
+ const literal = (match.groups.val ?? '')
143
+ .replaceAll('"', '\\"')
144
+ .replace(/(\r\n|\n|\r)$/, '')
145
+ config[match.groups.key] = decodeObjCStringLiteral(literal)
146
+ }
147
+ return { config, notices }
148
+ }