peachsim 0.1.714 → 0.1.716
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/commands/install-desktop.ts +74 -20
- package/cli/desktop-companion.ts +11 -6
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +71 -25
- 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 +1 -1
- 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 +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/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/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.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 +82 -31
- package/dist-lib/swift-compile.cjs +56 -21
- package/dist-lib/swift-compile.mjs +56 -21
- package/dist-lib/swift-package.cjs +27 -5
- package/dist-lib/swift-package.mjs +26 -5
- 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 +63 -21
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/swift-compile.ts +43 -20
- package/src/swift-host.ts +9 -0
- package/src/swift-package.ts +42 -5
- package/src/swift-submit.ts +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
4
|
import { execFile as execFile2 } from "node:child_process";
|
|
@@ -152,7 +152,15 @@ function icuSegment(object) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/swift-package.ts
|
|
155
|
-
function
|
|
155
|
+
function swiftImplicitResourcePaths(paths) {
|
|
156
|
+
return paths.filter(
|
|
157
|
+
(file) => !file.endsWith(".swift") && (/\.(xcassets|xcstrings|nib|xib|storyboard|xcdatamodeld|xcdatamodel|xcmappingmodel|metal|xcprivacy)(?:\/|$)/.test(
|
|
158
|
+
file
|
|
159
|
+
) || /(?:^|\/)[^/]+\.lproj\/[^/]+$/.test(file))
|
|
160
|
+
).sort();
|
|
161
|
+
}
|
|
162
|
+
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
163
|
+
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
156
164
|
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
|
157
165
|
const targets = [];
|
|
158
166
|
const pattern = /\.(executableTarget|target)\s*\(/g;
|
|
@@ -195,7 +203,19 @@ function swiftManifestTargets(manifest) {
|
|
|
195
203
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
196
204
|
);
|
|
197
205
|
const mainActorIsolation = /\.defaultIsolation\(\s*MainActor\.self\s*\)/.test(call);
|
|
198
|
-
const
|
|
206
|
+
const excluded = [
|
|
207
|
+
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
208
|
+
].map((match2) => match2[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
209
|
+
const prefix = targetPath === "." ? "" : `${targetPath}/`;
|
|
210
|
+
const resources = /\bresources\s*:/.test(flat) || implicitResources.some((file) => {
|
|
211
|
+
if (!file.startsWith(prefix)) return false;
|
|
212
|
+
const relative = file.slice(prefix.length);
|
|
213
|
+
if (excluded.some(
|
|
214
|
+
(exclude) => relative === exclude || relative.startsWith(`${exclude}/`)
|
|
215
|
+
))
|
|
216
|
+
return false;
|
|
217
|
+
return true;
|
|
218
|
+
});
|
|
199
219
|
targets.push({
|
|
200
220
|
name,
|
|
201
221
|
path: targetPath,
|
|
@@ -207,8 +227,8 @@ function swiftManifestTargets(manifest) {
|
|
|
207
227
|
}
|
|
208
228
|
return targets;
|
|
209
229
|
}
|
|
210
|
-
function swiftPackagePartition(manifest) {
|
|
211
|
-
const targets = swiftManifestTargets(manifest);
|
|
230
|
+
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
231
|
+
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
212
232
|
return targets.length === 1 && targets[0].executable && targets[0].path === "." ? [] : targets;
|
|
213
233
|
}
|
|
214
234
|
|
|
@@ -310,7 +330,7 @@ function swiftModuleDigest(root) {
|
|
|
310
330
|
}
|
|
311
331
|
function compileTargets(input) {
|
|
312
332
|
const manifest = input.files["Package.swift"];
|
|
313
|
-
return manifest === void 0 ? [] : swiftPackagePartition(manifest);
|
|
333
|
+
return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
|
|
314
334
|
}
|
|
315
335
|
function withNativeSourceGlue(input, glue) {
|
|
316
336
|
const targets = compileTargets(input);
|
|
@@ -375,7 +395,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
375
395
|
var MULTI_MANIFEST_VERSION = 10;
|
|
376
396
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
377
397
|
const hash = createHash2("sha256");
|
|
378
|
-
hash.update(`swift-compile/
|
|
398
|
+
hash.update(`swift-compile/v13
|
|
379
399
|
${release}
|
|
380
400
|
`);
|
|
381
401
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -397,6 +417,10 @@ ${release}
|
|
|
397
417
|
hash.update(createHash2("sha256").update(image.file).digest());
|
|
398
418
|
hash.update(createHash2("sha256").update(image.data).digest());
|
|
399
419
|
}
|
|
420
|
+
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
421
|
+
hash.update("resource-path\n");
|
|
422
|
+
hash.update(createHash2("sha256").update(file).digest());
|
|
423
|
+
}
|
|
400
424
|
const targets = compileTargets(input);
|
|
401
425
|
if (targets.length > 0) {
|
|
402
426
|
hash.update(`swift-multi/v${MULTI_MANIFEST_VERSION}
|
|
@@ -865,6 +889,10 @@ function prepareSwiftDependency(source, destination) {
|
|
|
865
889
|
copy(source, destination, true);
|
|
866
890
|
}
|
|
867
891
|
function writeSwiftProject(layout, input, moduleRoot) {
|
|
892
|
+
const resourceTargets = swiftManifestTargets(
|
|
893
|
+
input.files["Package.swift"] ?? "",
|
|
894
|
+
input.resourcePaths
|
|
895
|
+
);
|
|
868
896
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
869
897
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
870
898
|
{
|
|
@@ -883,8 +911,14 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
883
911
|
if (!distribution) {
|
|
884
912
|
modulePlan.update(readFileSync2(path2.join(moduleRoot, "Package.swift")));
|
|
885
913
|
}
|
|
914
|
+
const resourcePlan = createHash2("sha256").update(
|
|
915
|
+
JSON.stringify(
|
|
916
|
+
resourceTargets.filter((target) => target.resources).map((target) => [target.name, target.path])
|
|
917
|
+
)
|
|
918
|
+
).digest("hex").slice(0, 16);
|
|
886
919
|
const moduleFiles = `
|
|
887
920
|
// sootsim-swift files ${modulePlan.digest("hex").slice(0, 16)}
|
|
921
|
+
// resource accessors ${resourcePlan}
|
|
888
922
|
`;
|
|
889
923
|
if (targets.length === 0) {
|
|
890
924
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
@@ -937,20 +971,6 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
937
971
|
if (file === "Package.swift") continue;
|
|
938
972
|
files.set(path2.join(base, file), compiledSource(file, contents));
|
|
939
973
|
}
|
|
940
|
-
for (const target of targets) {
|
|
941
|
-
if (!target.resources) continue;
|
|
942
|
-
files.set(
|
|
943
|
-
path2.join(layout.root, target.path, "ResourceBundleAccessor.generated.swift"),
|
|
944
|
-
[
|
|
945
|
-
"import Foundation",
|
|
946
|
-
"",
|
|
947
|
-
"extension Foundation.Bundle {",
|
|
948
|
-
" static let module: Bundle = Bundle.main",
|
|
949
|
-
"}",
|
|
950
|
-
""
|
|
951
|
-
].join("\n")
|
|
952
|
-
);
|
|
953
|
-
}
|
|
954
974
|
files.set(
|
|
955
975
|
path2.join(layout.root, "Package.swift"),
|
|
956
976
|
emitSwiftPackageManifest({
|
|
@@ -966,6 +986,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
966
986
|
}) + moduleFiles
|
|
967
987
|
);
|
|
968
988
|
}
|
|
989
|
+
for (const target of resourceTargets) {
|
|
990
|
+
if (!target.resources) continue;
|
|
991
|
+
const directory = layout.multi ? path2.join(layout.root, target.path) : layout.sources;
|
|
992
|
+
files.set(
|
|
993
|
+
path2.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
994
|
+
[
|
|
995
|
+
"import Foundation",
|
|
996
|
+
"",
|
|
997
|
+
"extension Foundation.Bundle {",
|
|
998
|
+
" static let module: Bundle = Bundle.main",
|
|
999
|
+
"}",
|
|
1000
|
+
""
|
|
1001
|
+
].join("\n")
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
969
1004
|
syncSwiftTree(layout.root, files);
|
|
970
1005
|
}
|
|
971
1006
|
function streamText(value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -23,6 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var swift_package_exports = {};
|
|
24
24
|
__export(swift_package_exports, {
|
|
25
25
|
isSwiftManifestFile: () => isSwiftManifestFile,
|
|
26
|
+
swiftImplicitResourcePaths: () => swiftImplicitResourcePaths,
|
|
26
27
|
swiftManifestTargets: () => swiftManifestTargets,
|
|
27
28
|
swiftPackagePartition: () => swiftPackagePartition
|
|
28
29
|
});
|
|
@@ -31,7 +32,15 @@ function isSwiftManifestFile(file) {
|
|
|
31
32
|
const segments = file.split("/");
|
|
32
33
|
return segments[segments.length - 1] === "Package.swift";
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function swiftImplicitResourcePaths(paths) {
|
|
36
|
+
return paths.filter(
|
|
37
|
+
(file) => !file.endsWith(".swift") && (/\.(xcassets|xcstrings|nib|xib|storyboard|xcdatamodeld|xcdatamodel|xcmappingmodel|metal|xcprivacy)(?:\/|$)/.test(
|
|
38
|
+
file
|
|
39
|
+
) || /(?:^|\/)[^/]+\.lproj\/[^/]+$/.test(file))
|
|
40
|
+
).sort();
|
|
41
|
+
}
|
|
42
|
+
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
43
|
+
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
35
44
|
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
|
36
45
|
const targets = [];
|
|
37
46
|
const pattern = /\.(executableTarget|target)\s*\(/g;
|
|
@@ -74,7 +83,19 @@ function swiftManifestTargets(manifest) {
|
|
|
74
83
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
75
84
|
);
|
|
76
85
|
const mainActorIsolation = /\.defaultIsolation\(\s*MainActor\.self\s*\)/.test(call);
|
|
77
|
-
const
|
|
86
|
+
const excluded = [
|
|
87
|
+
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
88
|
+
].map((match2) => match2[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
89
|
+
const prefix = targetPath === "." ? "" : `${targetPath}/`;
|
|
90
|
+
const resources = /\bresources\s*:/.test(flat) || implicitResources.some((file) => {
|
|
91
|
+
if (!file.startsWith(prefix)) return false;
|
|
92
|
+
const relative = file.slice(prefix.length);
|
|
93
|
+
if (excluded.some(
|
|
94
|
+
(exclude) => relative === exclude || relative.startsWith(`${exclude}/`)
|
|
95
|
+
))
|
|
96
|
+
return false;
|
|
97
|
+
return true;
|
|
98
|
+
});
|
|
78
99
|
targets.push({
|
|
79
100
|
name,
|
|
80
101
|
path: targetPath,
|
|
@@ -86,13 +107,14 @@ function swiftManifestTargets(manifest) {
|
|
|
86
107
|
}
|
|
87
108
|
return targets;
|
|
88
109
|
}
|
|
89
|
-
function swiftPackagePartition(manifest) {
|
|
90
|
-
const targets = swiftManifestTargets(manifest);
|
|
110
|
+
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
111
|
+
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
91
112
|
return targets.length === 1 && targets[0].executable && targets[0].path === "." ? [] : targets;
|
|
92
113
|
}
|
|
93
114
|
// Annotate the CommonJS export names for ESM import in node:
|
|
94
115
|
0 && (module.exports = {
|
|
95
116
|
isSwiftManifestFile,
|
|
117
|
+
swiftImplicitResourcePaths,
|
|
96
118
|
swiftManifestTargets,
|
|
97
119
|
swiftPackagePartition
|
|
98
120
|
});
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-package.ts
|
|
4
4
|
function isSwiftManifestFile(file) {
|
|
5
5
|
const segments = file.split("/");
|
|
6
6
|
return segments[segments.length - 1] === "Package.swift";
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function swiftImplicitResourcePaths(paths) {
|
|
9
|
+
return paths.filter(
|
|
10
|
+
(file) => !file.endsWith(".swift") && (/\.(xcassets|xcstrings|nib|xib|storyboard|xcdatamodeld|xcdatamodel|xcmappingmodel|metal|xcprivacy)(?:\/|$)/.test(
|
|
11
|
+
file
|
|
12
|
+
) || /(?:^|\/)[^/]+\.lproj\/[^/]+$/.test(file))
|
|
13
|
+
).sort();
|
|
14
|
+
}
|
|
15
|
+
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
16
|
+
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
9
17
|
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
|
10
18
|
const targets = [];
|
|
11
19
|
const pattern = /\.(executableTarget|target)\s*\(/g;
|
|
@@ -48,7 +56,19 @@ function swiftManifestTargets(manifest) {
|
|
|
48
56
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
49
57
|
);
|
|
50
58
|
const mainActorIsolation = /\.defaultIsolation\(\s*MainActor\.self\s*\)/.test(call);
|
|
51
|
-
const
|
|
59
|
+
const excluded = [
|
|
60
|
+
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
61
|
+
].map((match2) => match2[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
62
|
+
const prefix = targetPath === "." ? "" : `${targetPath}/`;
|
|
63
|
+
const resources = /\bresources\s*:/.test(flat) || implicitResources.some((file) => {
|
|
64
|
+
if (!file.startsWith(prefix)) return false;
|
|
65
|
+
const relative = file.slice(prefix.length);
|
|
66
|
+
if (excluded.some(
|
|
67
|
+
(exclude) => relative === exclude || relative.startsWith(`${exclude}/`)
|
|
68
|
+
))
|
|
69
|
+
return false;
|
|
70
|
+
return true;
|
|
71
|
+
});
|
|
52
72
|
targets.push({
|
|
53
73
|
name,
|
|
54
74
|
path: targetPath,
|
|
@@ -60,12 +80,13 @@ function swiftManifestTargets(manifest) {
|
|
|
60
80
|
}
|
|
61
81
|
return targets;
|
|
62
82
|
}
|
|
63
|
-
function swiftPackagePartition(manifest) {
|
|
64
|
-
const targets = swiftManifestTargets(manifest);
|
|
83
|
+
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
84
|
+
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
65
85
|
return targets.length === 1 && targets[0].executable && targets[0].path === "." ? [] : targets;
|
|
66
86
|
}
|
|
67
87
|
export {
|
|
68
88
|
isSwiftManifestFile,
|
|
89
|
+
swiftImplicitResourcePaths,
|
|
69
90
|
swiftManifestTargets,
|
|
70
91
|
swiftPackagePartition
|
|
71
92
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -244,7 +244,15 @@ function icuSegment(object) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
// src/swift-package.ts
|
|
247
|
-
function
|
|
247
|
+
function swiftImplicitResourcePaths(paths) {
|
|
248
|
+
return paths.filter(
|
|
249
|
+
(file) => !file.endsWith(".swift") && (/\.(xcassets|xcstrings|nib|xib|storyboard|xcdatamodeld|xcdatamodel|xcmappingmodel|metal|xcprivacy)(?:\/|$)/.test(
|
|
250
|
+
file
|
|
251
|
+
) || /(?:^|\/)[^/]+\.lproj\/[^/]+$/.test(file))
|
|
252
|
+
).sort();
|
|
253
|
+
}
|
|
254
|
+
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
255
|
+
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
248
256
|
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
|
249
257
|
const targets = [];
|
|
250
258
|
const pattern = /\.(executableTarget|target)\s*\(/g;
|
|
@@ -287,7 +295,19 @@ function swiftManifestTargets(manifest) {
|
|
|
287
295
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
288
296
|
);
|
|
289
297
|
const mainActorIsolation = /\.defaultIsolation\(\s*MainActor\.self\s*\)/.test(call);
|
|
290
|
-
const
|
|
298
|
+
const excluded = [
|
|
299
|
+
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
300
|
+
].map((match2) => match2[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
301
|
+
const prefix = targetPath === "." ? "" : `${targetPath}/`;
|
|
302
|
+
const resources = /\bresources\s*:/.test(flat) || implicitResources.some((file) => {
|
|
303
|
+
if (!file.startsWith(prefix)) return false;
|
|
304
|
+
const relative = file.slice(prefix.length);
|
|
305
|
+
if (excluded.some(
|
|
306
|
+
(exclude) => relative === exclude || relative.startsWith(`${exclude}/`)
|
|
307
|
+
))
|
|
308
|
+
return false;
|
|
309
|
+
return true;
|
|
310
|
+
});
|
|
291
311
|
targets.push({
|
|
292
312
|
name,
|
|
293
313
|
path: targetPath,
|
|
@@ -299,8 +319,8 @@ function swiftManifestTargets(manifest) {
|
|
|
299
319
|
}
|
|
300
320
|
return targets;
|
|
301
321
|
}
|
|
302
|
-
function swiftPackagePartition(manifest) {
|
|
303
|
-
const targets = swiftManifestTargets(manifest);
|
|
322
|
+
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
323
|
+
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
304
324
|
return targets.length === 1 && targets[0].executable && targets[0].path === "." ? [] : targets;
|
|
305
325
|
}
|
|
306
326
|
|
|
@@ -398,7 +418,7 @@ function swiftModuleDigest(root) {
|
|
|
398
418
|
}
|
|
399
419
|
function compileTargets(input) {
|
|
400
420
|
const manifest = input.files["Package.swift"];
|
|
401
|
-
return manifest === void 0 ? [] : swiftPackagePartition(manifest);
|
|
421
|
+
return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
|
|
402
422
|
}
|
|
403
423
|
function withNativeSourceGlue(input, glue) {
|
|
404
424
|
const targets = compileTargets(input);
|
|
@@ -463,7 +483,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
463
483
|
var MULTI_MANIFEST_VERSION = 10;
|
|
464
484
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
465
485
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
466
|
-
hash.update(`swift-compile/
|
|
486
|
+
hash.update(`swift-compile/v13
|
|
467
487
|
${release}
|
|
468
488
|
`);
|
|
469
489
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -485,6 +505,10 @@ ${release}
|
|
|
485
505
|
hash.update((0, import_node_crypto2.createHash)("sha256").update(image.file).digest());
|
|
486
506
|
hash.update((0, import_node_crypto2.createHash)("sha256").update(image.data).digest());
|
|
487
507
|
}
|
|
508
|
+
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
509
|
+
hash.update("resource-path\n");
|
|
510
|
+
hash.update((0, import_node_crypto2.createHash)("sha256").update(file).digest());
|
|
511
|
+
}
|
|
488
512
|
const targets = compileTargets(input);
|
|
489
513
|
if (targets.length > 0) {
|
|
490
514
|
hash.update(`swift-multi/v${MULTI_MANIFEST_VERSION}
|
|
@@ -936,6 +960,10 @@ function swiftCodeScan(source) {
|
|
|
936
960
|
}
|
|
937
961
|
var compiledSource = (file, contents) => file.endsWith(".swift") ? swiftSourceAsIOS(contents) : contents;
|
|
938
962
|
function writeSwiftProject(layout, input, moduleRoot) {
|
|
963
|
+
const resourceTargets = swiftManifestTargets(
|
|
964
|
+
input.files["Package.swift"] ?? "",
|
|
965
|
+
input.resourcePaths
|
|
966
|
+
);
|
|
939
967
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
940
968
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
941
969
|
{
|
|
@@ -954,8 +982,14 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
954
982
|
if (!distribution) {
|
|
955
983
|
modulePlan.update((0, import_node_fs2.readFileSync)(import_node_path2.default.join(moduleRoot, "Package.swift")));
|
|
956
984
|
}
|
|
985
|
+
const resourcePlan = (0, import_node_crypto2.createHash)("sha256").update(
|
|
986
|
+
JSON.stringify(
|
|
987
|
+
resourceTargets.filter((target) => target.resources).map((target) => [target.name, target.path])
|
|
988
|
+
)
|
|
989
|
+
).digest("hex").slice(0, 16);
|
|
957
990
|
const moduleFiles = `
|
|
958
991
|
// sootsim-swift files ${modulePlan.digest("hex").slice(0, 16)}
|
|
992
|
+
// resource accessors ${resourcePlan}
|
|
959
993
|
`;
|
|
960
994
|
if (targets.length === 0) {
|
|
961
995
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
@@ -1008,20 +1042,6 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1008
1042
|
if (file === "Package.swift") continue;
|
|
1009
1043
|
files.set(import_node_path2.default.join(base, file), compiledSource(file, contents));
|
|
1010
1044
|
}
|
|
1011
|
-
for (const target of targets) {
|
|
1012
|
-
if (!target.resources) continue;
|
|
1013
|
-
files.set(
|
|
1014
|
-
import_node_path2.default.join(layout.root, target.path, "ResourceBundleAccessor.generated.swift"),
|
|
1015
|
-
[
|
|
1016
|
-
"import Foundation",
|
|
1017
|
-
"",
|
|
1018
|
-
"extension Foundation.Bundle {",
|
|
1019
|
-
" static let module: Bundle = Bundle.main",
|
|
1020
|
-
"}",
|
|
1021
|
-
""
|
|
1022
|
-
].join("\n")
|
|
1023
|
-
);
|
|
1024
|
-
}
|
|
1025
1045
|
files.set(
|
|
1026
1046
|
import_node_path2.default.join(layout.root, "Package.swift"),
|
|
1027
1047
|
emitSwiftPackageManifest({
|
|
@@ -1037,6 +1057,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1037
1057
|
}) + moduleFiles
|
|
1038
1058
|
);
|
|
1039
1059
|
}
|
|
1060
|
+
for (const target of resourceTargets) {
|
|
1061
|
+
if (!target.resources) continue;
|
|
1062
|
+
const directory = layout.multi ? import_node_path2.default.join(layout.root, target.path) : layout.sources;
|
|
1063
|
+
files.set(
|
|
1064
|
+
import_node_path2.default.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
1065
|
+
[
|
|
1066
|
+
"import Foundation",
|
|
1067
|
+
"",
|
|
1068
|
+
"extension Foundation.Bundle {",
|
|
1069
|
+
" static let module: Bundle = Bundle.main",
|
|
1070
|
+
"}",
|
|
1071
|
+
""
|
|
1072
|
+
].join("\n")
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1040
1075
|
syncSwiftTree(layout.root, files);
|
|
1041
1076
|
}
|
|
1042
1077
|
function streamText(value) {
|
|
@@ -2323,6 +2358,11 @@ function packageSnapshot(project) {
|
|
|
2323
2358
|
const native = nativeSourceDescriptor(project.packagePath);
|
|
2324
2359
|
return {
|
|
2325
2360
|
files,
|
|
2361
|
+
resourcePaths: swiftImplicitResourcePaths(
|
|
2362
|
+
resourceCandidateFiles(project.packagePath).map(
|
|
2363
|
+
(file) => import_node_path8.default.relative(project.packagePath, file).split(import_node_path8.default.sep).join(import_node_path8.default.posix.sep)
|
|
2364
|
+
)
|
|
2365
|
+
),
|
|
2326
2366
|
resources: buildSwiftResourceTable(project, ""),
|
|
2327
2367
|
bundleFiles: buildSwiftBundleFiles(project.packagePath),
|
|
2328
2368
|
native,
|
|
@@ -2338,6 +2378,7 @@ function packageSnapshot(project) {
|
|
|
2338
2378
|
function snapshotCompileInput(snapshot, entry) {
|
|
2339
2379
|
const input = {
|
|
2340
2380
|
files: snapshot.files,
|
|
2381
|
+
resourcePaths: snapshot.resourcePaths,
|
|
2341
2382
|
resources: snapshot.bundleFiles.files,
|
|
2342
2383
|
images: snapshot.resources.images,
|
|
2343
2384
|
entry,
|
|
@@ -2416,6 +2457,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
2416
2457
|
submit,
|
|
2417
2458
|
{
|
|
2418
2459
|
files: snapshot.files,
|
|
2460
|
+
resourcePaths: snapshot.resourcePaths,
|
|
2419
2461
|
resources: snapshot.bundleFiles.files,
|
|
2420
2462
|
images: snapshot.resources.images,
|
|
2421
2463
|
entry,
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.716 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/package.json
CHANGED
package/src/swift-compile.ts
CHANGED
|
@@ -44,6 +44,8 @@ const BUILD_JOBS = String(Math.max(1, Math.floor(cores / 2)))
|
|
|
44
44
|
export interface SwiftCompileInput {
|
|
45
45
|
files: Record<string, string>
|
|
46
46
|
resources?: Record<string, string>
|
|
47
|
+
/** project-relative resource paths retained before the bundle namespace flattens. */
|
|
48
|
+
resourcePaths?: string[]
|
|
47
49
|
images?: Record<string, SwiftImageUpload>
|
|
48
50
|
entry: string
|
|
49
51
|
/**
|
|
@@ -207,7 +209,9 @@ export function swiftModuleDigest(root: string): Buffer {
|
|
|
207
209
|
|
|
208
210
|
export function compileTargets(input: SwiftCompileInput): SwiftPackageTarget[] {
|
|
209
211
|
const manifest = input.files['Package.swift']
|
|
210
|
-
return manifest === undefined
|
|
212
|
+
return manifest === undefined
|
|
213
|
+
? []
|
|
214
|
+
: swiftPackagePartition(manifest, input.resourcePaths)
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
/**
|
|
@@ -318,6 +322,7 @@ export function swiftArtifactHash(
|
|
|
318
322
|
moduleRoot: string,
|
|
319
323
|
): string {
|
|
320
324
|
const hash = createHash('sha256')
|
|
325
|
+
// v13: implicit target resources synthesize Bundle.module
|
|
321
326
|
// v12: overrides in an extension of a same-file class lift into the class
|
|
322
327
|
// v10: Foundation-only sources see Dispatch queues
|
|
323
328
|
// v9: table cell and header footer view initializers compile required
|
|
@@ -326,7 +331,7 @@ export function swiftArtifactHash(
|
|
|
326
331
|
// v6: app and scene delegate classes compile final
|
|
327
332
|
// (v5: a target declaring resources gets SwiftPM's Bundle.module accessor;
|
|
328
333
|
// v4: sources compile through swiftSourceAsIOS)
|
|
329
|
-
hash.update(`swift-compile/
|
|
334
|
+
hash.update(`swift-compile/v13\n${release}\n`)
|
|
330
335
|
if (input.oneModule) hash.update('one-module\n')
|
|
331
336
|
hash.update(swiftModuleDigest(moduleRoot))
|
|
332
337
|
for (const file of Object.keys(input.files).sort()) {
|
|
@@ -348,6 +353,10 @@ export function swiftArtifactHash(
|
|
|
348
353
|
hash.update(createHash('sha256').update(image.file).digest())
|
|
349
354
|
hash.update(createHash('sha256').update(image.data).digest())
|
|
350
355
|
}
|
|
356
|
+
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
357
|
+
hash.update('resource-path\n')
|
|
358
|
+
hash.update(createHash('sha256').update(file).digest())
|
|
359
|
+
}
|
|
351
360
|
const targets = compileTargets(input)
|
|
352
361
|
if (targets.length > 0) {
|
|
353
362
|
hash.update(`swift-multi/v${MULTI_MANIFEST_VERSION}\n`)
|
|
@@ -990,6 +999,10 @@ export function writeSwiftProject(
|
|
|
990
999
|
input: SwiftCompileInput,
|
|
991
1000
|
moduleRoot: string,
|
|
992
1001
|
): void {
|
|
1002
|
+
const resourceTargets = swiftManifestTargets(
|
|
1003
|
+
input.files['Package.swift'] ?? '',
|
|
1004
|
+
input.resourcePaths,
|
|
1005
|
+
)
|
|
993
1006
|
const distribution = swiftDistributionAt(moduleRoot)
|
|
994
1007
|
// a distribution ships no manifest template, so a project without its own
|
|
995
1008
|
// manifest compiles as the one App target the template declares
|
|
@@ -1017,7 +1030,17 @@ export function writeSwiftProject(
|
|
|
1017
1030
|
if (!distribution) {
|
|
1018
1031
|
modulePlan.update(readFileSync(path.join(moduleRoot, 'Package.swift')))
|
|
1019
1032
|
}
|
|
1020
|
-
const
|
|
1033
|
+
const resourcePlan = createHash('sha256')
|
|
1034
|
+
.update(
|
|
1035
|
+
JSON.stringify(
|
|
1036
|
+
resourceTargets
|
|
1037
|
+
.filter((target) => target.resources)
|
|
1038
|
+
.map((target) => [target.name, target.path]),
|
|
1039
|
+
),
|
|
1040
|
+
)
|
|
1041
|
+
.digest('hex')
|
|
1042
|
+
.slice(0, 16)
|
|
1043
|
+
const moduleFiles = `\n// sootsim-swift files ${modulePlan.digest('hex').slice(0, 16)}\n// resource accessors ${resourcePlan}\n`
|
|
1021
1044
|
if (targets.length === 0) {
|
|
1022
1045
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
1023
1046
|
if (file === 'Package.swift') continue
|
|
@@ -1072,23 +1095,6 @@ export function writeSwiftProject(
|
|
|
1072
1095
|
if (file === 'Package.swift') continue
|
|
1073
1096
|
files.set(path.join(base, file), compiledSource(file, contents))
|
|
1074
1097
|
}
|
|
1075
|
-
// SwiftPM writes this accessor into a target that declares resources. the
|
|
1076
|
-
// emitted manifest declares none, since Peach serves every target's
|
|
1077
|
-
// resources from the app's one flat bundle, so the accessor names it.
|
|
1078
|
-
for (const target of targets) {
|
|
1079
|
-
if (!target.resources) continue
|
|
1080
|
-
files.set(
|
|
1081
|
-
path.join(layout.root, target.path, 'ResourceBundleAccessor.generated.swift'),
|
|
1082
|
-
[
|
|
1083
|
-
'import Foundation',
|
|
1084
|
-
'',
|
|
1085
|
-
'extension Foundation.Bundle {',
|
|
1086
|
-
' static let module: Bundle = Bundle.main',
|
|
1087
|
-
'}',
|
|
1088
|
-
'',
|
|
1089
|
-
].join('\n'),
|
|
1090
|
-
)
|
|
1091
|
-
}
|
|
1092
1098
|
files.set(
|
|
1093
1099
|
path.join(layout.root, 'Package.swift'),
|
|
1094
1100
|
emitSwiftPackageManifest({
|
|
@@ -1104,6 +1110,23 @@ export function writeSwiftProject(
|
|
|
1104
1110
|
}) + moduleFiles,
|
|
1105
1111
|
)
|
|
1106
1112
|
}
|
|
1113
|
+
// peach serves all target resources from the mount's flat /res bundle.
|
|
1114
|
+
// retain target ownership of the accessor even though its bytes share that bundle.
|
|
1115
|
+
for (const target of resourceTargets) {
|
|
1116
|
+
if (!target.resources) continue
|
|
1117
|
+
const directory = layout.multi ? path.join(layout.root, target.path) : layout.sources
|
|
1118
|
+
files.set(
|
|
1119
|
+
path.join(directory, 'ResourceBundleAccessor.generated.swift'),
|
|
1120
|
+
[
|
|
1121
|
+
'import Foundation',
|
|
1122
|
+
'',
|
|
1123
|
+
'extension Foundation.Bundle {',
|
|
1124
|
+
' static let module: Bundle = Bundle.main',
|
|
1125
|
+
'}',
|
|
1126
|
+
'',
|
|
1127
|
+
].join('\n'),
|
|
1128
|
+
)
|
|
1129
|
+
}
|
|
1107
1130
|
syncSwiftTree(layout.root, files)
|
|
1108
1131
|
}
|
|
1109
1132
|
|
package/src/swift-host.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
swiftModuleInputFiles,
|
|
20
20
|
} from './swift-compile'
|
|
21
21
|
import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
|
|
22
|
+
import { swiftImplicitResourcePaths } from './swift-package'
|
|
22
23
|
import {
|
|
23
24
|
MAX_SWIFT_COMPILE_FILES,
|
|
24
25
|
MAX_SWIFT_COMPILE_SOURCE_BYTES,
|
|
@@ -521,6 +522,7 @@ function packageSources(packagePath: string): Record<string, string> {
|
|
|
521
522
|
|
|
522
523
|
interface SwiftPackageSnapshot {
|
|
523
524
|
files: Record<string, string>
|
|
525
|
+
resourcePaths: string[]
|
|
524
526
|
resources: SwiftResourceTable
|
|
525
527
|
bundleFiles: SwiftBundlePack
|
|
526
528
|
native: SwiftNativeModules | null
|
|
@@ -532,6 +534,11 @@ function packageSnapshot(project: SwiftProject): SwiftPackageSnapshot {
|
|
|
532
534
|
const native = nativeSourceDescriptor(project.packagePath)
|
|
533
535
|
return {
|
|
534
536
|
files,
|
|
537
|
+
resourcePaths: swiftImplicitResourcePaths(
|
|
538
|
+
resourceCandidateFiles(project.packagePath).map((file) =>
|
|
539
|
+
path.relative(project.packagePath, file).split(path.sep).join(path.posix.sep),
|
|
540
|
+
),
|
|
541
|
+
),
|
|
535
542
|
resources: buildSwiftResourceTable(project, ''),
|
|
536
543
|
bundleFiles: buildSwiftBundleFiles(project.packagePath),
|
|
537
544
|
native,
|
|
@@ -553,6 +560,7 @@ function snapshotCompileInput(
|
|
|
553
560
|
): SwiftCompileInput {
|
|
554
561
|
const input: SwiftCompileInput = {
|
|
555
562
|
files: snapshot.files,
|
|
563
|
+
resourcePaths: snapshot.resourcePaths,
|
|
556
564
|
resources: snapshot.bundleFiles.files,
|
|
557
565
|
images: snapshot.resources.images,
|
|
558
566
|
entry,
|
|
@@ -666,6 +674,7 @@ async function compileRemote(
|
|
|
666
674
|
submit,
|
|
667
675
|
{
|
|
668
676
|
files: snapshot.files,
|
|
677
|
+
resourcePaths: snapshot.resourcePaths,
|
|
669
678
|
resources: snapshot.bundleFiles.files,
|
|
670
679
|
images: snapshot.resources.images,
|
|
671
680
|
entry,
|