peachsim 0.1.1620 → 0.1.1635
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.
- package/LICENSE +1 -1
- package/README.md +45 -6
- package/cli/app-config.ts +4 -1
- package/cli/app-fonts.ts +39 -18
- package/cli/app-stubs.ts +224 -9
- package/cli/bridge-flow-runner.ts +248 -156
- package/cli/cloud-client.ts +68 -57
- package/cli/command-registry.ts +1 -0
- package/cli/commands/box/search-command.ts +3 -2
- package/cli/commands/box.ts +10 -29
- package/cli/commands/control.ts +391 -92
- package/cli/commands/doctor.ts +17 -184
- package/cli/commands/flow.ts +79 -11
- package/cli/commands/inspect/core.ts +10 -5
- package/cli/commands/inspect/settling.ts +71 -22
- package/cli/commands/inspect/wait-ready.ts +12 -0
- package/cli/commands/inspect.ts +26 -3
- package/cli/commands/install-desktop.ts +1 -0
- package/cli/commands/maestro-compare.ts +105 -67
- package/cli/commands/maestro.ts +9 -1
- package/cli/commands/platform.ts +71 -36
- package/cli/commands/record.ts +21 -1
- package/cli/commands/screenshot.ts +23 -1
- package/cli/commands/serve.ts +7 -2
- package/cli/commands/setup.ts +19 -42
- package/cli/commands/swift.ts +5 -0
- package/cli/commands/upload.ts +51 -8
- package/cli/desktop-companion.ts +102 -17
- package/cli/dev-build-freshness.ts +37 -2
- package/cli/drivers/desktop.ts +14 -1
- package/cli/drivers/playwright-sim-host.ts +44 -8
- package/cli/drivers/playwright.ts +9 -8
- package/cli/drivers/types.ts +5 -0
- package/cli/maestro-accessibility.ts +53 -0
- package/cli/maestro-compare.ts +108 -12
- package/cli/main.ts +2 -1
- package/cli/outbound-endpoints.ts +35 -6
- package/cli/parent-pid.ts +0 -9
- package/cli/pause-aware-timeout.ts +102 -0
- package/cli/remote-simulators.ts +112 -0
- package/cli/remoteSimulatorContract.ts +21 -0
- package/cli/scene-video.ts +89 -0
- package/cli/ws-bridge.ts +23 -14
- package/detox/attempt-events.cjs +4 -0
- package/detox/expectations.ts +5 -1
- package/detox/index.ts +241 -181
- package/detox/motion-change.cjs +73 -0
- package/detox/motion-change.d.cts +21 -0
- package/detox/navigation-lifecycle.ts +22 -4
- package/dist-lib/agent-daemon-client.cjs +3 -2
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +3 -2
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +13 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +14 -8
- package/dist-lib/bridge-contract.mjs +13 -7
- package/dist-lib/bundle-channel.cjs +10480 -7962
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +3 -2
- package/dist-lib/cloud.mjs +3 -2
- package/dist-lib/config.cjs +10 -6
- package/dist-lib/config.mjs +10 -6
- package/dist-lib/detox/index.cjs +1854 -966
- package/dist-lib/dev-bundle-resolution.cjs +64 -24
- package/dist-lib/expo-swift-bundle.cjs +8715 -6271
- package/dist-lib/expo-swift-metadata.cjs +7 -4
- package/dist-lib/expo-swift-metadata.mjs +7 -4
- package/dist-lib/home-paths.cjs +32 -3
- package/dist-lib/host/bridge-host.cjs +10135 -7060
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1843 -408
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +3 -2
- package/dist-lib/menu.mjs +3 -2
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +5 -4
- package/dist-lib/metro-production-bundle.mjs +5 -4
- package/dist-lib/metro.cjs +1182 -418
- package/dist-lib/native-app-identity-project.cjs +782 -23
- package/dist-lib/native-app-identity-project.mjs +781 -23
- package/dist-lib/native-app-identity.cjs +276 -9
- package/dist-lib/native-app-identity.mjs +273 -8
- package/dist-lib/native-firebase-metadata.cjs +5 -4
- package/dist-lib/native-firebase-metadata.mjs +5 -4
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +3 -2
- package/dist-lib/react-native-host-modules.cjs +8 -1
- package/dist-lib/react-native-host-modules.mjs +8 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +106 -28
- package/dist-lib/sdk.cjs +115 -34
- package/dist-lib/sdk.mjs +115 -33
- package/dist-lib/skills.cjs +15274 -9904
- package/dist-lib/swift-compile.cjs +1165 -173
- package/dist-lib/swift-compile.mjs +1212 -203
- package/dist-lib/swift-package.cjs +12 -3
- package/dist-lib/swift-package.mjs +12 -3
- package/dist-lib/swift-submit.cjs +7 -1
- package/dist-lib/swift-submit.mjs +5 -1
- package/dist-lib/swift-toolchain.cjs +133 -18
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2648 -862
- package/dist-lib/vite.cjs +70 -14
- package/dist-lib/worklet-executable.cjs +25 -2
- package/dist-lib/worklet-executable.mjs +25 -2
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +21 -14
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +14 -0
- package/package.json +2 -2
- package/scripts/dev-server-scanner.ts +35 -14
- package/skills/peach-perf/SKILL.md +11 -5
- package/skills/peach-setup/SKILL.md +16 -19
- package/src/admitted-mac-build.ts +34 -8
- package/src/android-app-identity.ts +146 -0
- package/src/android-autolinking.ts +75 -0
- package/src/android-string-value.ts +36 -0
- package/src/android-strings.ts +5 -36
- package/src/androidAutolinkingContract.ts +40 -0
- package/src/bridge-constants.ts +11 -0
- package/src/bridge-contract.ts +22 -34
- package/src/bundleGlobalFooter.ts +26 -7
- package/src/codex-client.ts +3 -2
- package/src/config.ts +15 -0
- package/src/desktop-host-delivery.ts +5 -1
- package/src/dev-bundle-resolution.ts +60 -26
- package/src/expo-kotlin-host.ts +6 -36
- package/src/expo-manifest-body.ts +13 -0
- package/src/expo-swift-bundle.ts +17 -12
- package/src/expo-swift-host.ts +640 -192
- package/src/expo-swift-ready.ts +78 -0
- package/src/expoSwiftContract.ts +19 -0
- package/src/home-paths.ts +48 -2
- package/src/host/bridge-host.ts +12 -57
- package/src/host/staged-host-files.ts +29 -2
- package/src/installed-package-versions.ts +54 -14
- package/src/launchMetadataContract.ts +24 -0
- package/src/metro-plugin.ts +37 -42
- package/src/native-app-identity-project.ts +142 -5
- package/src/native-app-identity.ts +176 -11
- package/src/native-firebase-config.ts +209 -13
- package/src/nitro-compile.ts +2 -5
- package/src/nitro-source.ts +147 -63
- package/src/process-group.ts +114 -61
- package/src/process-output.ts +0 -9
- package/src/public-brand.ts +1 -0
- package/src/react-native-bridge-modules.ts +416 -0
- package/src/react-native-host-modules.ts +7 -0
- package/src/sim-client.ts +6 -4
- package/src/swift-binary-modules.ts +2 -2
- package/src/swift-compile.ts +1007 -108
- package/src/swift-compiler-digest.ts +14 -0
- package/src/swift-distribution.lock.json +40 -12
- package/src/swift-distribution.ts +61 -9
- package/src/swift-host.ts +149 -56
- package/src/swift-icu.ts +14 -6
- package/src/swift-objc-sdk.ts +133 -10
- package/src/swift-objc-standin.ts +38 -3
- package/src/swift-package-manifest.ts +21 -6
- package/src/swift-package.ts +15 -1
- package/src/swift-packages.ts +119 -60
- package/src/swift-standin-emit.ts +57 -9
- package/src/swift-standins.ts +185 -25
- package/src/swift-submit.ts +10 -0
- package/src/swift-toolchain.ts +149 -23
- package/src/vite-plugin.ts +20 -20
- package/src/worklet-executable.ts +30 -3
- package/src/worklets-babel.ts +35 -14
- package/src/xcode-project.ts +10 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -158,7 +158,11 @@ function swiftPackageIdentity(url) {
|
|
|
158
158
|
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
159
159
|
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
160
160
|
const targets = [];
|
|
161
|
-
const declarations = manifestCalls(manifest, [
|
|
161
|
+
const declarations = manifestCalls(manifest, [
|
|
162
|
+
"executableTarget",
|
|
163
|
+
"target",
|
|
164
|
+
"systemLibrary"
|
|
165
|
+
]);
|
|
162
166
|
const targetNames = new Set(
|
|
163
167
|
declarations.flatMap(({ flat }) => {
|
|
164
168
|
const name = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
@@ -181,6 +185,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
181
185
|
const defines = [
|
|
182
186
|
...call.matchAll(/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*\)/g)
|
|
183
187
|
].map((match) => match[1]);
|
|
188
|
+
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
189
|
+
(match) => match[1]
|
|
190
|
+
);
|
|
184
191
|
const excluded = [
|
|
185
192
|
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
186
193
|
].map((match) => match[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
@@ -215,10 +222,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
215
222
|
name,
|
|
216
223
|
path: targetPath,
|
|
217
224
|
executable,
|
|
225
|
+
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
218
226
|
languageMode,
|
|
219
227
|
mainActorIsolation,
|
|
220
228
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
221
229
|
...defines.length === 0 ? {} : { defines },
|
|
230
|
+
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
222
231
|
resources,
|
|
223
232
|
...dependencies.length === 0 ? {} : { dependencies },
|
|
224
233
|
...excluded.length === 0 ? {} : { exclude: excluded }
|
|
@@ -282,7 +291,7 @@ function swiftMetalSourceFiles(files) {
|
|
|
282
291
|
}
|
|
283
292
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
284
293
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
285
|
-
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
294
|
+
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
286
295
|
}
|
|
287
296
|
// Annotate the CommonJS export names for ESM import in node:
|
|
288
297
|
0 && (module.exports = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-package.ts
|
|
4
4
|
function isSwiftManifestFile(file) {
|
|
@@ -123,7 +123,11 @@ function swiftPackageIdentity(url) {
|
|
|
123
123
|
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
124
124
|
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
125
125
|
const targets = [];
|
|
126
|
-
const declarations = manifestCalls(manifest, [
|
|
126
|
+
const declarations = manifestCalls(manifest, [
|
|
127
|
+
"executableTarget",
|
|
128
|
+
"target",
|
|
129
|
+
"systemLibrary"
|
|
130
|
+
]);
|
|
127
131
|
const targetNames = new Set(
|
|
128
132
|
declarations.flatMap(({ flat }) => {
|
|
129
133
|
const name = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
@@ -146,6 +150,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
146
150
|
const defines = [
|
|
147
151
|
...call.matchAll(/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*\)/g)
|
|
148
152
|
].map((match) => match[1]);
|
|
153
|
+
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
154
|
+
(match) => match[1]
|
|
155
|
+
);
|
|
149
156
|
const excluded = [
|
|
150
157
|
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
151
158
|
].map((match) => match[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
@@ -180,10 +187,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
180
187
|
name,
|
|
181
188
|
path: targetPath,
|
|
182
189
|
executable,
|
|
190
|
+
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
183
191
|
languageMode,
|
|
184
192
|
mainActorIsolation,
|
|
185
193
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
186
194
|
...defines.length === 0 ? {} : { defines },
|
|
195
|
+
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
187
196
|
resources,
|
|
188
197
|
...dependencies.length === 0 ? {} : { dependencies },
|
|
189
198
|
...excluded.length === 0 ? {} : { exclude: excluded }
|
|
@@ -247,7 +256,7 @@ function swiftMetalSourceFiles(files) {
|
|
|
247
256
|
}
|
|
248
257
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
249
258
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
250
|
-
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
259
|
+
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
251
260
|
}
|
|
252
261
|
export {
|
|
253
262
|
SWIFT_NATIVE_SOURCE_EXTENSIONS,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -22,6 +22,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
// src/swift-submit.ts
|
|
23
23
|
var swift_submit_exports = {};
|
|
24
24
|
__export(swift_submit_exports, {
|
|
25
|
+
DEFAULT_SWIFT_COMPILE_BUILD_MS: () => DEFAULT_SWIFT_COMPILE_BUILD_MS,
|
|
26
|
+
MAX_SWIFT_COMPILE_BUILD_MS: () => MAX_SWIFT_COMPILE_BUILD_MS,
|
|
25
27
|
MAX_SWIFT_COMPILE_FILES: () => MAX_SWIFT_COMPILE_FILES,
|
|
26
28
|
MAX_SWIFT_COMPILE_IMAGES: () => MAX_SWIFT_COMPILE_IMAGES,
|
|
27
29
|
MAX_SWIFT_COMPILE_IMAGE_BYTES: () => MAX_SWIFT_COMPILE_IMAGE_BYTES,
|
|
@@ -67,6 +69,8 @@ var SWIFT_COMPILE_PATH = "/api/swift-compile";
|
|
|
67
69
|
var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
68
70
|
var SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
69
71
|
var MAX_SWIFT_COMPILE_FILES = 256;
|
|
72
|
+
var DEFAULT_SWIFT_COMPILE_BUILD_MS = 10 * 6e4;
|
|
73
|
+
var MAX_SWIFT_COMPILE_BUILD_MS = 60 * 6e4;
|
|
70
74
|
var MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
71
75
|
var MAX_SWIFT_COMPILE_RESOURCES = 128;
|
|
72
76
|
var MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
@@ -217,6 +221,8 @@ async function compileSwiftProject(submit, work, origin, signal) {
|
|
|
217
221
|
}
|
|
218
222
|
// Annotate the CommonJS export names for ESM import in node:
|
|
219
223
|
0 && (module.exports = {
|
|
224
|
+
DEFAULT_SWIFT_COMPILE_BUILD_MS,
|
|
225
|
+
MAX_SWIFT_COMPILE_BUILD_MS,
|
|
220
226
|
MAX_SWIFT_COMPILE_FILES,
|
|
221
227
|
MAX_SWIFT_COMPILE_IMAGES,
|
|
222
228
|
MAX_SWIFT_COMPILE_IMAGE_BYTES,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swiftContract.ts
|
|
4
4
|
function isSwiftResourcePath(value) {
|
|
@@ -23,6 +23,8 @@ var SWIFT_COMPILE_PATH = "/api/swift-compile";
|
|
|
23
23
|
var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
24
24
|
var SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
25
25
|
var MAX_SWIFT_COMPILE_FILES = 256;
|
|
26
|
+
var DEFAULT_SWIFT_COMPILE_BUILD_MS = 10 * 6e4;
|
|
27
|
+
var MAX_SWIFT_COMPILE_BUILD_MS = 60 * 6e4;
|
|
26
28
|
var MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
27
29
|
var MAX_SWIFT_COMPILE_RESOURCES = 128;
|
|
28
30
|
var MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
@@ -172,6 +174,8 @@ async function compileSwiftProject(submit, work, origin, signal) {
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
export {
|
|
177
|
+
DEFAULT_SWIFT_COMPILE_BUILD_MS,
|
|
178
|
+
MAX_SWIFT_COMPILE_BUILD_MS,
|
|
175
179
|
MAX_SWIFT_COMPILE_FILES,
|
|
176
180
|
MAX_SWIFT_COMPILE_IMAGES,
|
|
177
181
|
MAX_SWIFT_COMPILE_IMAGE_BYTES,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -32,18 +32,64 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
// src/swift-toolchain.ts
|
|
33
33
|
var swift_toolchain_exports = {};
|
|
34
34
|
__export(swift_toolchain_exports, {
|
|
35
|
+
SWIFT_HOST_COMPILER_ID: () => SWIFT_HOST_COMPILER_ID,
|
|
36
|
+
SWIFT_HOST_COMPILER_RELEASE: () => SWIFT_HOST_COMPILER_RELEASE,
|
|
37
|
+
swiftCompiler: () => swiftCompiler,
|
|
35
38
|
swiftCompilerRelease: () => swiftCompilerRelease,
|
|
39
|
+
swiftFileChecksum: () => swiftFileChecksum,
|
|
40
|
+
swiftHostCompilerArchive: () => swiftHostCompilerArchive,
|
|
36
41
|
swiftInstallSteps: () => swiftInstallSteps,
|
|
42
|
+
swiftSdkOptions: () => swiftSdkOptions,
|
|
37
43
|
swiftToolchain: () => swiftToolchain,
|
|
38
|
-
swiftToolchainBin: () => swiftToolchainBin
|
|
44
|
+
swiftToolchainBin: () => swiftToolchainBin,
|
|
45
|
+
swiftUpstreamRelease: () => swiftUpstreamRelease,
|
|
46
|
+
verifySwiftHostCompiler: () => verifySwiftHostCompiler
|
|
39
47
|
});
|
|
40
48
|
module.exports = __toCommonJS(swift_toolchain_exports);
|
|
41
49
|
var import_node_child_process = require("node:child_process");
|
|
50
|
+
var import_node_crypto = require("node:crypto");
|
|
42
51
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
43
52
|
var import_node_os = __toESM(require("node:os"), 1);
|
|
44
53
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
54
|
+
function swiftSdkOptions() {
|
|
55
|
+
const directory = process.env.PEACH_SWIFT_SDKS_PATH;
|
|
56
|
+
return directory ? ["--swift-sdks-path", import_node_path.default.resolve(directory)] : [];
|
|
57
|
+
}
|
|
58
|
+
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-91504a66b3f012ac";
|
|
59
|
+
var SWIFT_HOST_COMPILER_ID = "91504a66b3f012ac";
|
|
60
|
+
var compilerArchives = {
|
|
61
|
+
"darwin-arm64": {
|
|
62
|
+
checksum: "5d0ecbafd88c896beac74fd74c9d5fb20f973e0f58abbc1d2f27d5af0cbc4e59",
|
|
63
|
+
manifest: "827130a60b782ed413c9df41410afe7baf32dcb132b945a70ac0ff4c0594c690"
|
|
64
|
+
},
|
|
65
|
+
"linux-x64": {
|
|
66
|
+
checksum: "9d8491107efa347ccadf5f6974e80b2cff2b33cd8c34317dab777c5542512b3e",
|
|
67
|
+
manifest: "6221c024fa86b2201dcada23d9e13f6a11d7450cf22164a9708703f992de129f"
|
|
68
|
+
},
|
|
69
|
+
"linux-arm64": {
|
|
70
|
+
checksum: "14f5c7b39b1e36a1d9ce426a875676182fdb5247763a7e99cb72f74957bc0d9a",
|
|
71
|
+
manifest: "57ff31b79f9b3d9a6c0fd51c73271cdd88088522c0fc6d7a28ade03d68008b68"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
function swiftHostCompilerArchive(release, host = `${process.platform}-${process.arch}`) {
|
|
75
|
+
if (release !== SWIFT_HOST_COMPILER_RELEASE)
|
|
76
|
+
throw new Error(`unqualified host compiler ${release}`);
|
|
77
|
+
const archive = compilerArchives[host];
|
|
78
|
+
if (!archive) throw new Error(`unsupported Swift compiler host ${host}`);
|
|
79
|
+
return {
|
|
80
|
+
...archive,
|
|
81
|
+
identity: SWIFT_HOST_COMPILER_ID,
|
|
82
|
+
url: `https://r2.sootsim.com/swift-host-compiler/${SWIFT_HOST_COMPILER_ID}/${release}-${host}.tar.gz`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function swiftUpstreamRelease(release) {
|
|
86
|
+
return release.replace(/-custom-[a-f0-9]{16}$/, "");
|
|
87
|
+
}
|
|
45
88
|
function swiftCompilerRelease(release) {
|
|
46
|
-
return release.replace(
|
|
89
|
+
return swiftUpstreamRelease(release).replace(
|
|
90
|
+
/^swift-(\d+\.\d+)\.0-RELEASE$/,
|
|
91
|
+
"swift-$1-RELEASE"
|
|
92
|
+
);
|
|
47
93
|
}
|
|
48
94
|
function swiftToolchainBin(release) {
|
|
49
95
|
if (process.platform === "darwin") {
|
|
@@ -56,27 +102,27 @@ function swiftToolchainBin(release) {
|
|
|
56
102
|
return import_node_path.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
|
|
57
103
|
}
|
|
58
104
|
const image = import_node_path.default.join("/opt/swift", release, "usr/bin");
|
|
59
|
-
if (import_node_fs.default.existsSync(import_node_path.default.join(image, "swift")))
|
|
105
|
+
if (release.includes("-custom-") || import_node_fs.default.existsSync(import_node_path.default.join(image, "swift")))
|
|
106
|
+
return image;
|
|
60
107
|
return (process.env.PATH ?? "").split(import_node_path.default.delimiter).find((dir) => dir && import_node_fs.default.existsSync(import_node_path.default.join(dir, "swift"))) ?? image;
|
|
61
108
|
}
|
|
62
109
|
var verified = /* @__PURE__ */ new Map();
|
|
63
110
|
function swiftToolchain(release, sdk) {
|
|
64
|
-
const
|
|
111
|
+
const key = JSON.stringify([release, sdk.wasmSdkId, swiftSdkOptions()]);
|
|
112
|
+
const cached = verified.get(key);
|
|
65
113
|
if (cached) return cached;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}) : "";
|
|
72
|
-
if (!version.includes(`(${swiftCompilerRelease(release)})`)) {
|
|
73
|
-
const found = version ? `found ${version.split("\n")[0]?.trim()} at ${swift}` : process.platform === "darwin" ? `found no ${release}.xctoolchain in ~/Library/Developer/Toolchains or /Library/Developer/Toolchains` : "found no swift on PATH";
|
|
114
|
+
let bin;
|
|
115
|
+
try {
|
|
116
|
+
bin = swiftCompiler(release);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
74
119
|
throw new Error(
|
|
75
|
-
`
|
|
120
|
+
`Swift compiler ${release} is unavailable or differs from its pin: ${reason}
|
|
76
121
|
${swiftInstallSteps(release, sdk)}`
|
|
77
122
|
);
|
|
78
123
|
}
|
|
79
|
-
const
|
|
124
|
+
const swift = import_node_path.default.join(bin, "swift");
|
|
125
|
+
const sdks = (0, import_node_child_process.execFileSync)(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
80
126
|
encoding: "utf8",
|
|
81
127
|
stdio: ["ignore", "pipe", "pipe"]
|
|
82
128
|
});
|
|
@@ -86,13 +132,74 @@ ${swiftInstallSteps(release, sdk)}`
|
|
|
86
132
|
${swiftInstallSteps(release, sdk)}`
|
|
87
133
|
);
|
|
88
134
|
}
|
|
89
|
-
verified.set(
|
|
135
|
+
verified.set(key, bin);
|
|
136
|
+
return bin;
|
|
137
|
+
}
|
|
138
|
+
function swiftFileChecksum(file) {
|
|
139
|
+
const hash = (0, import_node_crypto.createHash)("sha256");
|
|
140
|
+
const fd = import_node_fs.default.openSync(file, "r");
|
|
141
|
+
const buffer = Buffer.allocUnsafe(1024 * 1024);
|
|
142
|
+
try {
|
|
143
|
+
let size = import_node_fs.default.readSync(fd, buffer, 0, buffer.length, null);
|
|
144
|
+
while (size > 0) {
|
|
145
|
+
hash.update(buffer.subarray(0, size));
|
|
146
|
+
size = import_node_fs.default.readSync(fd, buffer, 0, buffer.length, null);
|
|
147
|
+
}
|
|
148
|
+
} finally {
|
|
149
|
+
import_node_fs.default.closeSync(fd);
|
|
150
|
+
}
|
|
151
|
+
return hash.digest("hex");
|
|
152
|
+
}
|
|
153
|
+
function verifySwiftHostCompiler(release, root) {
|
|
154
|
+
const pin = swiftHostCompilerArchive(release);
|
|
155
|
+
const file = import_node_path.default.join(root, "compiler.json");
|
|
156
|
+
if (swiftFileChecksum(file) !== pin.manifest)
|
|
157
|
+
throw new Error(`Swift compiler manifest mismatch at ${root}`);
|
|
158
|
+
const manifest = JSON.parse(import_node_fs.default.readFileSync(file, "utf8"));
|
|
159
|
+
if (!manifest || typeof manifest !== "object" || !("identity" in manifest) || manifest.identity !== pin.identity || !("host" in manifest) || manifest.host !== `${process.platform}-${process.arch}` || !("files" in manifest) || !manifest.files || typeof manifest.files !== "object") {
|
|
160
|
+
throw new Error(`Swift compiler identity mismatch at ${root}`);
|
|
161
|
+
}
|
|
162
|
+
const files = Object.entries(manifest.files);
|
|
163
|
+
if (files.length !== 15) throw new Error("incomplete Swift compiler manifest");
|
|
164
|
+
for (const [relative, checksum] of files) {
|
|
165
|
+
if (relative.startsWith("/") || relative.split("/").includes("..") || typeof checksum !== "string" || swiftFileChecksum(import_node_path.default.join(root, relative)) !== checksum) {
|
|
166
|
+
throw new Error(`Swift compiler binary mismatch: ${relative}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
var verifiedCompilers = /* @__PURE__ */ new Map();
|
|
171
|
+
function swiftCompiler(release) {
|
|
172
|
+
const cached = verifiedCompilers.get(release);
|
|
173
|
+
if (cached) return cached;
|
|
174
|
+
const bin = swiftToolchainBin(release);
|
|
175
|
+
if (release.includes("-custom-"))
|
|
176
|
+
verifySwiftHostCompiler(release, import_node_path.default.resolve(bin, "../.."));
|
|
177
|
+
const version = (0, import_node_child_process.execFileSync)(import_node_path.default.join(bin, "swift"), ["--version"], {
|
|
178
|
+
encoding: "utf8",
|
|
179
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
180
|
+
});
|
|
181
|
+
if (!version.includes(`(${swiftCompilerRelease(release)})`))
|
|
182
|
+
throw new Error(`compiler release mismatch at ${bin}`);
|
|
183
|
+
verifiedCompilers.set(release, bin);
|
|
90
184
|
return bin;
|
|
91
185
|
}
|
|
92
186
|
function swiftInstallSteps(release, wasmSdk) {
|
|
187
|
+
const sdkOptions = swiftSdkOptions().map((arg) => ` '${arg.replaceAll("'", "'\\''")}'`).join("");
|
|
188
|
+
if (release.includes("-custom-")) {
|
|
189
|
+
const archive = swiftHostCompilerArchive(release);
|
|
190
|
+
const directory = import_node_path.default.resolve(swiftToolchainBin(release), "../..");
|
|
191
|
+
return [
|
|
192
|
+
"install the pinned compiler and SDK:",
|
|
193
|
+
` curl -fsSL ${archive.url} -o compiler.tar.gz`,
|
|
194
|
+
` echo '${archive.checksum} compiler.tar.gz' | shasum -a 256 -c -`,
|
|
195
|
+
` mkdir -p '${directory}'`,
|
|
196
|
+
` tar -xzf compiler.tar.gz --strip-components=1 -C '${directory}'`,
|
|
197
|
+
` '${directory}/usr/bin/swift' sdk install ${wasmSdk.wasmSdkUrl} --checksum ${wasmSdk.wasmSdkChecksum}${sdkOptions}`
|
|
198
|
+
].join("\n");
|
|
199
|
+
}
|
|
93
200
|
const version = release.replace(/^swift-/, "").toLowerCase();
|
|
94
201
|
const downloads = `https://download.swift.org/swift-${version}`;
|
|
95
|
-
const sdk = `swift sdk install ${wasmSdk.wasmSdkUrl} --checksum ${wasmSdk.wasmSdkChecksum}`;
|
|
202
|
+
const sdk = `swift sdk install ${wasmSdk.wasmSdkUrl} --checksum ${wasmSdk.wasmSdkChecksum}${sdkOptions}`;
|
|
96
203
|
if (process.platform === "darwin") {
|
|
97
204
|
const swift = `~/Library/Developer/Toolchains/${release}.xctoolchain/usr/bin/swift`;
|
|
98
205
|
return [
|
|
@@ -113,8 +220,16 @@ function swiftInstallSteps(release, wasmSdk) {
|
|
|
113
220
|
}
|
|
114
221
|
// Annotate the CommonJS export names for ESM import in node:
|
|
115
222
|
0 && (module.exports = {
|
|
223
|
+
SWIFT_HOST_COMPILER_ID,
|
|
224
|
+
SWIFT_HOST_COMPILER_RELEASE,
|
|
225
|
+
swiftCompiler,
|
|
116
226
|
swiftCompilerRelease,
|
|
227
|
+
swiftFileChecksum,
|
|
228
|
+
swiftHostCompilerArchive,
|
|
117
229
|
swiftInstallSteps,
|
|
230
|
+
swiftSdkOptions,
|
|
118
231
|
swiftToolchain,
|
|
119
|
-
swiftToolchainBin
|
|
232
|
+
swiftToolchainBin,
|
|
233
|
+
swiftUpstreamRelease,
|
|
234
|
+
verifySwiftHostCompiler
|
|
120
235
|
});
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|