peachsim 0.1.2438 → 0.1.2439

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 (175) hide show
  1. package/README.md +30 -98
  2. package/cli/app-catalog.ts +4 -73
  3. package/cli/catalog/content.ts +1 -1
  4. package/cli/cloud-box-artifact.ts +26 -39
  5. package/cli/cloud-client.ts +69 -117
  6. package/cli/cloud-session.ts +2 -9
  7. package/cli/commands/box.ts +6 -6
  8. package/cli/commands/control.ts +4 -11
  9. package/cli/commands/flow.ts +5 -9
  10. package/cli/commands/kotlin.ts +2 -1
  11. package/cli/commands/platform.ts +21 -39
  12. package/cli/commands/record-three.ts +1 -1
  13. package/cli/commands/shell-url.ts +29 -23
  14. package/cli/dev-build-freshness.ts +4 -3
  15. package/cli/native-input.ts +2 -2
  16. package/cli/outbound-endpoints.ts +20 -45
  17. package/cli/remote-project-bundle.ts +8 -14
  18. package/cli/remote-simulators.ts +1 -1
  19. package/cli/send-to-box.ts +2 -1
  20. package/detox/jest-preset.cjs +1 -1
  21. package/detox/jest-transform.cjs +40 -2
  22. package/dist-lib/agent-daemon-client.cjs +34 -24
  23. package/dist-lib/agent-events.cjs +1 -1
  24. package/dist-lib/attached-projects.cjs +19 -17
  25. package/dist-lib/auth/shared-session.cjs +18 -16
  26. package/dist-lib/backend-origin.cjs +1 -1
  27. package/dist-lib/beta.cjs +1 -1
  28. package/dist-lib/beta.mjs +2 -1
  29. package/dist-lib/bridge-constants.cjs +1 -1
  30. package/dist-lib/bridge-contract-input.cjs +1 -1
  31. package/dist-lib/bridge-contract-input.mjs +20 -583
  32. package/dist-lib/bridge-contract.cjs +1 -1
  33. package/dist-lib/bridge-contract.mjs +17 -99
  34. package/dist-lib/bundle-channel.cjs +8718 -5552
  35. package/dist-lib/capture-contract.cjs +1 -1
  36. package/dist-lib/capture-contract.mjs +13 -363
  37. package/dist-lib/cloud-contract.cjs +1 -1
  38. package/dist-lib/cloud-contract.mjs +34 -155
  39. package/dist-lib/cloud-test-args.cjs +1 -1
  40. package/dist-lib/cloud-test-args.mjs +2 -1
  41. package/dist-lib/cloud.cjs +1 -1
  42. package/dist-lib/cloud.mjs +26 -155
  43. package/dist-lib/config.cjs +1 -4
  44. package/dist-lib/config.mjs +11 -30
  45. package/dist-lib/detox/index.cjs +2554 -230
  46. package/dist-lib/detox/jest-preset.cjs +1 -1
  47. package/dist-lib/detox/jest-transform.cjs +40 -2
  48. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  49. package/dist-lib/esm-chunks/acorn-FGE4PYDJ.mjs +50 -0
  50. package/dist-lib/esm-chunks/chunk-2EUHEBIJ.mjs +664 -0
  51. package/dist-lib/esm-chunks/chunk-2NPABFPN.mjs +5719 -0
  52. package/dist-lib/esm-chunks/chunk-4ZFNH7TU.mjs +10 -0
  53. package/dist-lib/esm-chunks/chunk-5T4XBUJP.mjs +1353 -0
  54. package/dist-lib/esm-chunks/chunk-6VY6HTJC.mjs +18951 -0
  55. package/dist-lib/esm-chunks/chunk-7HANEMO4.mjs +188 -0
  56. package/dist-lib/esm-chunks/chunk-C3WBGYP6.mjs +186 -0
  57. package/dist-lib/esm-chunks/chunk-CVGDRROP.mjs +57 -0
  58. package/dist-lib/esm-chunks/chunk-DADGQELM.mjs +375 -0
  59. package/dist-lib/esm-chunks/chunk-DEGYKHN7.mjs +12 -0
  60. package/dist-lib/esm-chunks/chunk-HIDNO3RP.mjs +10992 -0
  61. package/dist-lib/esm-chunks/chunk-HSADZOVN.mjs +30 -0
  62. package/dist-lib/esm-chunks/chunk-IWJUYJQO.mjs +42 -0
  63. package/dist-lib/esm-chunks/chunk-JCKI3VZ6.mjs +10 -0
  64. package/dist-lib/esm-chunks/chunk-KSQ5KM5Y.mjs +17 -0
  65. package/dist-lib/esm-chunks/chunk-KVTIDLBK.mjs +598 -0
  66. package/dist-lib/esm-chunks/chunk-MIQSRBVU.mjs +10 -0
  67. package/dist-lib/esm-chunks/chunk-YB27R6JG.mjs +115 -0
  68. package/dist-lib/esm-chunks/metro-layout-parser-MVUAXRUJ.mjs +58 -0
  69. package/dist-lib/expo-swift-bundle.cjs +7856 -4707
  70. package/dist-lib/expo-swift-metadata.cjs +1 -1
  71. package/dist-lib/expo-swift-metadata.mjs +16 -165
  72. package/dist-lib/home-paths.cjs +1 -1
  73. package/dist-lib/host/bridge-host.cjs +15658 -11404
  74. package/dist-lib/host/fetch-proxy-handler.cjs +3927 -342
  75. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  76. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -1
  77. package/dist-lib/host/replacement-module-handler.cjs +4 -4
  78. package/dist-lib/host/websocket-proxy.cjs +1 -1
  79. package/dist-lib/index.cjs +9145 -32150
  80. package/dist-lib/jump-to-source-babel.cjs +1 -1
  81. package/dist-lib/jump-to-source-native.cjs +2 -2
  82. package/dist-lib/kotlin-host.cjs +260 -253
  83. package/dist-lib/menu.cjs +1 -1
  84. package/dist-lib/menu.mjs +5 -13
  85. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  86. package/dist-lib/metro-fingerprint-registry.mjs +5 -6
  87. package/dist-lib/metro-production-bundle.cjs +22 -3
  88. package/dist-lib/metro-production-bundle.mjs +26 -92
  89. package/dist-lib/native-app-identity-project.cjs +663 -451
  90. package/dist-lib/native-app-identity-project.mjs +509 -2318
  91. package/dist-lib/native-app-identity.cjs +1 -1
  92. package/dist-lib/native-app-identity.mjs +27 -1340
  93. package/dist-lib/native-firebase-metadata.cjs +1 -1
  94. package/dist-lib/native-firebase-metadata.mjs +5 -18
  95. package/dist-lib/pdfium-raster.cjs +1 -1
  96. package/dist-lib/pdfium-raster.mjs +2 -1
  97. package/dist-lib/plist.cjs +2 -2
  98. package/dist-lib/plist.mjs +5 -7
  99. package/dist-lib/profiles.cjs +2 -1
  100. package/dist-lib/public-brand.cjs +1 -1
  101. package/dist-lib/public-origins-lib-esm.json +246 -187
  102. package/dist-lib/public-origins-lib-static.json +1 -1
  103. package/dist-lib/public-origins-lib.json +1059 -1238
  104. package/dist-lib/react-native-host-modules.cjs +1 -1
  105. package/dist-lib/react-native-host-modules.mjs +2 -1
  106. package/dist-lib/reap-browser.cjs +18 -7
  107. package/dist-lib/scripts/dev-server-scanner.cjs +6 -230
  108. package/dist-lib/sdk.cjs +1 -1
  109. package/dist-lib/sdk.mjs +22 -78
  110. package/dist-lib/skills.cjs +21657 -17374
  111. package/dist-lib/swift-compile.cjs +1343 -1318
  112. package/dist-lib/swift-compile.mjs +68 -19013
  113. package/dist-lib/swift-package.cjs +1 -1
  114. package/dist-lib/swift-package.mjs +35 -630
  115. package/dist-lib/swift-submit.cjs +1 -1
  116. package/dist-lib/swift-submit.mjs +9 -24
  117. package/dist-lib/swift-toolchain.cjs +1 -1
  118. package/dist-lib/swift.cjs +1 -1
  119. package/dist-lib/vendor/@peculiar/x509.cjs +18061 -0
  120. package/dist-lib/vendor/acorn.cjs +5699 -0
  121. package/dist-lib/vendor/bplist-parser.cjs +1589 -0
  122. package/dist-lib/vendor/ignore.cjs +455 -0
  123. package/dist-lib/vendor/magic-string.cjs +1693 -0
  124. package/dist-lib/vendor/plist.cjs +10978 -0
  125. package/dist-lib/vendor/smol-toml.cjs +768 -0
  126. package/dist-lib/vendor/stream-json.cjs +1997 -0
  127. package/dist-lib/vendor/sucrase/dist/index.js.cjs +23593 -0
  128. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +15750 -0
  129. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +11316 -0
  130. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +482 -0
  131. package/dist-lib/vendor/sucrase.cjs +23593 -0
  132. package/dist-lib/vendor/terser.cjs +36874 -0
  133. package/dist-lib/vendor/valibot.cjs +6253 -0
  134. package/dist-lib/vendor/zod.cjs +23262 -0
  135. package/dist-lib/worklet-executable.cjs +3 -3
  136. package/dist-lib/worklet-executable.mjs +11 -16
  137. package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
  138. package/kotlin/fork/NOTICE +3 -0
  139. package/kotlin/sdk.tar.gz +0 -0
  140. package/kotlin/toolchain.json +6 -6
  141. package/package.json +17 -121
  142. package/runtime-companion.json +1 -1
  143. package/scripts/dev-server-scanner.ts +13 -223
  144. package/src/android-autolinking.ts +2 -2
  145. package/src/bundle-channel.mjs +3 -15
  146. package/src/cloud-contract.ts +3 -4
  147. package/src/config.ts +0 -5
  148. package/src/host/bridge-host.ts +19 -1
  149. package/src/host/server-scan-handler.ts +1 -9
  150. package/src/index.ts +0 -2
  151. package/src/kotlin-host.ts +1 -2
  152. package/src/kotlinDiscoveryContract.ts +1 -0
  153. package/src/metro-production-bundle.ts +28 -6
  154. package/src/native-seam-manifest.ts +0 -13
  155. package/src/one-native-app-catalog.ts +8 -27
  156. package/src/one-native-app-config.ts +95 -0
  157. package/src/one-native-source.ts +250 -0
  158. package/src/one-widget-metadata.ts +45 -126
  159. package/src/oneWidgetContract.ts +80 -117
  160. package/src/serverDiscoveryContract.ts +0 -1
  161. package/src/simulator-route.ts +8 -0
  162. package/src/vite-plugin.ts +2 -2
  163. package/src/xcode-project.ts +1 -1
  164. package/dist-lib/metro.cjs +0 -27984
  165. package/dist-lib/vite-swift.cjs +0 -43376
  166. package/dist-lib/vite.cjs +0 -21456
  167. package/src/androidAutolinkingContract.ts +0 -48
  168. package/src/androidRootModuleContract.ts +0 -39
  169. package/src/dev-server-open.ts +0 -92
  170. package/src/metro-plugin.ts +0 -578
  171. package/src/one-widget-discovery.ts +0 -23
  172. package/src/swift-vite-lifetime.ts +0 -42
  173. package/src/vite-plugin-one.ts +0 -746
  174. package/src/vite-plugin-swift.ts +0 -225
  175. package/src/vite.d.ts +0 -10
