peachsim 0.1.2234 → 0.1.2235
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/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +12 -0
- package/cli/commands/stream.ts +150 -0
- package/cli/main.ts +6 -0
- package/cli/outbound-endpoints.ts +10 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- 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 +1 -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 +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +15 -21
- 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 +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +13 -19
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +15 -21
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist-lib/menu.mjs +1 -1
- 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 +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +2 -2
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- 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 +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +54 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +367 -186
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1 -1
- package/dist-lib/vite.cjs +2 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +8 -0
- package/dist-types/packages/peach-globals/src/globalsContract.d.ts +2 -1
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/skills/contrast/SKILL.md +1 -0
- package/src/expo-native-workspace.ts +16 -21
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2235 | (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;
|
|
@@ -35910,7 +35910,7 @@ var init_openstep_plist = __esm({
|
|
|
35910
35910
|
});
|
|
35911
35911
|
|
|
35912
35912
|
// src/xcode-target-members.ts
|
|
35913
|
-
function xcodePathResolver(objects, projectDir,
|
|
35913
|
+
function xcodePathResolver(objects, projectDir, join33, sourceTreeRoot) {
|
|
35914
35914
|
const parents = /* @__PURE__ */ new Map();
|
|
35915
35915
|
for (const [id, entry] of Object.entries(objects)) {
|
|
35916
35916
|
if (!isDict(entry)) continue;
|
|
@@ -35928,14 +35928,14 @@ function xcodePathResolver(objects, projectDir, join32, sourceTreeRoot) {
|
|
|
35928
35928
|
const own = str(entry.path) ?? "";
|
|
35929
35929
|
const tree3 = str(entry.sourceTree) ?? "<group>";
|
|
35930
35930
|
if (tree3 === "<absolute>") result = own;
|
|
35931
|
-
else if (tree3 === "SOURCE_ROOT") result =
|
|
35931
|
+
else if (tree3 === "SOURCE_ROOT") result = join33(projectDir, own);
|
|
35932
35932
|
else if (tree3 === "<group>") {
|
|
35933
35933
|
const parent = parents.get(id);
|
|
35934
35934
|
const base = parent ? resolve13(parent) : projectDir;
|
|
35935
|
-
if (base !== null) result =
|
|
35935
|
+
if (base !== null) result = join33(base, own);
|
|
35936
35936
|
} else {
|
|
35937
35937
|
const base = sourceTreeRoot?.(tree3);
|
|
35938
|
-
if (base) result =
|
|
35938
|
+
if (base) result = join33(base, own);
|
|
35939
35939
|
}
|
|
35940
35940
|
}
|
|
35941
35941
|
paths.set(id, result);
|
|
@@ -35957,7 +35957,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
35957
35957
|
if (isDict(group) && group.isa === "PBXFileSystemSynchronizedRootGroup")
|
|
35958
35958
|
synchronizedGroups.push({ id, group });
|
|
35959
35959
|
}
|
|
35960
|
-
return (targetId, resolvePath, filesUnder,
|
|
35960
|
+
return (targetId, resolvePath, filesUnder, join33, visit3) => {
|
|
35961
35961
|
const target = objects[targetId];
|
|
35962
35962
|
if (!isDict(target)) return;
|
|
35963
35963
|
for (const phaseId of list(target.buildPhases)) {
|
|
@@ -36004,7 +36004,7 @@ function xcodeTargetMemberVisitor(objects) {
|
|
|
36004
36004
|
for (const relative5 of list(exception.membershipExceptions))
|
|
36005
36005
|
exceptions.add(relative5);
|
|
36006
36006
|
}
|
|
36007
|
-
const members2 = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative5) => filesUnder(
|
|
36007
|
+
const members2 = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative5) => filesUnder(join33(folder, relative5)));
|
|
36008
36008
|
for (const file of members2) {
|
|
36009
36009
|
const relative5 = file.slice(prefix.length);
|
|
36010
36010
|
const excepted = [...exceptions].some(
|
|
@@ -36595,7 +36595,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
|
|
|
36595
36595
|
if (resourceUri) {
|
|
36596
36596
|
if (!selectedTarget)
|
|
36597
36597
|
throw new Error("native app icon target membership is unresolved");
|
|
36598
|
-
const
|
|
36598
|
+
const join33 = (base, own) => {
|
|
36599
36599
|
const segments = [];
|
|
36600
36600
|
for (const segment of `${base}/${own}`.split("/")) {
|
|
36601
36601
|
if (segment === "" || segment === ".") continue;
|
|
@@ -36608,14 +36608,14 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
|
|
|
36608
36608
|
const project2 = Object.values(objects).find(
|
|
36609
36609
|
(object6) => isRecord(object6) && object6.isa === "PBXProject"
|
|
36610
36610
|
);
|
|
36611
|
-
const projectDir =
|
|
36611
|
+
const projectDir = join33(
|
|
36612
36612
|
pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
|
|
36613
36613
|
isRecord(project2) && typeof project2.projectDirPath === "string" ? project2.projectDirPath : ""
|
|
36614
36614
|
);
|
|
36615
36615
|
const paths = Object.keys(files2);
|
|
36616
36616
|
xcodeTargetMemberVisitor(objects)(
|
|
36617
36617
|
selectedTarget.id,
|
|
36618
|
-
xcodePathResolver(objects, projectDir,
|
|
36618
|
+
xcodePathResolver(objects, projectDir, join33),
|
|
36619
36619
|
(file) => {
|
|
36620
36620
|
if (Object.hasOwn(files2, file)) return [file];
|
|
36621
36621
|
const prefix = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
|
|
@@ -36623,7 +36623,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
|
|
|
36623
36623
|
(path141) => path141.startsWith(prefix) && !/(?:^|\/)\./.test(path141.slice(prefix.length))
|
|
36624
36624
|
);
|
|
36625
36625
|
},
|
|
36626
|
-
|
|
36626
|
+
join33,
|
|
36627
36627
|
(file, kind) => {
|
|
36628
36628
|
if (kind === "resource") resources.add(file);
|
|
36629
36629
|
}
|
|
@@ -64757,35 +64757,29 @@ async function hashWorkspaceInputs(app, everyByte, signal, sourceOnly = false, p
|
|
|
64757
64757
|
excluded
|
|
64758
64758
|
};
|
|
64759
64759
|
}
|
|
64760
|
-
const
|
|
64761
|
-
|
|
64762
|
-
|
|
64763
|
-
|
|
64764
|
-
|
|
64765
|
-
env: utf8Env
|
|
64766
|
-
});
|
|
64767
|
-
} catch (cause) {
|
|
64760
|
+
const execFileAsync4 = (0, import_node_util11.promisify)(import_node_child_process37.execFile);
|
|
64761
|
+
const mac = process.platform === "darwin" ? await Promise.all([
|
|
64762
|
+
// runner-toolchain-platform: darwin
|
|
64763
|
+
execFileAsync4("pod", ["--version"], { env: utf8Env, signal }).catch(
|
|
64764
|
+
(cause) => {
|
|
64768
64765
|
throw new Error("CocoaPods is required to install source dependencies", {
|
|
64769
64766
|
cause
|
|
64770
64767
|
});
|
|
64771
64768
|
}
|
|
64772
|
-
|
|
64769
|
+
),
|
|
64773
64770
|
// runner-toolchain-platform: darwin
|
|
64774
|
-
|
|
64775
|
-
|
|
64776
|
-
env: utf8Env
|
|
64777
|
-
})
|
|
64778
|
-
} : {};
|
|
64771
|
+
execFileAsync4("xcodebuild", ["-version"], { env: utf8Env, signal })
|
|
64772
|
+
]).then(([pod, xcode]) => ({ podVersion: pod.stdout, xcode: xcode.stdout })) : {};
|
|
64779
64773
|
const pinnedNode = typeof manifest.engines?.node === "string" && /^\d+(\.\d+){0,2}$/.test(manifest.engines.node) ? `node@${manifest.engines.node}` : null;
|
|
64780
64774
|
const toolchain = JSON.stringify({
|
|
64781
64775
|
preparation: 7,
|
|
64782
64776
|
appRelative,
|
|
64783
64777
|
...mac,
|
|
64784
|
-
node: (
|
|
64778
|
+
node: (await execFileAsync4(
|
|
64785
64779
|
pinnedNode ? "mise" : "node",
|
|
64786
64780
|
pinnedNode ? ["exec", pinnedNode, "--", "node", "--version"] : ["--version"],
|
|
64787
|
-
{ cwd: root,
|
|
64788
|
-
).trim(),
|
|
64781
|
+
{ cwd: root, signal }
|
|
64782
|
+
)).stdout.trim(),
|
|
64789
64783
|
packageManager: workspacePackageManager(root, manifest.packageManager, excluded),
|
|
64790
64784
|
podsEnvironment
|
|
64791
64785
|
});
|
|
@@ -64878,22 +64872,22 @@ function syncChangedFiles(root, work, appRelative, excluded, installed2) {
|
|
|
64878
64872
|
function watchRoot(root) {
|
|
64879
64873
|
const existing = watches.get(root);
|
|
64880
64874
|
if (existing) return existing;
|
|
64881
|
-
const
|
|
64875
|
+
const watch3 = { edits: 0 };
|
|
64882
64876
|
const watcher = import_node_fs64.default.watch(root, { recursive: true }, (_event, filename) => {
|
|
64883
64877
|
const parts = filename?.split(import_node_path62.default.sep) ?? [];
|
|
64884
|
-
const { excluded } =
|
|
64878
|
+
const { excluded } = watch3;
|
|
64885
64879
|
if (excluded && parts.some((_, index) => excluded(parts.slice(0, index + 1).join(import_node_path62.default.sep))))
|
|
64886
64880
|
return;
|
|
64887
|
-
|
|
64881
|
+
watch3.edits += 1;
|
|
64888
64882
|
});
|
|
64889
64883
|
watcher.on("error", () => {
|
|
64890
64884
|
watcher.close();
|
|
64891
64885
|
watches.delete(root);
|
|
64892
|
-
|
|
64886
|
+
watch3.edits += 1;
|
|
64893
64887
|
});
|
|
64894
64888
|
watcher.unref();
|
|
64895
|
-
watches.set(root,
|
|
64896
|
-
return
|
|
64889
|
+
watches.set(root, watch3);
|
|
64890
|
+
return watch3;
|
|
64897
64891
|
}
|
|
64898
64892
|
async function prepareExpoNativeWorkspace(app, signal, target) {
|
|
64899
64893
|
const prepared = await prepare(app, "workspace", signal);
|
|
@@ -65028,8 +65022,8 @@ async function prepareWorkspace(app, stage, key2, podsEnvironment) {
|
|
|
65028
65022
|
const report = (message) => console.error(
|
|
65029
65023
|
`[expo-native-workspace ${Math.round(performance.now() - started)}ms] ${message}`
|
|
65030
65024
|
);
|
|
65031
|
-
const
|
|
65032
|
-
const edits =
|
|
65025
|
+
const watch3 = watchRoot(findWorkspaceRoot(app));
|
|
65026
|
+
const edits = watch3.edits;
|
|
65033
65027
|
const { root, appRelative, nativeHash, excluded } = await hashWorkspaceInputs(
|
|
65034
65028
|
app,
|
|
65035
65029
|
false,
|
|
@@ -65037,7 +65031,7 @@ async function prepareWorkspace(app, stage, key2, podsEnvironment) {
|
|
|
65037
65031
|
false,
|
|
65038
65032
|
podsEnvironment
|
|
65039
65033
|
);
|
|
65040
|
-
|
|
65034
|
+
watch3.excluded = excluded;
|
|
65041
65035
|
const manifest = JSON.parse(import_node_fs64.default.readFileSync(import_node_path62.default.join(root, "package.json"), "utf8"));
|
|
65042
65036
|
const appManifest = JSON.parse(import_node_fs64.default.readFileSync(import_node_path62.default.join(app, "package.json"), "utf8"));
|
|
65043
65037
|
const work = import_node_path62.default.join(sharedCacheDir(cacheDir()), "expo-native-workspaces", nativeHash);
|
|
@@ -65166,7 +65160,7 @@ async function prepareWorkspace(app, stage, key2, podsEnvironment) {
|
|
|
65166
65160
|
await pruneExpoNativeWorkspaces(import_node_path62.default.dirname(work), work);
|
|
65167
65161
|
return { app: preparedApp, work };
|
|
65168
65162
|
});
|
|
65169
|
-
current.set(key2, { watch:
|
|
65163
|
+
current.set(key2, { watch: watch3, edits, result });
|
|
65170
65164
|
return result;
|
|
65171
65165
|
}
|
|
65172
65166
|
function declaresNativeDependency(manifest, name3) {
|
|
@@ -66273,7 +66267,7 @@ var init_package_tree_digest = __esm({
|
|
|
66273
66267
|
|
|
66274
66268
|
// src/expo-native-prebuilt.ts
|
|
66275
66269
|
function expoNativeCompilerDigestValue() {
|
|
66276
|
-
return true ? "
|
|
66270
|
+
return true ? "f069632feb274e7f5eaf8dbf407b0e9c5d4ea672a5c474d7f149564111c5c7ae" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
66277
66271
|
}
|
|
66278
66272
|
function readSources(value) {
|
|
66279
66273
|
const sources = isRecord(value) ? value.sources : null;
|
|
@@ -87008,7 +87002,7 @@ var init_nitro_superset = __esm({
|
|
|
87008
87002
|
init_nitroContract();
|
|
87009
87003
|
init_swift_standin_digest();
|
|
87010
87004
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
87011
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
87005
|
+
NITRO_COMPILER_DIGEST = true ? "35243d992261bdee722d9a986f2a4a1c3872cb6e43a1a40984a0eec51a85353f" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
87012
87006
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
87013
87007
|
nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
|
|
87014
87008
|
published2 = /* @__PURE__ */ new Map();
|
|
@@ -87720,7 +87714,7 @@ var init_one_sdk_bundle = __esm({
|
|
|
87720
87714
|
var runtime_companion_default;
|
|
87721
87715
|
var init_runtime_companion = __esm({
|
|
87722
87716
|
"runtime-companion.json"() {
|
|
87723
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
87717
|
+
runtime_companion_default = { abi: 1, sha256: "de957e6cfaf58e8388e37c64326c72cd8376936fbe14bbba0fd2c0129ada4335", file: "node/cli-de957e6cfaf58e8388e37c64326c72cd8376936fbe14bbba0fd2c0129ada4335.cjs" };
|
|
87724
87718
|
}
|
|
87725
87719
|
});
|
|
87726
87720
|
|
|
@@ -110221,6 +110215,7 @@ var init_command_registry = __esm({
|
|
|
110221
110215
|
"assert",
|
|
110222
110216
|
"device",
|
|
110223
110217
|
"open",
|
|
110218
|
+
"stream",
|
|
110224
110219
|
"package",
|
|
110225
110220
|
"ios",
|
|
110226
110221
|
"android",
|
|
@@ -111606,6 +111601,7 @@ var init_meta = __esm({
|
|
|
111606
111601
|
"peach ios --remote <app-dir|bundle-path|https-url> [--device <model>]"
|
|
111607
111602
|
],
|
|
111608
111603
|
options: [
|
|
111604
|
+
option("--stream", "stream this local simulator to your team until Ctrl+C"),
|
|
111609
111605
|
option(
|
|
111610
111606
|
"--device <model>",
|
|
111611
111607
|
"pick a specific iOS device model. an Android model here is refused by name rather than silently overriding the platform"
|
|
@@ -111909,6 +111905,7 @@ var init_meta = __esm({
|
|
|
111909
111905
|
"--package-versions <json>",
|
|
111910
111906
|
"native package versions for a prebuilt release bundle"
|
|
111911
111907
|
),
|
|
111908
|
+
option("--stream", "stream this local simulator to your team until Ctrl+C"),
|
|
111912
111909
|
option("--target <name>", "native application target"),
|
|
111913
111910
|
option("--scheme <name>", "Xcode application scheme"),
|
|
111914
111911
|
option("--activity <name>", "Android application activity")
|
|
@@ -111921,6 +111918,23 @@ var init_meta = __esm({
|
|
|
111921
111918
|
],
|
|
111922
111919
|
related: ["open", "desktop", "config"]
|
|
111923
111920
|
},
|
|
111921
|
+
{
|
|
111922
|
+
id: "stream",
|
|
111923
|
+
slug: "stream",
|
|
111924
|
+
navTitle: "stream",
|
|
111925
|
+
title: "peach stream",
|
|
111926
|
+
description: "stream an open simulator to your team",
|
|
111927
|
+
summary: "The simulator runs on this Mac. Teammates watch its display in the web workspace. Start stays in the foreground; Ctrl+C stops the stream.",
|
|
111928
|
+
order: 99,
|
|
111929
|
+
usage: ["peach stream start|stop|status [--sim <id>]"],
|
|
111930
|
+
options: [option("--sim <id>", "select an open simulator")],
|
|
111931
|
+
examples: [
|
|
111932
|
+
example("peach stream start"),
|
|
111933
|
+
example("peach stream stop"),
|
|
111934
|
+
example("peach stream status")
|
|
111935
|
+
],
|
|
111936
|
+
related: ["open", "ios"]
|
|
111937
|
+
},
|
|
111924
111938
|
{
|
|
111925
111939
|
id: "open",
|
|
111926
111940
|
slug: "open",
|
|
@@ -117058,6 +117072,161 @@ var init_metro_bundle_assets = __esm({
|
|
|
117058
117072
|
}
|
|
117059
117073
|
});
|
|
117060
117074
|
|
|
117075
|
+
// cli/commands/stream.ts
|
|
117076
|
+
var stream_exports = {};
|
|
117077
|
+
__export(stream_exports, {
|
|
117078
|
+
STREAM_FLAG: () => STREAM_FLAG,
|
|
117079
|
+
runStreamCommand: () => runStreamCommand
|
|
117080
|
+
});
|
|
117081
|
+
async function runStreamCommand(args, opts = {}) {
|
|
117082
|
+
const parsed = parseBridgeCliArgs(args, { port: opts.port });
|
|
117083
|
+
const action = parsed.positional[0] ?? "status";
|
|
117084
|
+
if (!["start", "stop", "status"].includes(action) || parsed.positional.length > 1)
|
|
117085
|
+
throw new Error("usage: peach stream start|stop|status [--sim <id>]");
|
|
117086
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
117087
|
+
let removeRecord;
|
|
117088
|
+
let endSession2;
|
|
117089
|
+
try {
|
|
117090
|
+
const simId = await bridge.send({
|
|
117091
|
+
type: "evaluate",
|
|
117092
|
+
code: "globalThis.__sootsimBridge?.id ?? globalThis.SootSim?.state?.simId"
|
|
117093
|
+
});
|
|
117094
|
+
if (typeof simId !== "string" || !simId)
|
|
117095
|
+
throw new Error("Could not identify the local simulator.");
|
|
117096
|
+
const directory2 = (0, import_node_path144.join)(rnxHomeDir(), "streams");
|
|
117097
|
+
(0, import_node_fs142.mkdirSync)(directory2, { recursive: true });
|
|
117098
|
+
const file = (0, import_node_path144.join)(directory2, `${encodeURIComponent(simId)}.json`);
|
|
117099
|
+
const state = await callInBridge(bridge, "SootSim.bridges.videoStream.state");
|
|
117100
|
+
if (action === "status") {
|
|
117101
|
+
console.log(` stream: ${state}`);
|
|
117102
|
+
return;
|
|
117103
|
+
}
|
|
117104
|
+
const { auth, header } = authHeaderOrExit("stream");
|
|
117105
|
+
const stopSession = async (record4) => {
|
|
117106
|
+
const url = new URL(
|
|
117107
|
+
`/api/v1/rnx/sessions/${encodeURIComponent(record4.sessionId)}`,
|
|
117108
|
+
record4.origin
|
|
117109
|
+
);
|
|
117110
|
+
url.searchParams.set("accountId", record4.accountId);
|
|
117111
|
+
const response2 = await fetch(url, {
|
|
117112
|
+
method: "DELETE",
|
|
117113
|
+
headers: { authorization: header },
|
|
117114
|
+
signal: AbortSignal.timeout(1e4)
|
|
117115
|
+
});
|
|
117116
|
+
if (!response2.ok && response2.status !== 404)
|
|
117117
|
+
throw new Error(`stream stop failed (${response2.status})`);
|
|
117118
|
+
};
|
|
117119
|
+
if (action === "stop") {
|
|
117120
|
+
await callInBridge(bridge, "SootSim.bridges.videoStream.stop");
|
|
117121
|
+
let record4 = null;
|
|
117122
|
+
try {
|
|
117123
|
+
record4 = recordSchema.parse(JSON.parse((0, import_node_fs142.readFileSync)(file, "utf8")));
|
|
117124
|
+
} catch (error) {
|
|
117125
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
117126
|
+
throw error;
|
|
117127
|
+
}
|
|
117128
|
+
if (record4) await stopSession(record4);
|
|
117129
|
+
(0, import_node_fs142.rmSync)(file, { force: true });
|
|
117130
|
+
console.log(" stream: off");
|
|
117131
|
+
return;
|
|
117132
|
+
}
|
|
117133
|
+
if (state !== "off")
|
|
117134
|
+
throw new Error(
|
|
117135
|
+
"This simulator is already streaming. Use `peach stream stop` first."
|
|
117136
|
+
);
|
|
117137
|
+
const origin = (process.env.PEACH_API_ORIGIN?.trim() || (auth.kind === "session" ? auth.origin : rnxPublicBrand.origin)).replace(/\/+$/, "");
|
|
117138
|
+
const settings = await callInBridge(
|
|
117139
|
+
bridge,
|
|
117140
|
+
"SootSim.bridges.settings.get"
|
|
117141
|
+
);
|
|
117142
|
+
const response = await fetch(new URL("/api/v1/rnx/streams", origin), {
|
|
117143
|
+
method: "POST",
|
|
117144
|
+
headers: { authorization: header, "content-type": "application/json" },
|
|
117145
|
+
body: JSON.stringify({
|
|
117146
|
+
accountId: cloudAccountIdOrExit(auth),
|
|
117147
|
+
device: typeof settings.deviceModel === "string" ? settings.deviceModel : void 0
|
|
117148
|
+
}),
|
|
117149
|
+
signal: AbortSignal.timeout(15e3)
|
|
117150
|
+
});
|
|
117151
|
+
if (!response.ok) throw new Error(`stream registration failed (${response.status})`);
|
|
117152
|
+
const registration = registrationSchema.parse(await response.json());
|
|
117153
|
+
const record3 = {
|
|
117154
|
+
sessionId: registration.session.id,
|
|
117155
|
+
accountId: registration.session.accountId,
|
|
117156
|
+
origin,
|
|
117157
|
+
watchUrl: new URL(registration.session.url, origin).toString()
|
|
117158
|
+
};
|
|
117159
|
+
endSession2 = () => stopSession(record3);
|
|
117160
|
+
await callInBridge(bridge, "SootSim.bridges.videoStream.start", {
|
|
117161
|
+
url: registration.url,
|
|
117162
|
+
token: registration.token
|
|
117163
|
+
});
|
|
117164
|
+
writeSecureJsonAtomic(file, record3);
|
|
117165
|
+
removeRecord = () => (0, import_node_fs142.rmSync)(file, { force: true });
|
|
117166
|
+
console.log(` ${record3.watchUrl}`);
|
|
117167
|
+
console.log(" Press Ctrl+C to stop streaming.");
|
|
117168
|
+
await new Promise((resolve13) => {
|
|
117169
|
+
const finish = () => {
|
|
117170
|
+
watcher.close();
|
|
117171
|
+
process.off("SIGINT", finish);
|
|
117172
|
+
process.off("SIGTERM", finish);
|
|
117173
|
+
resolve13();
|
|
117174
|
+
};
|
|
117175
|
+
const watcher = (0, import_node_fs142.watch)(directory2, (_event, filename) => {
|
|
117176
|
+
if (filename !== `${encodeURIComponent(simId)}.json`) return;
|
|
117177
|
+
try {
|
|
117178
|
+
(0, import_node_fs142.readFileSync)(file);
|
|
117179
|
+
} catch (error) {
|
|
117180
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
117181
|
+
finish();
|
|
117182
|
+
else throw error;
|
|
117183
|
+
}
|
|
117184
|
+
});
|
|
117185
|
+
process.once("SIGINT", finish);
|
|
117186
|
+
process.once("SIGTERM", finish);
|
|
117187
|
+
});
|
|
117188
|
+
} finally {
|
|
117189
|
+
try {
|
|
117190
|
+
if (endSession2) {
|
|
117191
|
+
await callInBridge(bridge, "SootSim.bridges.videoStream.stop").catch(
|
|
117192
|
+
() => void 0
|
|
117193
|
+
);
|
|
117194
|
+
await endSession2();
|
|
117195
|
+
}
|
|
117196
|
+
} finally {
|
|
117197
|
+
removeRecord?.();
|
|
117198
|
+
bridge.close();
|
|
117199
|
+
}
|
|
117200
|
+
}
|
|
117201
|
+
}
|
|
117202
|
+
var import_node_fs142, import_node_path144, import_zod2, STREAM_FLAG, registrationSchema, recordSchema;
|
|
117203
|
+
var init_stream = __esm({
|
|
117204
|
+
"cli/commands/stream.ts"() {
|
|
117205
|
+
"use strict";
|
|
117206
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
117207
|
+
import_node_fs142 = require("node:fs");
|
|
117208
|
+
import_node_path144 = require("node:path");
|
|
117209
|
+
import_zod2 = require("zod");
|
|
117210
|
+
init_home_paths();
|
|
117211
|
+
init_public_brand();
|
|
117212
|
+
init_auth();
|
|
117213
|
+
init_secure_file();
|
|
117214
|
+
init_ws_bridge();
|
|
117215
|
+
STREAM_FLAG = "--stream";
|
|
117216
|
+
registrationSchema = import_zod2.z.object({
|
|
117217
|
+
session: import_zod2.z.object({ id: import_zod2.z.string(), accountId: import_zod2.z.string(), url: import_zod2.z.string() }),
|
|
117218
|
+
url: import_zod2.z.string(),
|
|
117219
|
+
token: import_zod2.z.string()
|
|
117220
|
+
});
|
|
117221
|
+
recordSchema = import_zod2.z.object({
|
|
117222
|
+
sessionId: import_zod2.z.string(),
|
|
117223
|
+
accountId: import_zod2.z.string(),
|
|
117224
|
+
origin: import_zod2.z.string(),
|
|
117225
|
+
watchUrl: import_zod2.z.string()
|
|
117226
|
+
});
|
|
117227
|
+
}
|
|
117228
|
+
});
|
|
117229
|
+
|
|
117061
117230
|
// src/configured-bundle-producer.ts
|
|
117062
117231
|
async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
117063
117232
|
if (!config) return source;
|
|
@@ -117078,14 +117247,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
117078
117247
|
const neededPackages = /* @__PURE__ */ new Set();
|
|
117079
117248
|
const factories = [];
|
|
117080
117249
|
const visit3 = (filePath) => {
|
|
117081
|
-
const real =
|
|
117250
|
+
const real = import_node_fs143.default.realpathSync(filePath);
|
|
117082
117251
|
const previous = files2.get(real);
|
|
117083
117252
|
if (previous !== void 0) return previous;
|
|
117084
117253
|
const id = "peach-config-file:" + files2.size;
|
|
117085
117254
|
files2.set(real, id);
|
|
117086
117255
|
const compiled = compileReplacementModule({
|
|
117087
117256
|
filePath: real,
|
|
117088
|
-
source:
|
|
117257
|
+
source: import_node_fs143.default.readFileSync(real, "utf8"),
|
|
117089
117258
|
runtimePackages,
|
|
117090
117259
|
localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
|
|
117091
117260
|
});
|
|
@@ -117109,7 +117278,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
117109
117278
|
if (!entries || typeof entries !== "object") continue;
|
|
117110
117279
|
for (const resolution of Object.values(entries)) {
|
|
117111
117280
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
117112
|
-
resolution.file = visit3(
|
|
117281
|
+
resolution.file = visit3(import_node_path145.default.resolve(resolution.file));
|
|
117113
117282
|
}
|
|
117114
117283
|
}
|
|
117115
117284
|
}
|
|
@@ -117133,13 +117302,13 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
117133
117302
|
const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
117134
117303
|
return prefix + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
117135
117304
|
}
|
|
117136
|
-
var
|
|
117305
|
+
var import_node_fs143, import_node_path145, import_sucrase3, import_terser2, PREFIX_START, PREFIX_END;
|
|
117137
117306
|
var init_configured_bundle_producer = __esm({
|
|
117138
117307
|
"src/configured-bundle-producer.ts"() {
|
|
117139
117308
|
"use strict";
|
|
117140
117309
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
117141
|
-
|
|
117142
|
-
|
|
117310
|
+
import_node_fs143 = __toESM(require("node:fs"), 1);
|
|
117311
|
+
import_node_path145 = __toESM(require("node:path"), 1);
|
|
117143
117312
|
init_bundle_global_footer();
|
|
117144
117313
|
import_sucrase3 = require("sucrase");
|
|
117145
117314
|
import_terser2 = require("terser");
|
|
@@ -117449,9 +117618,9 @@ var init_android_theme = __esm({
|
|
|
117449
117618
|
|
|
117450
117619
|
// src/android-drawables.ts
|
|
117451
117620
|
function readAndroidDrawables(moduleDir, sources) {
|
|
117452
|
-
const res =
|
|
117621
|
+
const res = import_node_path146.default.join(moduleDir, "src/main/res");
|
|
117453
117622
|
const byName = /* @__PURE__ */ new Map();
|
|
117454
|
-
for (const dir of
|
|
117623
|
+
for (const dir of import_node_fs144.default.existsSync(res) ? import_node_fs144.default.readdirSync(res).sort() : []) {
|
|
117455
117624
|
if (!dir.startsWith("drawable")) continue;
|
|
117456
117625
|
const match = DRAWABLE_DIR.exec(dir);
|
|
117457
117626
|
const qualifier = match?.[1];
|
|
@@ -117461,10 +117630,10 @@ function readAndroidDrawables(moduleDir, sources) {
|
|
|
117461
117630
|
`${res}/${dir}: drawables under this qualifier are not resolved by Peach yet`
|
|
117462
117631
|
);
|
|
117463
117632
|
const version2 = Number(match[2] ?? 0);
|
|
117464
|
-
for (const entry of
|
|
117633
|
+
for (const entry of import_node_fs144.default.readdirSync(import_node_path146.default.join(res, dir)).sort()) {
|
|
117465
117634
|
if (!entry.endsWith(".xml") && !BITMAP.test(entry)) continue;
|
|
117466
117635
|
const name3 = entry.replace(BITMAP, "").replace(/\.xml$/, "");
|
|
117467
|
-
const file =
|
|
117636
|
+
const file = import_node_path146.default.join(res, dir, entry);
|
|
117468
117637
|
const files2 = byName.get(name3) ?? [];
|
|
117469
117638
|
byName.set(name3, files2);
|
|
117470
117639
|
if (version2 > DEVICE_API) continue;
|
|
@@ -117477,7 +117646,7 @@ function readAndroidDrawables(moduleDir, sources) {
|
|
|
117477
117646
|
ninePatch: entry.endsWith(".9.png")
|
|
117478
117647
|
});
|
|
117479
117648
|
else {
|
|
117480
|
-
const root = parseXml(
|
|
117649
|
+
const root = parseXml(import_node_fs144.default.readFileSync(file, "utf8"), file).children[0];
|
|
117481
117650
|
files2.push(
|
|
117482
117651
|
root?.name === "vector" ? {
|
|
117483
117652
|
file,
|
|
@@ -117644,13 +117813,13 @@ function readVector(root, file, sources) {
|
|
|
117644
117813
|
calls
|
|
117645
117814
|
};
|
|
117646
117815
|
}
|
|
117647
|
-
var
|
|
117816
|
+
var import_node_fs144, import_node_path146, DEVICE_API, BUCKETS, DRAWABLE_DIR, BITMAP;
|
|
117648
117817
|
var init_android_drawables = __esm({
|
|
117649
117818
|
"src/android-drawables.ts"() {
|
|
117650
117819
|
"use strict";
|
|
117651
117820
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
117652
|
-
|
|
117653
|
-
|
|
117821
|
+
import_node_fs144 = __toESM(require("node:fs"), 1);
|
|
117822
|
+
import_node_path146 = __toESM(require("node:path"), 1);
|
|
117654
117823
|
init_android_theme();
|
|
117655
117824
|
init_android_xml();
|
|
117656
117825
|
DEVICE_API = 37;
|
|
@@ -117672,12 +117841,12 @@ var init_android_drawables = __esm({
|
|
|
117672
117841
|
|
|
117673
117842
|
// src/android-layout-ids.ts
|
|
117674
117843
|
function readAndroidLayoutIds(moduleDir) {
|
|
117675
|
-
const res =
|
|
117844
|
+
const res = import_node_path147.default.join(moduleDir, "src/main/res");
|
|
117676
117845
|
const layouts = /* @__PURE__ */ new Set();
|
|
117677
117846
|
const ids = /* @__PURE__ */ new Set();
|
|
117678
117847
|
const elements = /* @__PURE__ */ new Map();
|
|
117679
|
-
for (const dir of
|
|
117680
|
-
const directory2 =
|
|
117848
|
+
for (const dir of import_node_fs145.default.existsSync(res) ? import_node_fs145.default.readdirSync(res).sort() : []) {
|
|
117849
|
+
const directory2 = import_node_path147.default.join(res, dir);
|
|
117681
117850
|
if (dir === "layout" || dir.startsWith("layout-")) {
|
|
117682
117851
|
const match = LAYOUT_DIR.exec(dir);
|
|
117683
117852
|
if (!match)
|
|
@@ -117687,13 +117856,13 @@ function readAndroidLayoutIds(moduleDir) {
|
|
|
117687
117856
|
const orientation = match[1] === "port" ? 1 : match[1] === "land" ? 2 : 0;
|
|
117688
117857
|
const night = match[2] === "notnight" ? 1 : match[2] === "night" ? 2 : 0;
|
|
117689
117858
|
const version2 = Number(match[3] ?? 0);
|
|
117690
|
-
for (const entry of
|
|
117859
|
+
for (const entry of import_node_fs145.default.readdirSync(directory2).sort()) {
|
|
117691
117860
|
if (!entry.endsWith(".xml")) continue;
|
|
117692
117861
|
const name3 = entry.slice(0, -".xml".length);
|
|
117693
117862
|
layouts.add(name3);
|
|
117694
|
-
const xml =
|
|
117863
|
+
const xml = import_node_fs145.default.readFileSync(import_node_path147.default.join(directory2, entry), "utf8");
|
|
117695
117864
|
for (const reference of xml.matchAll(ID_REFERENCE)) ids.add(reference[1]);
|
|
117696
|
-
const element = parseXml(xml,
|
|
117865
|
+
const element = parseXml(xml, import_node_path147.default.join(directory2, entry)).children[0];
|
|
117697
117866
|
if (!element || version2 > DEVICE_API) continue;
|
|
117698
117867
|
elements.set(name3, [
|
|
117699
117868
|
...elements.get(name3) ?? [],
|
|
@@ -117701,9 +117870,9 @@ function readAndroidLayoutIds(moduleDir) {
|
|
|
117701
117870
|
]);
|
|
117702
117871
|
}
|
|
117703
117872
|
} else if (dir.startsWith("values")) {
|
|
117704
|
-
for (const entry of
|
|
117873
|
+
for (const entry of import_node_fs145.default.readdirSync(directory2).sort()) {
|
|
117705
117874
|
if (!entry.endsWith(".xml")) continue;
|
|
117706
|
-
const xml =
|
|
117875
|
+
const xml = import_node_fs145.default.readFileSync(import_node_path147.default.join(directory2, entry), "utf8");
|
|
117707
117876
|
for (const item of xml.matchAll(ID_ITEM)) {
|
|
117708
117877
|
const name3 = ITEM_NAME.exec(item[0])?.[1];
|
|
117709
117878
|
if (name3) ids.add(name3);
|
|
@@ -117713,13 +117882,13 @@ function readAndroidLayoutIds(moduleDir) {
|
|
|
117713
117882
|
}
|
|
117714
117883
|
return { layouts: [...layouts].sort(), ids: [...ids].sort(), elements };
|
|
117715
117884
|
}
|
|
117716
|
-
var
|
|
117885
|
+
var import_node_fs145, import_node_path147, LAYOUT_DIR, ID_REFERENCE, ID_ITEM, ITEM_NAME;
|
|
117717
117886
|
var init_android_layout_ids = __esm({
|
|
117718
117887
|
"src/android-layout-ids.ts"() {
|
|
117719
117888
|
"use strict";
|
|
117720
117889
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
117721
|
-
|
|
117722
|
-
|
|
117890
|
+
import_node_fs145 = __toESM(require("node:fs"), 1);
|
|
117891
|
+
import_node_path147 = __toESM(require("node:path"), 1);
|
|
117723
117892
|
init_android_drawables();
|
|
117724
117893
|
init_android_xml();
|
|
117725
117894
|
LAYOUT_DIR = /^layout(?:-(port|land))?(?:-(notnight|night))?(?:-v(\d+))?$/;
|
|
@@ -117734,15 +117903,15 @@ function readAndroidStrings(moduleDir) {
|
|
|
117734
117903
|
const strings7 = /* @__PURE__ */ new Map();
|
|
117735
117904
|
const plurals = /* @__PURE__ */ new Map();
|
|
117736
117905
|
const arrays = /* @__PURE__ */ new Map();
|
|
117737
|
-
const res =
|
|
117738
|
-
const dirs =
|
|
117906
|
+
const res = import_node_path148.default.join(moduleDir, "src/main/res");
|
|
117907
|
+
const dirs = import_node_fs146.default.existsSync(res) ? import_node_fs146.default.readdirSync(res).sort() : [];
|
|
117739
117908
|
for (const dir of dirs) {
|
|
117740
117909
|
if (!dir.startsWith("values")) continue;
|
|
117741
117910
|
const qualifier = VALUES_DIR.exec(dir);
|
|
117742
|
-
for (const entry of
|
|
117911
|
+
for (const entry of import_node_fs146.default.readdirSync(import_node_path148.default.join(res, dir)).sort()) {
|
|
117743
117912
|
if (!entry.endsWith(".xml")) continue;
|
|
117744
|
-
const file =
|
|
117745
|
-
const text6 =
|
|
117913
|
+
const file = import_node_path148.default.join(res, dir, entry);
|
|
117914
|
+
const text6 = import_node_fs146.default.readFileSync(file, "utf8").replace(/<!--[\s\S]*?-->/g, "");
|
|
117746
117915
|
for (const match of text6.matchAll(ELEMENT)) {
|
|
117747
117916
|
const kind = match[1] ?? "";
|
|
117748
117917
|
const name3 = NAME.exec(match[2] ?? "")?.[1];
|
|
@@ -117793,13 +117962,13 @@ function compileString(raw2, where) {
|
|
|
117793
117962
|
where
|
|
117794
117963
|
);
|
|
117795
117964
|
}
|
|
117796
|
-
var
|
|
117965
|
+
var import_node_fs146, import_node_path148, VALUES_DIR, ELEMENT, ITEM, NAME, QUANTITY, QUANTITIES, isQuantity, sorted;
|
|
117797
117966
|
var init_android_strings = __esm({
|
|
117798
117967
|
"src/android-strings.ts"() {
|
|
117799
117968
|
"use strict";
|
|
117800
117969
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
117801
|
-
|
|
117802
|
-
|
|
117970
|
+
import_node_fs146 = __toESM(require("node:fs"), 1);
|
|
117971
|
+
import_node_path148 = __toESM(require("node:path"), 1);
|
|
117803
117972
|
init_android_string_value();
|
|
117804
117973
|
init_android_xml();
|
|
117805
117974
|
VALUES_DIR = /^values(?:-([a-z]{2,3})(?:-r([A-Z]{2}))?)?$/;
|
|
@@ -129183,7 +129352,7 @@ function repositories(body, where) {
|
|
|
129183
129352
|
if (name3 === "google") roots.push("https://dl.google.com/dl/android/maven2");
|
|
129184
129353
|
else if (name3 === "mavenCentral") roots.push("https://repo1.maven.org/maven2");
|
|
129185
129354
|
else if (name3 === "mavenLocal")
|
|
129186
|
-
roots.push(
|
|
129355
|
+
roots.push(import_node_path149.default.join(import_node_os26.default.homedir(), ".m2", "repository"));
|
|
129187
129356
|
else {
|
|
129188
129357
|
const declared = direct ?? /["']([^"']+)["']/.exec(block2 ?? "")?.[1];
|
|
129189
129358
|
if (!declared)
|
|
@@ -129198,9 +129367,9 @@ function repositories(body, where) {
|
|
|
129198
129367
|
return roots;
|
|
129199
129368
|
}
|
|
129200
129369
|
function mavenRepositories(projectDir, where) {
|
|
129201
|
-
const file = ["settings.gradle.kts", "settings.gradle"].map((name3) =>
|
|
129370
|
+
const file = ["settings.gradle.kts", "settings.gradle"].map((name3) => import_node_path149.default.join(projectDir, name3)).find((candidate) => import_node_fs147.default.existsSync(candidate));
|
|
129202
129371
|
if (!file) throw new Error(`${where}: ${projectDir} has no settings.gradle`);
|
|
129203
|
-
const text6 =
|
|
129372
|
+
const text6 = import_node_fs147.default.readFileSync(file, "utf8");
|
|
129204
129373
|
const management = text6.search(/\bdependencyResolutionManagement\b/);
|
|
129205
129374
|
if (management < 0)
|
|
129206
129375
|
throw new Error(`${where}: ${file} declares no dependency repositories`);
|
|
@@ -129266,32 +129435,32 @@ function extract(bytes, where) {
|
|
|
129266
129435
|
const cached4 = pending.get(key2);
|
|
129267
129436
|
if (cached4) return cached4;
|
|
129268
129437
|
const request = (async () => {
|
|
129269
|
-
const dest =
|
|
129270
|
-
const marker =
|
|
129271
|
-
if (!
|
|
129438
|
+
const dest = import_node_path149.default.join(import_node_os26.default.tmpdir(), "peach-maven-sources", key2);
|
|
129439
|
+
const marker = import_node_path149.default.join(dest, ".complete");
|
|
129440
|
+
if (!import_node_fs147.default.existsSync(marker)) {
|
|
129272
129441
|
const entries = zipSources(bytes, where);
|
|
129273
129442
|
const java = entries.find((entry) => entry.name.endsWith(".java"));
|
|
129274
129443
|
if (java) throw new Error(`${where}: ${java.name} is a Java source`);
|
|
129275
129444
|
const kotlin = entries.filter((entry) => entry.name.endsWith(".kt"));
|
|
129276
129445
|
if (kotlin.length === 0) throw new Error(`${where}: sources jar has no Kotlin`);
|
|
129277
129446
|
const staging = `${dest}.partial-${process.pid}`;
|
|
129278
|
-
|
|
129447
|
+
import_node_fs147.default.rmSync(staging, { recursive: true, force: true });
|
|
129279
129448
|
for (const entry of kotlin) {
|
|
129280
|
-
const file =
|
|
129281
|
-
|
|
129282
|
-
|
|
129449
|
+
const file = import_node_path149.default.join(staging, entry.name);
|
|
129450
|
+
import_node_fs147.default.mkdirSync(import_node_path149.default.dirname(file), { recursive: true });
|
|
129451
|
+
import_node_fs147.default.writeFileSync(file, entry.data);
|
|
129283
129452
|
}
|
|
129284
|
-
|
|
129453
|
+
import_node_fs147.default.writeFileSync(import_node_path149.default.join(staging, ".complete"), "");
|
|
129285
129454
|
try {
|
|
129286
|
-
|
|
129455
|
+
import_node_fs147.default.renameSync(staging, dest);
|
|
129287
129456
|
} catch (error) {
|
|
129288
|
-
|
|
129289
|
-
if (!
|
|
129457
|
+
import_node_fs147.default.rmSync(staging, { recursive: true, force: true });
|
|
129458
|
+
if (!import_node_fs147.default.existsSync(marker)) throw error;
|
|
129290
129459
|
}
|
|
129291
129460
|
}
|
|
129292
|
-
return
|
|
129461
|
+
return import_node_fs147.default.readdirSync(dest, { recursive: true }).flatMap((entry) => {
|
|
129293
129462
|
const name3 = String(entry);
|
|
129294
|
-
return name3.endsWith(".kt") ? [
|
|
129463
|
+
return name3.endsWith(".kt") ? [import_node_path149.default.join(dest, name3)] : [];
|
|
129295
129464
|
}).sort();
|
|
129296
129465
|
})().catch((error) => {
|
|
129297
129466
|
pending.delete(key2);
|
|
@@ -129314,8 +129483,8 @@ async function sourcesJar(root, group, artifact, version2) {
|
|
|
129314
129483
|
if (!response.ok) throw new Error(`${url} answered ${response.status}`);
|
|
129315
129484
|
return Buffer.from(await response.arrayBuffer());
|
|
129316
129485
|
}
|
|
129317
|
-
const file =
|
|
129318
|
-
return
|
|
129486
|
+
const file = import_node_path149.default.join(root, ...parts);
|
|
129487
|
+
return import_node_fs147.default.existsSync(file) ? import_node_fs147.default.readFileSync(file) : null;
|
|
129319
129488
|
}
|
|
129320
129489
|
async function mavenKotlinSources(projectDir, coordinate, where) {
|
|
129321
129490
|
const { group, artifact, version: version2 } = coordinate;
|
|
@@ -129325,28 +129494,28 @@ async function mavenKotlinSources(projectDir, coordinate, where) {
|
|
|
129325
129494
|
}
|
|
129326
129495
|
return null;
|
|
129327
129496
|
}
|
|
129328
|
-
var import_node_crypto74,
|
|
129497
|
+
var import_node_crypto74, import_node_fs147, import_node_os26, import_node_path149, import_node_zlib4, pending;
|
|
129329
129498
|
var init_kotlin_maven_sources = __esm({
|
|
129330
129499
|
"src/kotlin-maven-sources.ts"() {
|
|
129331
129500
|
"use strict";
|
|
129332
129501
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
129333
129502
|
import_node_crypto74 = require("node:crypto");
|
|
129334
|
-
|
|
129503
|
+
import_node_fs147 = __toESM(require("node:fs"), 1);
|
|
129335
129504
|
import_node_os26 = __toESM(require("node:os"), 1);
|
|
129336
|
-
|
|
129505
|
+
import_node_path149 = __toESM(require("node:path"), 1);
|
|
129337
129506
|
import_node_zlib4 = require("node:zlib");
|
|
129338
129507
|
pending = /* @__PURE__ */ new Map();
|
|
129339
129508
|
}
|
|
129340
129509
|
});
|
|
129341
129510
|
|
|
129342
129511
|
// src/kotlin-version-catalog.ts
|
|
129343
|
-
var
|
|
129512
|
+
var import_node_fs148, import_node_path150, import_smol_toml, accessorName, KotlinVersionCatalog;
|
|
129344
129513
|
var init_kotlin_version_catalog = __esm({
|
|
129345
129514
|
"src/kotlin-version-catalog.ts"() {
|
|
129346
129515
|
"use strict";
|
|
129347
129516
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
129348
|
-
|
|
129349
|
-
|
|
129517
|
+
import_node_fs148 = __toESM(require("node:fs"), 1);
|
|
129518
|
+
import_node_path150 = __toESM(require("node:path"), 1);
|
|
129350
129519
|
import_smol_toml = require("smol-toml");
|
|
129351
129520
|
init_is_record();
|
|
129352
129521
|
accessorName = (name3) => name3.replace(/[-_.]/g, ".");
|
|
@@ -129354,8 +129523,8 @@ var init_kotlin_version_catalog = __esm({
|
|
|
129354
129523
|
file;
|
|
129355
129524
|
tables;
|
|
129356
129525
|
constructor(projectDir) {
|
|
129357
|
-
this.file =
|
|
129358
|
-
this.tables =
|
|
129526
|
+
this.file = import_node_path150.default.join(projectDir, "gradle/libs.versions.toml");
|
|
129527
|
+
this.tables = import_node_fs148.default.existsSync(this.file) ? (0, import_smol_toml.parse)(import_node_fs148.default.readFileSync(this.file, "utf8")) : {};
|
|
129359
129528
|
}
|
|
129360
129529
|
entry(section, accessor, where) {
|
|
129361
129530
|
const table = this.tables[section];
|
|
@@ -129413,7 +129582,7 @@ __export(kotlin_app_exports, {
|
|
|
129413
129582
|
});
|
|
129414
129583
|
function readAndroidPins(moduleRoot) {
|
|
129415
129584
|
const toolchain = JSON.parse(
|
|
129416
|
-
|
|
129585
|
+
import_node_fs149.default.readFileSync(import_node_path151.default.join(moduleRoot, "toolchain.json"), "utf8")
|
|
129417
129586
|
);
|
|
129418
129587
|
if (!isRecord(toolchain))
|
|
129419
129588
|
throw new Error("peachsim kotlin/toolchain.json is not an object");
|
|
@@ -129454,8 +129623,8 @@ function readAndroidPins(moduleRoot) {
|
|
|
129454
129623
|
}
|
|
129455
129624
|
function readGradle(dir) {
|
|
129456
129625
|
for (const name3 of ["build.gradle.kts", "build.gradle"]) {
|
|
129457
|
-
const file =
|
|
129458
|
-
if (
|
|
129626
|
+
const file = import_node_path151.default.join(dir, name3);
|
|
129627
|
+
if (import_node_fs149.default.existsSync(file)) return { file, text: import_node_fs149.default.readFileSync(file, "utf8") };
|
|
129459
129628
|
}
|
|
129460
129629
|
return null;
|
|
129461
129630
|
}
|
|
@@ -129652,15 +129821,15 @@ function themeSources(moduleDir, night) {
|
|
|
129652
129821
|
} : { android, app: read("values") };
|
|
129653
129822
|
}
|
|
129654
129823
|
function valuesFiles(moduleDir, qualifier) {
|
|
129655
|
-
const values =
|
|
129656
|
-
return
|
|
129657
|
-
const file =
|
|
129658
|
-
return { file, text:
|
|
129824
|
+
const values = import_node_path151.default.join(moduleDir, "src/main/res", qualifier);
|
|
129825
|
+
return import_node_fs149.default.existsSync(values) ? import_node_fs149.default.readdirSync(values).filter((entry) => entry.endsWith(".xml")).map((entry) => {
|
|
129826
|
+
const file = import_node_path151.default.join(values, entry);
|
|
129827
|
+
return { file, text: import_node_fs149.default.readFileSync(file, "utf8") };
|
|
129659
129828
|
}) : [];
|
|
129660
129829
|
}
|
|
129661
129830
|
function readAppColors(moduleDir, theme) {
|
|
129662
|
-
const res =
|
|
129663
|
-
for (const dir of
|
|
129831
|
+
const res = import_node_path151.default.join(moduleDir, "src/main/res");
|
|
129832
|
+
for (const dir of import_node_fs149.default.existsSync(res) ? import_node_fs149.default.readdirSync(res).sort() : []) {
|
|
129664
129833
|
if (!dir.startsWith("values") || dir === "values" || dir === "values-night") continue;
|
|
129665
129834
|
const colors = Object.keys(readResourceValues(valuesFiles(moduleDir, dir)).colors);
|
|
129666
129835
|
if (colors.length > 0)
|
|
@@ -129732,17 +129901,17 @@ function isLauncher(element) {
|
|
|
129732
129901
|
);
|
|
129733
129902
|
}
|
|
129734
129903
|
async function readKotlinApp(moduleArg, options) {
|
|
129735
|
-
const moduleDir =
|
|
129736
|
-
const manifestFile =
|
|
129737
|
-
if (!
|
|
129904
|
+
const moduleDir = import_node_fs149.default.realpathSync(import_node_path151.default.resolve(moduleArg));
|
|
129905
|
+
const manifestFile = import_node_path151.default.join(moduleDir, "src/main/AndroidManifest.xml");
|
|
129906
|
+
if (!import_node_fs149.default.existsSync(manifestFile))
|
|
129738
129907
|
throw new Error(
|
|
129739
129908
|
`${moduleDir} is not an Android app module: no src/main/AndroidManifest.xml`
|
|
129740
129909
|
);
|
|
129741
129910
|
let projectDir = moduleDir;
|
|
129742
129911
|
while (!["settings.gradle.kts", "settings.gradle"].some(
|
|
129743
|
-
(name3) =>
|
|
129912
|
+
(name3) => import_node_fs149.default.existsSync(import_node_path151.default.join(projectDir, name3))
|
|
129744
129913
|
)) {
|
|
129745
|
-
const parent =
|
|
129914
|
+
const parent = import_node_path151.default.dirname(projectDir);
|
|
129746
129915
|
if (parent === projectDir)
|
|
129747
129916
|
throw new Error(`${moduleDir} has no settings.gradle above it`);
|
|
129748
129917
|
projectDir = parent;
|
|
@@ -129784,7 +129953,7 @@ async function readKotlinApp(moduleArg, options) {
|
|
|
129784
129953
|
const language = /^(\d+)\.(\d+)/.exec(kotlin)?.slice(1, 3).join(".");
|
|
129785
129954
|
if (!language)
|
|
129786
129955
|
throw new Error(`Kotlin plugin version ${kotlin} names no language version`);
|
|
129787
|
-
const manifest = parseXml(
|
|
129956
|
+
const manifest = parseXml(import_node_fs149.default.readFileSync(manifestFile, "utf8"), manifestFile);
|
|
129788
129957
|
const root = manifest.children.find((element) => element.name === "manifest");
|
|
129789
129958
|
const application = root?.children.find((element) => element.name === "application");
|
|
129790
129959
|
if (!root || !application) throw new Error(`${manifestFile} has no <application>`);
|
|
@@ -129878,11 +130047,11 @@ async function readKotlinApp(moduleArg, options) {
|
|
|
129878
130047
|
const sources = selected ? selected.kotlin : [];
|
|
129879
130048
|
if (!selected)
|
|
129880
130049
|
for (const set2 of ["java", "kotlin"]) {
|
|
129881
|
-
const dir =
|
|
129882
|
-
if (!
|
|
130050
|
+
const dir = import_node_path151.default.join(moduleDir, "src/main", set2);
|
|
130051
|
+
if (!import_node_fs149.default.existsSync(dir)) continue;
|
|
129883
130052
|
const walk3 = (current2) => {
|
|
129884
|
-
for (const entry of
|
|
129885
|
-
const full =
|
|
130053
|
+
for (const entry of import_node_fs149.default.readdirSync(current2, { withFileTypes: true })) {
|
|
130054
|
+
const full = import_node_path151.default.join(current2, entry.name);
|
|
129886
130055
|
if (entry.isDirectory()) walk3(full);
|
|
129887
130056
|
else if (entry.name.endsWith(".java"))
|
|
129888
130057
|
throw new Error(`${full}: Java sources are not supported by peach open`);
|
|
@@ -129927,13 +130096,13 @@ async function readKotlinApp(moduleArg, options) {
|
|
|
129927
130096
|
layoutIds: readAndroidLayoutIds(moduleDir)
|
|
129928
130097
|
};
|
|
129929
130098
|
}
|
|
129930
|
-
var
|
|
130099
|
+
var import_node_fs149, import_node_path151, ANDROID_NS, MAIN, LAUNCHER, PLUGINS, PLATFORM_GROUPS, PLATFORM_ARTIFACTS, ANDROID_PIN;
|
|
129931
130100
|
var init_kotlin_app = __esm({
|
|
129932
130101
|
"src/kotlin-app.ts"() {
|
|
129933
130102
|
"use strict";
|
|
129934
130103
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
129935
|
-
|
|
129936
|
-
|
|
130104
|
+
import_node_fs149 = __toESM(require("node:fs"), 1);
|
|
130105
|
+
import_node_path151 = __toESM(require("node:path"), 1);
|
|
129937
130106
|
init_android_drawables();
|
|
129938
130107
|
init_android_layout_ids();
|
|
129939
130108
|
init_android_strings();
|
|
@@ -129985,24 +130154,24 @@ __export(native_input_exports, {
|
|
|
129985
130154
|
});
|
|
129986
130155
|
function resolveNativeInput(target) {
|
|
129987
130156
|
if (!target || /^\w+:\/\//.test(target) || /^\d+$/.test(target)) return null;
|
|
129988
|
-
const resolved =
|
|
129989
|
-
const stat2 =
|
|
130157
|
+
const resolved = import_node_path152.default.resolve(target);
|
|
130158
|
+
const stat2 = import_node_fs150.default.statSync(resolved, { throwIfNoEntry: false });
|
|
129990
130159
|
if (!stat2) return null;
|
|
129991
130160
|
if (stat2.isFile()) {
|
|
129992
|
-
if (resolved.endsWith(".swift") &&
|
|
129993
|
-
return { kind: "swift-file", path:
|
|
129994
|
-
if (
|
|
129995
|
-
return { kind: "swift-package", path:
|
|
130161
|
+
if (resolved.endsWith(".swift") && import_node_path152.default.basename(resolved) !== "Package.swift")
|
|
130162
|
+
return { kind: "swift-file", path: import_node_fs150.default.realpathSync(resolved) };
|
|
130163
|
+
if (import_node_path152.default.basename(resolved) === "Package.swift")
|
|
130164
|
+
return { kind: "swift-package", path: import_node_fs150.default.realpathSync(import_node_path152.default.dirname(resolved)) };
|
|
129996
130165
|
return null;
|
|
129997
130166
|
}
|
|
129998
130167
|
if (!stat2.isDirectory()) return null;
|
|
129999
|
-
if (
|
|
130000
|
-
return { kind: "swift-package", path:
|
|
130168
|
+
if (import_node_fs150.default.existsSync(import_node_path152.default.join(resolved, "Package.swift")))
|
|
130169
|
+
return { kind: "swift-package", path: import_node_fs150.default.realpathSync(resolved) };
|
|
130001
130170
|
const xcode = findXcodeProject(resolved);
|
|
130002
|
-
if (xcode) return { kind: "xcode", path:
|
|
130003
|
-
if (
|
|
130004
|
-
return { kind: "kotlin", path:
|
|
130005
|
-
if (!
|
|
130171
|
+
if (xcode) return { kind: "xcode", path: import_node_fs150.default.realpathSync(xcode) };
|
|
130172
|
+
if (import_node_fs150.default.existsSync(import_node_path152.default.join(resolved, "src/main/AndroidManifest.xml")))
|
|
130173
|
+
return { kind: "kotlin", path: import_node_fs150.default.realpathSync(resolved) };
|
|
130174
|
+
if (!import_node_fs150.default.existsSync(import_node_path152.default.join(resolved, "package.json")) && import_node_fs150.default.readdirSync(resolved).some((name3) => name3.endsWith(".swift")))
|
|
130006
130175
|
throw new Error(
|
|
130007
130176
|
`${target} holds Swift files but no Package.swift or Xcode project; open one .swift file, a Swift package, or an Xcode project`
|
|
130008
130177
|
);
|
|
@@ -130031,7 +130200,7 @@ async function prepareSwiftInput(input, opts = {}) {
|
|
|
130031
130200
|
module2?.root,
|
|
130032
130201
|
run14?.configuration
|
|
130033
130202
|
) : input.path;
|
|
130034
|
-
const name3 = input.kind === "swift-file" ?
|
|
130203
|
+
const name3 = input.kind === "swift-file" ? import_node_path152.default.basename(input.path, ".swift") : import_node_path152.default.basename(packagePath);
|
|
130035
130204
|
const appProject = resolveAppProject(packagePath);
|
|
130036
130205
|
let appInfo;
|
|
130037
130206
|
try {
|
|
@@ -130086,7 +130255,7 @@ async function prepareNativeInput(input, opts) {
|
|
|
130086
130255
|
const metadata = await host2.kotlinAppArtifact(project2, moduleRoot, opts.origin);
|
|
130087
130256
|
const prefix = new URL(metadata.url).pathname.slice(0, -"app.mjs".length);
|
|
130088
130257
|
return {
|
|
130089
|
-
name:
|
|
130258
|
+
name: import_node_path152.default.basename(project2.projectDir),
|
|
130090
130259
|
guestSource: kotlinGuestBundle(),
|
|
130091
130260
|
guestPath: KOTLIN_GUEST_PATH,
|
|
130092
130261
|
metadataPath: host2.KOTLIN_PACKAGE_PATH,
|
|
@@ -130121,13 +130290,13 @@ async function prepareNativeInput(input, opts) {
|
|
|
130121
130290
|
throw error;
|
|
130122
130291
|
}
|
|
130123
130292
|
}
|
|
130124
|
-
var
|
|
130293
|
+
var import_node_fs150, import_node_path152;
|
|
130125
130294
|
var init_native_input = __esm({
|
|
130126
130295
|
"cli/native-input.ts"() {
|
|
130127
130296
|
"use strict";
|
|
130128
130297
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
130129
|
-
|
|
130130
|
-
|
|
130298
|
+
import_node_fs150 = __toESM(require("node:fs"), 1);
|
|
130299
|
+
import_node_path152 = __toESM(require("node:path"), 1);
|
|
130131
130300
|
init_configured_bundle_producer();
|
|
130132
130301
|
init_guest_bundle();
|
|
130133
130302
|
init_kotlinDiscoveryContract();
|
|
@@ -130265,7 +130434,7 @@ async function runKotlin(args, opts = {}) {
|
|
|
130265
130434
|
throw new Error(`unknown peach open flag for an Android app: ${arg}`);
|
|
130266
130435
|
else if (modulePath)
|
|
130267
130436
|
throw new Error("peach open expects one Android app module directory");
|
|
130268
|
-
else modulePath =
|
|
130437
|
+
else modulePath = import_node_path153.default.resolve(arg);
|
|
130269
130438
|
}
|
|
130270
130439
|
if (!modulePath) throw new Error("usage: peach open <android-app-module>");
|
|
130271
130440
|
const device = opts.device ?? opts.openArgs?.find((_, index) => opts.openArgs?.[index - 1] === "--device") ?? DEFAULT_DEVICE_BY_PLATFORM.android;
|
|
@@ -130288,7 +130457,7 @@ async function runKotlin(args, opts = {}) {
|
|
|
130288
130457
|
let origin = "";
|
|
130289
130458
|
let artifact;
|
|
130290
130459
|
let compileError = "Kotlin compilation is starting";
|
|
130291
|
-
const projectName =
|
|
130460
|
+
const projectName = import_node_path153.default.basename(project2.projectDir);
|
|
130292
130461
|
const routes2 = () => ({
|
|
130293
130462
|
root: project2.projectDir,
|
|
130294
130463
|
moduleRoot,
|
|
@@ -130413,7 +130582,7 @@ async function runKotlin(args, opts = {}) {
|
|
|
130413
130582
|
});
|
|
130414
130583
|
console.log(` Kotlin app: ${project2.launcher.name} in ${project2.moduleDir}`);
|
|
130415
130584
|
console.log(` Kotlin preview host: ${origin}`);
|
|
130416
|
-
watcher =
|
|
130585
|
+
watcher = import_node_fs151.default.watch(project2.projectDir, { recursive: true }, (_event, file) => {
|
|
130417
130586
|
if (file && file.split(/[\\/]/).some((segment) => segment === "build" || segment.startsWith(".")))
|
|
130418
130587
|
return;
|
|
130419
130588
|
void rebuild();
|
|
@@ -130468,14 +130637,14 @@ async function runKotlin(args, opts = {}) {
|
|
|
130468
130637
|
}
|
|
130469
130638
|
return code;
|
|
130470
130639
|
}
|
|
130471
|
-
var
|
|
130640
|
+
var import_node_fs151, import_node_http3, import_node_path153, import_ws5, HMR_PATH;
|
|
130472
130641
|
var init_kotlin = __esm({
|
|
130473
130642
|
"cli/commands/kotlin.ts"() {
|
|
130474
130643
|
"use strict";
|
|
130475
130644
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
130476
|
-
|
|
130645
|
+
import_node_fs151 = __toESM(require("node:fs"), 1);
|
|
130477
130646
|
import_node_http3 = __toESM(require("node:http"), 1);
|
|
130478
|
-
|
|
130647
|
+
import_node_path153 = __toESM(require("node:path"), 1);
|
|
130479
130648
|
import_ws5 = require("ws");
|
|
130480
130649
|
init_device_catalog();
|
|
130481
130650
|
init_guest_bundle();
|
|
@@ -130532,7 +130701,7 @@ async function runSwift(args, opts = {}) {
|
|
|
130532
130701
|
const value = input[++index];
|
|
130533
130702
|
if (!value || value.startsWith("-"))
|
|
130534
130703
|
throw new Error("--swift-sdks-path requires a value");
|
|
130535
|
-
process.env.PEACH_SWIFT_SDKS_PATH =
|
|
130704
|
+
process.env.PEACH_SWIFT_SDKS_PATH = import_node_path154.default.resolve(value);
|
|
130536
130705
|
} else if (arg === "--host-port" || valueFlags.has(arg)) {
|
|
130537
130706
|
const value = input[++index];
|
|
130538
130707
|
if (!value || value.startsWith("-")) throw new Error(`${arg} requires a value`);
|
|
@@ -130546,7 +130715,7 @@ async function runSwift(args, opts = {}) {
|
|
|
130546
130715
|
else if (arg.startsWith("-"))
|
|
130547
130716
|
throw new Error(`unknown peach open flag for a Swift app: ${arg}`);
|
|
130548
130717
|
else if (packagePath) throw new Error("peach open expects one project");
|
|
130549
|
-
else packagePath =
|
|
130718
|
+
else packagePath = import_node_path154.default.resolve(arg);
|
|
130550
130719
|
}
|
|
130551
130720
|
if (!packagePath) {
|
|
130552
130721
|
throw new Error(
|
|
@@ -130721,7 +130890,7 @@ async function runSwift(args, opts = {}) {
|
|
|
130721
130890
|
code = 1;
|
|
130722
130891
|
stop();
|
|
130723
130892
|
});
|
|
130724
|
-
watcher =
|
|
130893
|
+
watcher = import_node_fs152.default.watch(
|
|
130725
130894
|
nativeInput.kind === "swift-file" ? nativeInput.path : packagePath,
|
|
130726
130895
|
{ recursive: nativeInput.kind !== "swift-file" },
|
|
130727
130896
|
(_event, file) => {
|
|
@@ -130789,14 +130958,14 @@ async function runSwift(args, opts = {}) {
|
|
|
130789
130958
|
}
|
|
130790
130959
|
return code;
|
|
130791
130960
|
}
|
|
130792
|
-
var
|
|
130961
|
+
var import_node_fs152, import_node_http4, import_node_path154, import_ws6;
|
|
130793
130962
|
var init_swift = __esm({
|
|
130794
130963
|
"cli/commands/swift.ts"() {
|
|
130795
130964
|
"use strict";
|
|
130796
130965
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
130797
|
-
|
|
130966
|
+
import_node_fs152 = __toESM(require("node:fs"), 1);
|
|
130798
130967
|
import_node_http4 = __toESM(require("node:http"), 1);
|
|
130799
|
-
|
|
130968
|
+
import_node_path154 = __toESM(require("node:path"), 1);
|
|
130800
130969
|
import_ws6 = require("ws");
|
|
130801
130970
|
init_backend_origin();
|
|
130802
130971
|
init_swift_submit();
|
|
@@ -131006,11 +131175,11 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
|
|
|
131006
131175
|
);
|
|
131007
131176
|
}
|
|
131008
131177
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
131009
|
-
const bridgeLogPath =
|
|
131178
|
+
const bridgeLogPath = import_node_path155.default.join(
|
|
131010
131179
|
import_node_os27.default.tmpdir(),
|
|
131011
131180
|
`peach-bridge-${Date.now()}-${process.pid}.log`
|
|
131012
131181
|
);
|
|
131013
|
-
const bridgeLogFd =
|
|
131182
|
+
const bridgeLogFd = import_node_fs153.default.openSync(bridgeLogPath, "a");
|
|
131014
131183
|
let child;
|
|
131015
131184
|
try {
|
|
131016
131185
|
child = (0, import_node_child_process62.spawn)(
|
|
@@ -131024,7 +131193,7 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
|
|
|
131024
131193
|
}
|
|
131025
131194
|
);
|
|
131026
131195
|
} finally {
|
|
131027
|
-
|
|
131196
|
+
import_node_fs153.default.closeSync(bridgeLogFd);
|
|
131028
131197
|
}
|
|
131029
131198
|
if (resources) {
|
|
131030
131199
|
resources.bridge = child;
|
|
@@ -131066,7 +131235,7 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
|
|
|
131066
131235
|
await sleep2(Math.max(0, Math.min(150, deadline - Date.now())));
|
|
131067
131236
|
}
|
|
131068
131237
|
const reason = childExit ? `peach bridge exited before becoming ready (exit ${childExit})` : `peach bridge did not start within ${Math.round(OPEN_BRIDGE_SPAWN_TIMEOUT_MS / 1e3)}s`;
|
|
131069
|
-
const bridgeLog =
|
|
131238
|
+
const bridgeLog = import_node_fs153.default.readFileSync(bridgeLogPath, "utf8").trim().slice(-2e3);
|
|
131070
131239
|
throw new Error(
|
|
131071
131240
|
`${reason}${bridgeLog ? `
|
|
131072
131241
|
${bridgeLog}` : ""}
|
|
@@ -131078,8 +131247,8 @@ async function retireOutdatedIdleBridge(lock) {
|
|
|
131078
131247
|
const current2 = getCliVersion();
|
|
131079
131248
|
if (isSootsimDevCheckout() || lock.cliVersion === current2) return;
|
|
131080
131249
|
if (lock.cliVersion && compareSemver(current2, lock.cliVersion) <= 0) return;
|
|
131081
|
-
const appRecord =
|
|
131082
|
-
if (
|
|
131250
|
+
const appRecord = import_node_path155.default.join(rnxHomeDir(), "app-runtime.json");
|
|
131251
|
+
if (import_node_fs153.default.existsSync(appRecord)) return;
|
|
131083
131252
|
const bridge = createBridge(lock.bridgePort, { commandTimeoutMs: 2e3 });
|
|
131084
131253
|
const simCount = await bridge.listSims({ includeRetained: true }).then(
|
|
131085
131254
|
(sims) => sims.length,
|
|
@@ -131105,31 +131274,31 @@ function isolateHomeForExplicitPort(preferredPort, explicitPort, lock) {
|
|
|
131105
131274
|
return;
|
|
131106
131275
|
}
|
|
131107
131276
|
const sharedRuntimes = runtimesDir();
|
|
131108
|
-
const home =
|
|
131277
|
+
const home = import_node_path155.default.join(rnxHomeDir(), "port-homes", String(preferredPort));
|
|
131109
131278
|
activatePeachHome(home);
|
|
131110
|
-
const runtimes =
|
|
131279
|
+
const runtimes = import_node_path155.default.join(home, "runtimes");
|
|
131111
131280
|
if (resolveDevCheckoutRuntimeRoot()) {
|
|
131112
131281
|
removePortHomeSharedRuntimesLink(runtimes, sharedRuntimes);
|
|
131113
|
-
} else if (
|
|
131114
|
-
|
|
131282
|
+
} else if (import_node_fs153.default.existsSync(sharedRuntimes) && !import_node_fs153.default.existsSync(runtimes)) {
|
|
131283
|
+
import_node_fs153.default.symlinkSync(sharedRuntimes, runtimes);
|
|
131115
131284
|
}
|
|
131116
131285
|
process.env[PEACH_HOME_ENV] = home;
|
|
131117
131286
|
}
|
|
131118
131287
|
function removePortHomeSharedRuntimesLink(runtimes, sharedRuntimes) {
|
|
131119
131288
|
let stat2;
|
|
131120
131289
|
try {
|
|
131121
|
-
stat2 =
|
|
131290
|
+
stat2 = import_node_fs153.default.lstatSync(runtimes);
|
|
131122
131291
|
} catch {
|
|
131123
131292
|
return;
|
|
131124
131293
|
}
|
|
131125
131294
|
if (!stat2.isSymbolicLink()) return;
|
|
131126
131295
|
let target;
|
|
131127
131296
|
try {
|
|
131128
|
-
target =
|
|
131297
|
+
target = import_node_path155.default.resolve(import_node_path155.default.dirname(runtimes), import_node_fs153.default.readlinkSync(runtimes));
|
|
131129
131298
|
} catch {
|
|
131130
131299
|
return;
|
|
131131
131300
|
}
|
|
131132
|
-
if (target === sharedRuntimes)
|
|
131301
|
+
if (target === sharedRuntimes) import_node_fs153.default.unlinkSync(runtimes);
|
|
131133
131302
|
}
|
|
131134
131303
|
async function ensureRuntimeForOpen() {
|
|
131135
131304
|
if (resolveDevCheckoutRuntimeRoot()) return;
|
|
@@ -131139,12 +131308,12 @@ async function ensureRuntimeForOpen() {
|
|
|
131139
131308
|
);
|
|
131140
131309
|
}
|
|
131141
131310
|
const active = readActiveRuntime();
|
|
131142
|
-
if (active &&
|
|
131311
|
+
if (active && import_node_fs153.default.existsSync(import_node_path155.default.join(runtimeDir(active), "index.html"))) {
|
|
131143
131312
|
await ensureCliCompanion(runtimeDir(active));
|
|
131144
131313
|
return;
|
|
131145
131314
|
}
|
|
131146
131315
|
const directory2 = runtimesDir();
|
|
131147
|
-
if (
|
|
131316
|
+
if (import_node_fs153.default.existsSync(directory2) && import_node_fs153.default.readdirSync(directory2).length > 0) {
|
|
131148
131317
|
throw new Error(
|
|
131149
131318
|
"peach open: runtime staging or selection is incomplete. finish staging and select the runtime with peach runtime use <version> before opening."
|
|
131150
131319
|
);
|
|
@@ -131230,11 +131399,11 @@ async function readSimDevice(bridge, simId) {
|
|
|
131230
131399
|
}
|
|
131231
131400
|
function prebuiltBundleFile(target) {
|
|
131232
131401
|
if (!/\.(js|bundle|jsbundle)$/i.test(target)) return null;
|
|
131233
|
-
const file =
|
|
131234
|
-
return
|
|
131402
|
+
const file = import_node_path155.default.resolve(process.cwd(), target);
|
|
131403
|
+
return import_node_fs153.default.statSync(file, { throwIfNoEntry: false })?.isFile() ? file : null;
|
|
131235
131404
|
}
|
|
131236
131405
|
async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
|
|
131237
|
-
const bytes =
|
|
131406
|
+
const bytes = import_node_fs153.default.readFileSync(file);
|
|
131238
131407
|
const source = bytes.toString("utf8");
|
|
131239
131408
|
const mode = await detectBundleModeFromText(source);
|
|
131240
131409
|
if (!mode) {
|
|
@@ -131252,7 +131421,7 @@ async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
|
|
|
131252
131421
|
stageHostBytes(
|
|
131253
131422
|
prepared === source ? bytes : Buffer.from(prepared, "utf8"),
|
|
131254
131423
|
`http://127.0.0.1:${bridgePort}`,
|
|
131255
|
-
|
|
131424
|
+
import_node_path155.default.extname(file)
|
|
131256
131425
|
)
|
|
131257
131426
|
);
|
|
131258
131427
|
url.searchParams.set("dev", String(mode === "development"));
|
|
@@ -131260,10 +131429,10 @@ async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
|
|
|
131260
131429
|
}
|
|
131261
131430
|
function normalizeReplacementPath(filePath) {
|
|
131262
131431
|
if (filePath.startsWith("~/")) {
|
|
131263
|
-
return
|
|
131432
|
+
return import_node_path155.default.join(import_node_os27.default.homedir(), filePath.slice(2));
|
|
131264
131433
|
}
|
|
131265
|
-
if (
|
|
131266
|
-
return
|
|
131434
|
+
if (import_node_path155.default.isAbsolute(filePath)) return filePath;
|
|
131435
|
+
return import_node_path155.default.resolve(process.cwd(), filePath);
|
|
131267
131436
|
}
|
|
131268
131437
|
function parseOpenRuntimeConfig(args) {
|
|
131269
131438
|
const modules = {};
|
|
@@ -131282,7 +131451,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
131282
131451
|
}
|
|
131283
131452
|
const moduleName2 = raw2.slice(0, eqIndex).trim();
|
|
131284
131453
|
const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
|
|
131285
|
-
if (!
|
|
131454
|
+
if (!import_node_fs153.default.existsSync(filePath)) {
|
|
131286
131455
|
console.error(` peach open: replacement file not found: ${filePath}`);
|
|
131287
131456
|
peachExit(1);
|
|
131288
131457
|
}
|
|
@@ -131308,7 +131477,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
131308
131477
|
return config.modules || config.network ? config : void 0;
|
|
131309
131478
|
}
|
|
131310
131479
|
async function ensureConfiguredRuntime(version2) {
|
|
131311
|
-
if (
|
|
131480
|
+
if (import_node_fs153.default.existsSync(import_node_path155.default.join(runtimeDir(version2), "index.html"))) return;
|
|
131312
131481
|
console.error(` installing configured engine runtime ${version2}...`);
|
|
131313
131482
|
const result = await rnxRuntime.install({
|
|
131314
131483
|
version: version2,
|
|
@@ -131388,7 +131557,7 @@ async function waitForSimMatchOrHostExit(wsPort, commandTimeoutMs, predicate, ho
|
|
|
131388
131557
|
const watchHost = !!hostPid && Number.isInteger(hostPid) && hostPid > 1;
|
|
131389
131558
|
const hostExited = () => watchHost && hostPid !== void 0 && !isProcessRunning(hostPid);
|
|
131390
131559
|
if (opts.admittedFile && watchHost) {
|
|
131391
|
-
while (!
|
|
131560
|
+
while (!import_node_fs153.default.existsSync(opts.admittedFile)) {
|
|
131392
131561
|
opts.signal?.throwIfAborted();
|
|
131393
131562
|
if (hostExited()) return { kind: "host-exit" };
|
|
131394
131563
|
await sleep2(intervalMs);
|
|
@@ -131448,7 +131617,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
131448
131617
|
function signalDriverLaunchConnected(result) {
|
|
131449
131618
|
if (!result.connectAckFile) return false;
|
|
131450
131619
|
try {
|
|
131451
|
-
|
|
131620
|
+
import_node_fs153.default.writeFileSync(
|
|
131452
131621
|
result.connectAckFile,
|
|
131453
131622
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
131454
131623
|
`,
|
|
@@ -131462,7 +131631,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
131462
131631
|
function readUnservedUrl(result) {
|
|
131463
131632
|
if (!result.diagnosticLogPath) return null;
|
|
131464
131633
|
try {
|
|
131465
|
-
const detail =
|
|
131634
|
+
const detail = import_node_fs153.default.readFileSync(result.diagnosticLogPath, "utf8");
|
|
131466
131635
|
const match = detail.match(/\[unserved\] nothing serves (\S+)/);
|
|
131467
131636
|
return match ? match[1] : null;
|
|
131468
131637
|
} catch {
|
|
@@ -131472,14 +131641,14 @@ function readUnservedUrl(result) {
|
|
|
131472
131641
|
function printDriverDiagnosticLogTail(result) {
|
|
131473
131642
|
if (!result.diagnosticLogPath) return;
|
|
131474
131643
|
try {
|
|
131475
|
-
const detail =
|
|
131644
|
+
const detail = import_node_fs153.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
131476
131645
|
if (!detail) {
|
|
131477
|
-
console.error(` ${
|
|
131646
|
+
console.error(` ${import_node_path155.default.basename(result.diagnosticLogPath)} was empty`);
|
|
131478
131647
|
return;
|
|
131479
131648
|
}
|
|
131480
131649
|
const shown = detail.length > 4e3 ? `\u2026
|
|
131481
131650
|
${detail.slice(-4e3)}` : detail;
|
|
131482
|
-
console.error(` ${
|
|
131651
|
+
console.error(` ${import_node_path155.default.basename(result.diagnosticLogPath)}:`);
|
|
131483
131652
|
console.error(shown);
|
|
131484
131653
|
if (/No usable sandbox/i.test(detail)) {
|
|
131485
131654
|
console.error(
|
|
@@ -131489,7 +131658,7 @@ ${detail.slice(-4e3)}` : detail;
|
|
|
131489
131658
|
} catch (err) {
|
|
131490
131659
|
const message = err instanceof Error ? err.message : String(err);
|
|
131491
131660
|
console.error(
|
|
131492
|
-
` failed to read ${
|
|
131661
|
+
` failed to read ${import_node_path155.default.basename(result.diagnosticLogPath)}: ${message}`
|
|
131493
131662
|
);
|
|
131494
131663
|
}
|
|
131495
131664
|
}
|
|
@@ -131504,7 +131673,7 @@ async function waitForProcessExit(pid, timeoutMs = 2500) {
|
|
|
131504
131673
|
function isPlaywrightHostProcess(pid) {
|
|
131505
131674
|
if (process.platform === "linux") {
|
|
131506
131675
|
try {
|
|
131507
|
-
return
|
|
131676
|
+
return import_node_fs153.default.readFileSync(`/proc/${pid}/environ`, "utf8").split("\0").some((entry) => entry.startsWith("SOOTSIM_PW_URL="));
|
|
131508
131677
|
} catch {
|
|
131509
131678
|
return false;
|
|
131510
131679
|
}
|
|
@@ -131719,6 +131888,18 @@ async function dispatchAppLink(parsed, liveSettings = {}) {
|
|
|
131719
131888
|
}
|
|
131720
131889
|
}
|
|
131721
131890
|
async function runOpenCommand(args, opts = {}) {
|
|
131891
|
+
const { STREAM_FLAG: STREAM_FLAG2, runStreamCommand: runStreamCommand2 } = await Promise.resolve().then(() => (init_stream(), stream_exports));
|
|
131892
|
+
if (args.includes(STREAM_FLAG2)) {
|
|
131893
|
+
const { authHeaderOrExit: authHeaderOrExit2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
131894
|
+
authHeaderOrExit2("stream");
|
|
131895
|
+
const opened = await runOpenCommand(
|
|
131896
|
+
args.filter((arg) => arg !== STREAM_FLAG2),
|
|
131897
|
+
opts
|
|
131898
|
+
);
|
|
131899
|
+
if (opened)
|
|
131900
|
+
await runStreamCommand2(["start", "--sim", opened.simId], { port: opts.port });
|
|
131901
|
+
return opened;
|
|
131902
|
+
}
|
|
131722
131903
|
if (!args.includes("--json")) return openSim(args, opts);
|
|
131723
131904
|
const log = console.log;
|
|
131724
131905
|
console.log = console.error;
|
|
@@ -132805,18 +132986,18 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
132805
132986
|
bridge.close();
|
|
132806
132987
|
}
|
|
132807
132988
|
}
|
|
132808
|
-
var import_node_child_process62,
|
|
132989
|
+
var import_node_child_process62, import_node_fs153, import_node_http5, import_node_https2, import_node_net, import_node_os27, import_node_path155, import_ws7, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, OPEN_BRIDGE_RUNTIME_TIMEOUT_MS, OPEN_BRIDGE_HEALTH_TIMEOUT_MS, OPEN_BRIDGE_SILENCE_MS, LIVE_BRIDGE_HANDSHAKE_TIMEOUT_MS;
|
|
132809
132990
|
var init_control = __esm({
|
|
132810
132991
|
"cli/commands/control.ts"() {
|
|
132811
132992
|
"use strict";
|
|
132812
132993
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
132813
132994
|
import_node_child_process62 = require("node:child_process");
|
|
132814
|
-
|
|
132995
|
+
import_node_fs153 = __toESM(require("node:fs"), 1);
|
|
132815
132996
|
import_node_http5 = __toESM(require("node:http"), 1);
|
|
132816
132997
|
import_node_https2 = __toESM(require("node:https"), 1);
|
|
132817
132998
|
import_node_net = __toESM(require("node:net"), 1);
|
|
132818
132999
|
import_node_os27 = __toESM(require("node:os"), 1);
|
|
132819
|
-
|
|
133000
|
+
import_node_path155 = __toESM(require("node:path"), 1);
|
|
132820
133001
|
init_src();
|
|
132821
133002
|
import_ws7 = require("ws");
|
|
132822
133003
|
init_agent_identity();
|