@@ -0,0 +1,188 @@
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+
3
+ // src/cloud-contract.ts
4
+ var AGENT_IDENTITY_MAX_CHARS = 200;
5
+ function readAgentIdentity(value) {
6
+ if (value === void 0) return void 0;
7
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
8
+ const text = (key) => {
9
+ const field = Reflect.get(value, key);
10
+ return typeof field === "string" && field.trim() !== "" && field.length <= AGENT_IDENTITY_MAX_CHARS ? field : null;
11
+ };
12
+ const id = text("id");
13
+ const name = text("name");
14
+ const machine = text("machine");
15
+ const step = text("step");
16
+ if (id === null || name === null || machine === null || step === null) return null;
17
+ return { id, name, machine, step };
18
+ }
19
+ var TEXT_FIELD_TYPE = /text ?(input|field)/i;
20
+ function agentActionTarget(target) {
21
+ if (!target) return void 0;
22
+ const clean = (value) => {
23
+ const text2 = value?.trim().replace(/\s+/g, " ");
24
+ return text2 ? text2.slice(0, AGENT_IDENTITY_MAX_CHARS) : void 0;
25
+ };
26
+ const id = clean(target.id);
27
+ const testID = clean(target.testID);
28
+ const text = TEXT_FIELD_TYPE.test(target.type ?? "") ? void 0 : clean(target.text);
29
+ if (!id && !testID && !text) return void 0;
30
+ return { ...id && { id }, ...testID && { testID }, ...text && { text } };
31
+ }
32
+ function agentActionTargetName(target) {
33
+ const safe = agentActionTarget(target);
34
+ return safe?.text ?? safe?.testID ?? safe?.id ?? null;
35
+ }
36
+ var RNX_CLOUD_MAX_ARTIFACT_BYTES = 40761776;
37
+ var RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES = 256;
38
+ var RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES = 1024 * 1024;
39
+ var RNX_CLOUD_TEST_FILES_MAX_COUNT = 256;
40
+ var RNX_CLOUD_TEST_FILES_MAX_BYTES = 5e5;
41
+ function isSafeCloudTestFilePath(path) {
42
+ return path !== "" && !path.startsWith("/") && !path.includes("\\") && !path.split("/").some((segment) => !segment || segment === "." || segment === "..");
43
+ }
44
+ var RNX_CLOUD_COMMAND_SCOPE_SET = /* @__PURE__ */ new Set([
45
+ "read",
46
+ "drive",
47
+ "reset",
48
+ "media",
49
+ "debug",
50
+ "watch"
51
+ ]);
52
+ function isRnxCloudCommandScope(value) {
53
+ return RNX_CLOUD_COMMAND_SCOPE_SET.has(value);
54
+ }
55
+ var RNX_CLOUD_SCOPED_TOKEN_PREFIX = "sk_rnx_sim_";
56
+ var RNX_CLOUD_SCOPED_TOKEN_DEFAULT_TTL_SECONDS = 3600;
57
+ var RNX_CLOUD_SCOPED_TOKEN_MIN_TTL_SECONDS = 1;
58
+ var RNX_CLOUD_SCOPED_TOKEN_MAX_TTL_SECONDS = 14400;
59
+ var RNX_CLOUD_SCOPED_TOKEN_MAX_ORIGINS = 16;
60
+ var RNX_CLOUD_COMMAND_SCOPES = {
61
+ state: "read",
62
+ tree: "read",
63
+ query: "read",
64
+ resolve: "read",
65
+ screenshot: "read",
66
+ capture: "read",
67
+ captureRegions: "read",
68
+ memory: "read",
69
+ diagnostics: "read",
70
+ storageSnapshot: "read",
71
+ perform: "drive",
72
+ waitFor: "drive",
73
+ tap: "drive",
74
+ longPress: "drive",
75
+ settle: "drive",
76
+ openUrl: "drive",
77
+ setAppearance: "drive",
78
+ keyboard: "drive",
79
+ focus: "drive",
80
+ flowStatus: "drive",
81
+ reset: "reset",
82
+ recorder: "drive",
83
+ camera: "media",
84
+ location: "media",
85
+ // string evaluation and arbitrary bridge calls are maestro's boundary: the
86
+ // customer sdk never carries this scope, and the service grants it only to
87
+ // the account api key caller. close rides along, since ending the page ends
88
+ // the sim and belongs to the sim's owner rather than any driver.
89
+ evaluate: "debug",
90
+ call: "debug",
91
+ close: "debug"
92
+ };
93
+ function scopeTableKeys() {
94
+ return Object.keys(RNX_CLOUD_COMMAND_SCOPES).filter(
95
+ (key) => Object.prototype.hasOwnProperty.call(RNX_CLOUD_COMMAND_SCOPES, key)
96
+ );
97
+ }
98
+ var RNX_CLOUD_COMMAND_TYPES = Object.freeze(scopeTableKeys());
99
+ var RNX_CLOUD_COMMAND_TYPE_SET = new Set(RNX_CLOUD_COMMAND_TYPES);
100
+ function isRnxCloudCommandType(value) {
101
+ return RNX_CLOUD_COMMAND_TYPE_SET.has(value);
102
+ }
103
+ function rnxCloudCommandScope(type) {
104
+ return RNX_CLOUD_COMMAND_SCOPES[type];
105
+ }
106
+ var RNX_CLOUD_TOKEN_SCOPES = Object.freeze([
107
+ "read",
108
+ "drive",
109
+ "reset",
110
+ "media"
111
+ ]);
112
+ var RNX_CLOUD_ALL_COMMAND_SCOPES = Object.freeze(["read", "drive", "reset", "media", "debug"]);
113
+ function rnxCloudScopesAllowCommand(scopes, type) {
114
+ return scopes.includes(RNX_CLOUD_COMMAND_SCOPES[type]);
115
+ }
116
+ var RNX_CLOUD_LABELS_MAX_COUNT = 16;
117
+ var RNX_CLOUD_LABEL_MAX_LENGTH = 63;
118
+ var RNX_CLOUD_LABEL_CONTROL = /[\u0000-\u001f\u007f]/;
119
+ function isValidRnxCloudLabel(key, value) {
120
+ return key.length > 0 && key.length <= RNX_CLOUD_LABEL_MAX_LENGTH && value.length <= RNX_CLOUD_LABEL_MAX_LENGTH && !key.includes(",") && !key.includes("=") && !value.includes(",") && !RNX_CLOUD_LABEL_CONTROL.test(key) && !RNX_CLOUD_LABEL_CONTROL.test(value);
121
+ }
122
+ function parseRnxCloudLabels(value) {
123
+ if (value === "") return {};
124
+ const entries = value.split(",");
125
+ if (entries.length > RNX_CLOUD_LABELS_MAX_COUNT) return null;
126
+ const labels = {};
127
+ for (const entry of entries) {
128
+ const separator = entry.indexOf("=");
129
+ if (separator < 1) return null;
130
+ const key = entry.slice(0, separator).trim();
131
+ const label = entry.slice(separator + 1).trim();
132
+ if (!isValidRnxCloudLabel(key, label)) return null;
133
+ if (Object.hasOwn(labels, key)) return null;
134
+ labels[key] = label;
135
+ }
136
+ return labels;
137
+ }
138
+ function readRnxCloudLabels(value) {
139
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
140
+ const entries = Object.entries(value);
141
+ if (entries.length > RNX_CLOUD_LABELS_MAX_COUNT) return null;
142
+ const labels = {};
143
+ for (const [key, label] of entries) {
144
+ if (typeof label !== "string") return null;
145
+ if (!isValidRnxCloudLabel(key, label)) return null;
146
+ labels[key] = label;
147
+ }
148
+ return labels;
149
+ }
150
+ function matchesRnxCloudLabels(labels, selector) {
151
+ return Object.entries(selector).every(([key, value]) => labels[key] === value);
152
+ }
153
+ function isRnxCloudSimStatus(value) {
154
+ return value === "creating" || value === "open" || value === "hibernated" || value === "deleting" || value === "deleted";
155
+ }
156
+
157
+ export {
158
+ AGENT_IDENTITY_MAX_CHARS,
159
+ readAgentIdentity,
160
+ agentActionTarget,
161
+ agentActionTargetName,
162
+ RNX_CLOUD_MAX_ARTIFACT_BYTES,
163
+ RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES,
164
+ RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES,
165
+ RNX_CLOUD_TEST_FILES_MAX_COUNT,
166
+ RNX_CLOUD_TEST_FILES_MAX_BYTES,
167
+ isSafeCloudTestFilePath,
168
+ isRnxCloudCommandScope,
169
+ RNX_CLOUD_SCOPED_TOKEN_PREFIX,
170
+ RNX_CLOUD_SCOPED_TOKEN_DEFAULT_TTL_SECONDS,
171
+ RNX_CLOUD_SCOPED_TOKEN_MIN_TTL_SECONDS,
172
+ RNX_CLOUD_SCOPED_TOKEN_MAX_TTL_SECONDS,
173
+ RNX_CLOUD_SCOPED_TOKEN_MAX_ORIGINS,
174
+ RNX_CLOUD_COMMAND_SCOPES,
175
+ RNX_CLOUD_COMMAND_TYPES,
176
+ isRnxCloudCommandType,
177
+ rnxCloudCommandScope,
178
+ RNX_CLOUD_TOKEN_SCOPES,
179
+ RNX_CLOUD_ALL_COMMAND_SCOPES,
180
+ rnxCloudScopesAllowCommand,
181
+ RNX_CLOUD_LABELS_MAX_COUNT,
182
+ RNX_CLOUD_LABEL_MAX_LENGTH,
183
+ isValidRnxCloudLabel,
184
+ parseRnxCloudLabels,
185
+ readRnxCloudLabels,
186
+ matchesRnxCloudLabels,
187
+ isRnxCloudSimStatus
188
+ };
@@ -0,0 +1,186 @@
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+
3
+ // src/swiftContract.ts
4
+ function isSwiftSourceLinkGraph(value) {
5
+ if (!value || typeof value !== "object") return false;
6
+ const text = (value2) => typeof value2 === "string" && value2.length > 0 && value2.length <= 4096 && !value2.includes("\0");
7
+ const entry = Reflect.get(value, "entry");
8
+ const targets = Reflect.get(value, "targets");
9
+ if (!text(entry) || !Array.isArray(targets) || targets.length > 1024) return false;
10
+ const ids = /* @__PURE__ */ new Set();
11
+ for (const target of targets) {
12
+ if (!target || typeof target !== "object") return false;
13
+ const id = Reflect.get(target, "id");
14
+ const source = Reflect.get(target, "sourceTarget");
15
+ const flags = Reflect.get(target, "linkerFlags");
16
+ const dependencies = Reflect.get(target, "dependencies");
17
+ const build = Reflect.get(target, "buildVersion");
18
+ const nullableText = (value2) => value2 === null || text(value2);
19
+ if (!text(id) || ids.has(id) || !(source === null || text(source)) || !text(Reflect.get(target, "productName")) || !text(Reflect.get(target, "productType")) || !nullableText(Reflect.get(target, "installName")) || !build || typeof build !== "object" || !["platform", "minimumOS", "sdk"].every(
20
+ (key) => nullableText(Reflect.get(build, key))
21
+ ) || !(Reflect.get(target, "machOType") === null || text(Reflect.get(target, "machOType"))) || !Array.isArray(flags) || !flags.every(text) || !Array.isArray(dependencies) || !dependencies.every(
22
+ (link) => link && typeof link === "object" && text(Reflect.get(link, "target")) && Array.isArray(Reflect.get(link, "attributes")) && Reflect.get(link, "attributes").every(text)
23
+ ))
24
+ return false;
25
+ ids.add(id);
26
+ }
27
+ return ids.has(entry) && targets.every(
28
+ (target) => Reflect.get(target, "dependencies").every(
29
+ (link) => ids.has(link.target)
30
+ )
31
+ );
32
+ }
33
+ var SWIFT_REMOTE_PACKAGES_DIR = "__packages__";
34
+ var SWIFT_LOCAL_PACKAGES_DIR = "__local_packages__";
35
+ var SWIFT_XCODE_BUILD_CONDITION = "__PEACH_XCODE_BUILD";
36
+ function isBase64Bytes(value) {
37
+ return value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}(?![\s\S])/.test(value);
38
+ }
39
+ function isSwiftPackageFiles(value) {
40
+ return value !== null && typeof value === "object" && !Array.isArray(value) && Object.entries(value).every(
41
+ ([file, bytes]) => isSwiftResourcePath(file) && (file.startsWith(`${SWIFT_REMOTE_PACKAGES_DIR}/`) || file.startsWith(`${SWIFT_LOCAL_PACKAGES_DIR}/`)) && typeof bytes === "string" && isBase64Bytes(bytes)
42
+ );
43
+ }
44
+ function swiftProjectFileProblem(file) {
45
+ if (!isSwiftResourcePath(file)) return "not a relative path of plain segments";
46
+ if (file === "Package.swift") return "would replace the generated manifest";
47
+ if (file.split("/").includes(".build")) return "is build output (.build)";
48
+ if (file.startsWith(".")) return 'starts with "." (hidden file or peach output)';
49
+ if (file.startsWith(`${SWIFT_REMOTE_PACKAGES_DIR}/`) || file.startsWith(`${SWIFT_LOCAL_PACKAGES_DIR}/`))
50
+ return "collides with a transported package checkout";
51
+ return void 0;
52
+ }
53
+ function swiftProjectEntryProblem(file, bytes) {
54
+ return swiftProjectFileProblem(file) ?? (typeof bytes === "string" && isBase64Bytes(bytes) ? void 0 : "bytes are not base64");
55
+ }
56
+ function isSwiftProjectFiles(value) {
57
+ return value !== null && typeof value === "object" && !Array.isArray(value) && Object.entries(value).every(
58
+ ([file, bytes]) => swiftProjectEntryProblem(file, bytes) === void 0
59
+ );
60
+ }
61
+ function swiftProjectFilesProblems(value) {
62
+ if (value === null || typeof value !== "object" || Array.isArray(value))
63
+ return ["projectFiles is not an object"];
64
+ return Object.entries(value).flatMap(([file, bytes]) => {
65
+ const problem = swiftProjectEntryProblem(file, bytes);
66
+ return problem ? [`${file}: ${problem}`] : [];
67
+ });
68
+ }
69
+ var SWIFT_NATIVE_INPUT_ROOT = "$(PEACH_INPUT_ROOT)";
70
+ var SWIFT_NATIVE_SDK_INCLUDE = "$(PEACH_SDK_INCLUDE)";
71
+ function isSwiftHeaderAliases(value) {
72
+ return value !== null && typeof value === "object" && !Array.isArray(value) && Object.entries(value).every(
73
+ ([alias, file]) => isSwiftResourcePath(alias) && isSwiftResourcePath(file)
74
+ );
75
+ }
76
+ function isSwiftNativeTargets(value) {
77
+ return swiftNativeTargetsRefusal(value) === null;
78
+ }
79
+ function swiftNativeTargetsRefusal(value) {
80
+ const strings = (value2) => Array.isArray(value2) && value2.every((item) => typeof item === "string" && !item.includes("\0"));
81
+ const paths = (value2) => strings(value2) && value2.every(isSwiftResourcePath);
82
+ if (!Array.isArray(value)) return "nativeTargets";
83
+ if (value.length > 128) return "nativeTargets:length";
84
+ for (const target of value) {
85
+ if (!target || typeof target !== "object") return "nativeTargets:shape";
86
+ const field = (name2) => Reflect.get(target, name2);
87
+ const name = typeof field("name") === "string" ? String(field("name")) : "?";
88
+ const at = (shape) => `nativeTargets:${name}:${shape}`;
89
+ const nullablePath = (key) => field(key) === null || isSwiftResourcePath(field(key));
90
+ const perFile = field("fileFlags");
91
+ const directories = field("sourceDirectories");
92
+ const searches = field("headerSearchPaths");
93
+ const userSearches = field("userHeaderSearchPaths");
94
+ const frameworks = field("frameworkSearchPaths");
95
+ const maps = field("headerMaps");
96
+ const products = field("productHeaders");
97
+ const inputPath = (value2) => typeof value2 === "string" && value2.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) && isSwiftResourcePath(value2.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1));
98
+ const deployment = field("deploymentTarget");
99
+ const targetName = field("name");
100
+ if (typeof targetName !== "string" || targetName.length === 0 || targetName.length > 4096 || targetName.includes("\0") || targetName.includes("/") || targetName.includes("\\") || targetName === "." || targetName === "..")
101
+ return at("name");
102
+ if (!(deployment === null || typeof deployment === "string" && /^\d+(?:\.\d+){0,2}$/.test(deployment)))
103
+ return at("deploymentTarget");
104
+ if (!paths(field("headers"))) return at("headers");
105
+ if (!paths(field("publicHeaders"))) return at("publicHeaders");
106
+ if (typeof field("flattensPublicHeaders") !== "boolean")
107
+ return at("flattensPublicHeaders");
108
+ if (!nullablePath("bridgingHeader")) return at("bridgingHeader");
109
+ if (!nullablePath("prefixHeader")) return at("prefixHeader");
110
+ if (!strings(searches) || !searches.every((item) => item === "." || isSwiftResourcePath(item)))
111
+ return at("headerSearchPaths");
112
+ const moduleMaps = field("moduleMaps");
113
+ if (moduleMaps !== void 0 && (!Array.isArray(moduleMaps) || moduleMaps.length > 128 || !moduleMaps.every((map) => {
114
+ if (!map || typeof map !== "object") return false;
115
+ const module = Reflect.get(map, "module");
116
+ const headers = Reflect.get(map, "headers");
117
+ return typeof module === "string" && module.length > 0 && module.length <= 4096 && !module.includes("\0") && (headers === "." || isSwiftResourcePath(headers));
118
+ })))
119
+ return at("moduleMaps");
120
+ if (!strings(userSearches) || !userSearches.every((item) => item === "." || isSwiftResourcePath(item)))
121
+ return at("userHeaderSearchPaths");
122
+ if (!strings(frameworks) || !frameworks.every((item) => item === "." || isSwiftResourcePath(item)))
123
+ return at("frameworkSearchPaths");
124
+ if (!Array.isArray(maps) || !maps.every((map) => {
125
+ if (!map || typeof map !== "object") return false;
126
+ const flag = Reflect.get(map, "flag");
127
+ const entries = Reflect.get(map, "entries");
128
+ return (flag === "-I" || flag === "-iquote") && Array.isArray(entries) && entries.every(
129
+ (entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && !entry[0].includes("\0") && (inputPath(entry[1]) || isSwiftResourcePath(entry[1]))
130
+ );
131
+ }))
132
+ return at("headerMaps");
133
+ if (!products || typeof products !== "object" || Array.isArray(products) || !Object.entries(products).every(
134
+ ([product, file]) => isSwiftResourcePath(product) && isSwiftResourcePath(file)
135
+ ))
136
+ return at("productHeaders");
137
+ if (!strings(field("flags"))) return at("flags");
138
+ if (!strings(field("importerFlags"))) return at("importerFlags");
139
+ if (!strings(field("cxxFlags"))) return at("cxxFlags");
140
+ if (!perFile || typeof perFile !== "object" || Array.isArray(perFile) || !Object.entries(perFile).every(
141
+ ([file, flags]) => isSwiftResourcePath(file) && strings(flags)
142
+ ))
143
+ return at("fileFlags");
144
+ if (!directories || typeof directories !== "object" || Array.isArray(directories) || !Object.entries(directories).every(
145
+ ([file, directory]) => isSwiftResourcePath(file) && (directory === "." || isSwiftResourcePath(directory))
146
+ ))
147
+ return at("sourceDirectories");
148
+ }
149
+ return null;
150
+ }
151
+ function isSwiftResourcePath(value) {
152
+ return typeof value === "string" && value.length <= 4096 && !value.startsWith("/") && !value.includes("\\") && !value.includes("\0") && value.split("/").every((part) => part !== "" && part !== "." && part !== "..");
153
+ }
154
+ function isSwiftBundlePath(value) {
155
+ return typeof value === "string" && (value === "." || isSwiftResourcePath(value) && /\.(bundle|framework)$/.test(value));
156
+ }
157
+ function isSwiftResourceBundles(value) {
158
+ return Array.isArray(value) && value.every(
159
+ (bundle) => typeof bundle === "object" && bundle !== null && typeof bundle.target === "string" && /^[A-Za-z_][A-Za-z0-9_-]*$/.test(bundle.target) && (bundle.sourcePath === "." || isSwiftResourcePath(bundle.sourcePath)) && isSwiftBundlePath(bundle.path)
160
+ ) && new Set(value.map((bundle) => bundle.target)).size === value.length && new Set(value.map((bundle) => bundle.path)).size === value.length;
161
+ }
162
+ function isSwiftMetalSources(value) {
163
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.entries(value).every(
164
+ ([file, source]) => file.endsWith(".metal") && isSwiftResourcePath(file) && typeof source === "object" && source !== null && !Array.isArray(source) && "url" in source && typeof source.url === "string" && "sha256" in source && typeof source.sha256 === "string" && /^[a-f0-9]{64}$/.test(source.sha256)
165
+ );
166
+ }
167
+ function isSwiftMetalLibrarySources(value) {
168
+ return isSwiftMetalSources(value) && Object.values(value).every(
169
+ (source) => "bundlePath" in source && isSwiftBundlePath(source.bundlePath)
170
+ );
171
+ }
172
+
173
+ export {
174
+ isSwiftSourceLinkGraph,
175
+ SWIFT_XCODE_BUILD_CONDITION,
176
+ isSwiftPackageFiles,
177
+ isSwiftProjectFiles,
178
+ swiftProjectFilesProblems,
179
+ SWIFT_NATIVE_INPUT_ROOT,
180
+ SWIFT_NATIVE_SDK_INCLUDE,
181
+ isSwiftHeaderAliases,
182
+ isSwiftNativeTargets,
183
+ isSwiftResourcePath,
184
+ isSwiftResourceBundles,
185
+ isSwiftMetalLibrarySources
186
+ };
@@ -0,0 +1,57 @@
1
+ /*! peach v0.1.2439 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+
3
+ // ../peach-globals/src/bundle-global-footer.ts
4
+ function findBundleFooter(source, prefix) {
5
+ let end = source.length;
6
+ while (end > 0) {
7
+ const newline = source.lastIndexOf("\n", end - 1);
8
+ if (newline < 0) return -1;
9
+ const line = newline + 1;
10
+ if (source.startsWith(prefix, line)) return newline;
11
+ if (!isFooterBlockLine(source, line, end)) return -1;
12
+ end = newline;
13
+ }
14
+ return -1;
15
+ }
16
+ function isFooterBlockLine(source, line, end) {
17
+ return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
18
+ }
19
+ function readFooter(source, prefix, suffix, name) {
20
+ const start = findBundleFooter(source, prefix);
21
+ if (start < 0) return null;
22
+ const end = source.indexOf("\n", start + 1);
23
+ const line = source.slice(start + 1, end < 0 ? void 0 : end);
24
+ if (!line.endsWith(suffix)) throw new Error(`${name} footer is truncated`);
25
+ const value = JSON.parse(
26
+ line.slice(prefix.length, suffix ? -suffix.length : void 0)
27
+ );
28
+ if (value === null) throw new Error(`${name} footer has no metadata`);
29
+ return value;
30
+ }
31
+ function readBundleGlobalFooter(source, name) {
32
+ return readFooter(source, `globalThis.${name}=`, ";", name);
33
+ }
34
+ function detachFooter(source, prefix, suffix, name) {
35
+ const start = findBundleFooter(source, prefix);
36
+ if (start < 0) return { source, value: null };
37
+ const value = readFooter(source, prefix, suffix, name);
38
+ const end = source.indexOf("\n", start + 1);
39
+ return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
40
+ }
41
+ function insertBundleGlobalFooter(source, name, value) {
42
+ return insertFooter(source, `globalThis.${name}=`, ";", name, value);
43
+ }
44
+ function insertFooter(source, prefix, suffix, name, value) {
45
+ source = detachFooter(source, prefix, suffix, name).source;
46
+ const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
47
+ const footer = `
48
+ ${prefix}${json}${suffix}`;
49
+ const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
50
+ return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
51
+ }
52
+
53
+ export {
54
+ findBundleFooter,
55
+ readBundleGlobalFooter,
56
+ insertBundleGlobalFooter
57
+ };