peachsim 0.1.686 → 0.1.687
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/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 +45 -10
- 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 +46 -11
- package/dist-lib/swift-compile.cjs +45 -10
- package/dist-lib/swift-compile.mjs +45 -10
- 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 +45 -10
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/swift-compile.ts +65 -10
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.687 | (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;
|
|
@@ -21940,14 +21940,18 @@ function withNativeSourceGlue(input, glue) {
|
|
|
21940
21940
|
oneModule: true
|
|
21941
21941
|
};
|
|
21942
21942
|
}
|
|
21943
|
-
function
|
|
21944
|
-
const names = new Set(targets.map((target) => target.name));
|
|
21943
|
+
function swiftTargetDependencies(files, targets) {
|
|
21944
|
+
const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
|
|
21945
21945
|
const siblings = /* @__PURE__ */ new Map();
|
|
21946
21946
|
for (const target of targets) {
|
|
21947
|
-
const prefix = `${target.path}/`;
|
|
21947
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
21948
21948
|
const deps = /* @__PURE__ */ new Set();
|
|
21949
21949
|
for (const [file, contents] of Object.entries(files)) {
|
|
21950
21950
|
if (file === "Package.swift" || !file.startsWith(prefix)) continue;
|
|
21951
|
+
if (targets.some(
|
|
21952
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
21953
|
+
))
|
|
21954
|
+
continue;
|
|
21951
21955
|
for (const match of contents.matchAll(
|
|
21952
21956
|
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
|
|
21953
21957
|
)) {
|
|
@@ -21960,7 +21964,7 @@ function swiftSiblingDependencies(files, targets) {
|
|
|
21960
21964
|
}
|
|
21961
21965
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
21962
21966
|
const hash = (0, import_node_crypto4.createHash)("sha256");
|
|
21963
|
-
hash.update(`swift-compile/
|
|
21967
|
+
hash.update(`swift-compile/v8
|
|
21964
21968
|
${release}
|
|
21965
21969
|
`);
|
|
21966
21970
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -21989,7 +21993,7 @@ ${release}
|
|
|
21989
21993
|
hash.update(
|
|
21990
21994
|
JSON.stringify({
|
|
21991
21995
|
targets,
|
|
21992
|
-
siblings: [...
|
|
21996
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort(
|
|
21993
21997
|
(a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
|
|
21994
21998
|
)
|
|
21995
21999
|
})
|
|
@@ -21999,6 +22003,16 @@ ${release}
|
|
|
21999
22003
|
}
|
|
22000
22004
|
function emitSwiftPackageManifest(args) {
|
|
22001
22005
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
22006
|
+
const reachedFrameworks = new Set(
|
|
22007
|
+
[...siblings.values()].flat().filter(
|
|
22008
|
+
(name2) => OPTIONAL_FRAMEWORKS.has(name2) && !targets.some((target) => target.name === name2)
|
|
22009
|
+
)
|
|
22010
|
+
);
|
|
22011
|
+
const distributionObjects = distribution?.objects.filter(
|
|
22012
|
+
(object) => [...OPTIONAL_FRAMEWORKS].every(
|
|
22013
|
+
(name2) => !object.startsWith(`lib/${name2}-`) || reachedFrameworks.has(name2)
|
|
22014
|
+
)
|
|
22015
|
+
);
|
|
22002
22016
|
const executable = targets.find((target) => target.executable);
|
|
22003
22017
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
22004
22018
|
const stanza = (target) => {
|
|
@@ -22011,10 +22025,12 @@ function emitSwiftPackageManifest(args) {
|
|
|
22011
22025
|
...oneModule ? [ONE_PRODUCT] : [],
|
|
22012
22026
|
...spriteKit ? [SPRITEKIT_PRODUCT] : []
|
|
22013
22027
|
],
|
|
22014
|
-
...(siblings.get(target.name) ?? []).
|
|
22028
|
+
...(siblings.get(target.name) ?? []).flatMap(
|
|
22029
|
+
(dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
22030
|
+
)
|
|
22015
22031
|
].join(", ");
|
|
22016
22032
|
const library = distribution ? [
|
|
22017
|
-
...
|
|
22033
|
+
...(distributionObjects ?? []).map((object) => import_node_path9.default.join(moduleRoot, object)),
|
|
22018
22034
|
...distribution.link
|
|
22019
22035
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
22020
22036
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
@@ -22230,6 +22246,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
22230
22246
|
import_node_path9.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
22231
22247
|
"utf8"
|
|
22232
22248
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
22249
|
+
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
22250
|
+
if (optionalProducts.length > 0) {
|
|
22251
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
22252
|
+
if (!manifest.includes(product))
|
|
22253
|
+
throw new Error("Swift app template lost its framework dependency anchor");
|
|
22254
|
+
manifest = manifest.replace(
|
|
22255
|
+
product,
|
|
22256
|
+
[
|
|
22257
|
+
product,
|
|
22258
|
+
...optionalProducts.map(
|
|
22259
|
+
(name2) => `.product(name: "${name2}", package: "sootsim-swift"),`
|
|
22260
|
+
)
|
|
22261
|
+
].join("\n ")
|
|
22262
|
+
);
|
|
22263
|
+
}
|
|
22233
22264
|
if (input.oneModule) {
|
|
22234
22265
|
const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
|
|
22235
22266
|
const flags = `"-Osize"${OBJC_IMPLICIT_FLAGS}`;
|
|
@@ -22275,7 +22306,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
22275
22306
|
import_node_path9.default.join(layout.root, "Package.swift"),
|
|
22276
22307
|
emitSwiftPackageManifest({
|
|
22277
22308
|
targets,
|
|
22278
|
-
siblings:
|
|
22309
|
+
siblings: swiftTargetDependencies(
|
|
22310
|
+
input.files,
|
|
22311
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
|
|
22312
|
+
),
|
|
22279
22313
|
moduleRoot,
|
|
22280
22314
|
oneModule: input.oneModule,
|
|
22281
22315
|
spriteKit: importsSpriteKit(input.files),
|
|
@@ -22385,7 +22419,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
22385
22419
|
};
|
|
22386
22420
|
});
|
|
22387
22421
|
}
|
|
22388
|
-
var import_node_child_process5, import_node_crypto4, import_node_fs9, import_node_os3, import_node_path9, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, OBJC_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, DELEGATE_CLASS, compiledSource, ROOT_LOCKS, host, rootLocks;
|
|
22422
|
+
var import_node_child_process5, import_node_crypto4, import_node_fs9, import_node_os3, import_node_path9, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORKS, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, OBJC_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, DELEGATE_CLASS, compiledSource, ROOT_LOCKS, host, rootLocks;
|
|
22389
22423
|
var init_swift_compile = __esm({
|
|
22390
22424
|
"src/swift-compile.ts"() {
|
|
22391
22425
|
"use strict";
|
|
@@ -22404,6 +22438,7 @@ var init_swift_compile = __esm({
|
|
|
22404
22438
|
BUILD_ENV = { ...process.env, BINARYEN_CORES: String(Math.min(4, cores)) };
|
|
22405
22439
|
BUILD_JOBS = String(Math.max(1, Math.floor(cores / 2)));
|
|
22406
22440
|
linkedModuleDigests = /* @__PURE__ */ new Map();
|
|
22441
|
+
OPTIONAL_FRAMEWORKS = /* @__PURE__ */ new Set(["CryptoKit", "Security"]);
|
|
22407
22442
|
ONE_PRODUCT = '.product(name: "One", package: "sootsim-swift")';
|
|
22408
22443
|
SPRITEKIT_PRODUCT = '.product(name: "SpriteKit", package: "sootsim-swift")';
|
|
22409
22444
|
importsSpriteKit = (files) => Object.entries(files).some(
|
|
@@ -22413,7 +22448,7 @@ var init_swift_compile = __esm({
|
|
|
22413
22448
|
);
|
|
22414
22449
|
OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC"';
|
|
22415
22450
|
ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
22416
|
-
MULTI_MANIFEST_VERSION =
|
|
22451
|
+
MULTI_MANIFEST_VERSION = 8;
|
|
22417
22452
|
DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
|
|
22418
22453
|
OS_IOS = /\bos\(\s*iOS\s*\)/g;
|
|
22419
22454
|
OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.687 | (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;
|
|
@@ -351,14 +351,19 @@ function withNativeSourceGlue(input, glue) {
|
|
|
351
351
|
oneModule: true
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
var OPTIONAL_FRAMEWORKS = /* @__PURE__ */ new Set(["CryptoKit", "Security"]);
|
|
355
|
+
function swiftTargetDependencies(files, targets) {
|
|
356
|
+
const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
|
|
356
357
|
const siblings = /* @__PURE__ */ new Map();
|
|
357
358
|
for (const target of targets) {
|
|
358
|
-
const prefix = `${target.path}/`;
|
|
359
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
359
360
|
const deps = /* @__PURE__ */ new Set();
|
|
360
361
|
for (const [file, contents] of Object.entries(files)) {
|
|
361
362
|
if (file === "Package.swift" || !file.startsWith(prefix)) continue;
|
|
363
|
+
if (targets.some(
|
|
364
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
365
|
+
))
|
|
366
|
+
continue;
|
|
362
367
|
for (const match of contents.matchAll(
|
|
363
368
|
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
|
|
364
369
|
)) {
|
|
@@ -378,10 +383,10 @@ var importsSpriteKit = (files) => Object.entries(files).some(
|
|
|
378
383
|
);
|
|
379
384
|
var OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC"';
|
|
380
385
|
var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
381
|
-
var MULTI_MANIFEST_VERSION =
|
|
386
|
+
var MULTI_MANIFEST_VERSION = 8;
|
|
382
387
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
383
388
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
384
|
-
hash.update(`swift-compile/
|
|
389
|
+
hash.update(`swift-compile/v8
|
|
385
390
|
${release}
|
|
386
391
|
`);
|
|
387
392
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -410,7 +415,7 @@ ${release}
|
|
|
410
415
|
hash.update(
|
|
411
416
|
JSON.stringify({
|
|
412
417
|
targets,
|
|
413
|
-
siblings: [...
|
|
418
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort(
|
|
414
419
|
(a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
|
|
415
420
|
)
|
|
416
421
|
})
|
|
@@ -420,6 +425,16 @@ ${release}
|
|
|
420
425
|
}
|
|
421
426
|
function emitSwiftPackageManifest(args) {
|
|
422
427
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
428
|
+
const reachedFrameworks = new Set(
|
|
429
|
+
[...siblings.values()].flat().filter(
|
|
430
|
+
(name) => OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name)
|
|
431
|
+
)
|
|
432
|
+
);
|
|
433
|
+
const distributionObjects = distribution?.objects.filter(
|
|
434
|
+
(object) => [...OPTIONAL_FRAMEWORKS].every(
|
|
435
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name)
|
|
436
|
+
)
|
|
437
|
+
);
|
|
423
438
|
const executable = targets.find((target) => target.executable);
|
|
424
439
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
425
440
|
const stanza = (target) => {
|
|
@@ -432,10 +447,12 @@ function emitSwiftPackageManifest(args) {
|
|
|
432
447
|
...oneModule ? [ONE_PRODUCT] : [],
|
|
433
448
|
...spriteKit ? [SPRITEKIT_PRODUCT] : []
|
|
434
449
|
],
|
|
435
|
-
...(siblings.get(target.name) ?? []).
|
|
450
|
+
...(siblings.get(target.name) ?? []).flatMap(
|
|
451
|
+
(dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
452
|
+
)
|
|
436
453
|
].join(", ");
|
|
437
454
|
const library = distribution ? [
|
|
438
|
-
...
|
|
455
|
+
...(distributionObjects ?? []).map((object) => import_node_path2.default.join(moduleRoot, object)),
|
|
439
456
|
...distribution.link
|
|
440
457
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
441
458
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
@@ -657,6 +674,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
657
674
|
import_node_path2.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
658
675
|
"utf8"
|
|
659
676
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
677
|
+
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
678
|
+
if (optionalProducts.length > 0) {
|
|
679
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
680
|
+
if (!manifest.includes(product))
|
|
681
|
+
throw new Error("Swift app template lost its framework dependency anchor");
|
|
682
|
+
manifest = manifest.replace(
|
|
683
|
+
product,
|
|
684
|
+
[
|
|
685
|
+
product,
|
|
686
|
+
...optionalProducts.map(
|
|
687
|
+
(name) => `.product(name: "${name}", package: "sootsim-swift"),`
|
|
688
|
+
)
|
|
689
|
+
].join("\n ")
|
|
690
|
+
);
|
|
691
|
+
}
|
|
660
692
|
if (input.oneModule) {
|
|
661
693
|
const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
|
|
662
694
|
const flags = `"-Osize"${OBJC_IMPLICIT_FLAGS}`;
|
|
@@ -702,7 +734,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
702
734
|
import_node_path2.default.join(layout.root, "Package.swift"),
|
|
703
735
|
emitSwiftPackageManifest({
|
|
704
736
|
targets,
|
|
705
|
-
siblings:
|
|
737
|
+
siblings: swiftTargetDependencies(
|
|
738
|
+
input.files,
|
|
739
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
|
|
740
|
+
),
|
|
706
741
|
moduleRoot,
|
|
707
742
|
oneModule: input.oneModule,
|
|
708
743
|
spriteKit: importsSpriteKit(input.files),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.687 | (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";
|
|
@@ -314,14 +314,19 @@ function withNativeSourceGlue(input, glue) {
|
|
|
314
314
|
oneModule: true
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
var OPTIONAL_FRAMEWORKS = /* @__PURE__ */ new Set(["CryptoKit", "Security"]);
|
|
318
|
+
function swiftTargetDependencies(files, targets) {
|
|
319
|
+
const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
|
|
319
320
|
const siblings = /* @__PURE__ */ new Map();
|
|
320
321
|
for (const target of targets) {
|
|
321
|
-
const prefix = `${target.path}/`;
|
|
322
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
322
323
|
const deps = /* @__PURE__ */ new Set();
|
|
323
324
|
for (const [file, contents] of Object.entries(files)) {
|
|
324
325
|
if (file === "Package.swift" || !file.startsWith(prefix)) continue;
|
|
326
|
+
if (targets.some(
|
|
327
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
328
|
+
))
|
|
329
|
+
continue;
|
|
325
330
|
for (const match of contents.matchAll(
|
|
326
331
|
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
|
|
327
332
|
)) {
|
|
@@ -341,10 +346,10 @@ var importsSpriteKit = (files) => Object.entries(files).some(
|
|
|
341
346
|
);
|
|
342
347
|
var OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC"';
|
|
343
348
|
var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
344
|
-
var MULTI_MANIFEST_VERSION =
|
|
349
|
+
var MULTI_MANIFEST_VERSION = 8;
|
|
345
350
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
346
351
|
const hash = createHash2("sha256");
|
|
347
|
-
hash.update(`swift-compile/
|
|
352
|
+
hash.update(`swift-compile/v8
|
|
348
353
|
${release}
|
|
349
354
|
`);
|
|
350
355
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -373,7 +378,7 @@ ${release}
|
|
|
373
378
|
hash.update(
|
|
374
379
|
JSON.stringify({
|
|
375
380
|
targets,
|
|
376
|
-
siblings: [...
|
|
381
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort(
|
|
377
382
|
(a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
|
|
378
383
|
)
|
|
379
384
|
})
|
|
@@ -383,6 +388,16 @@ ${release}
|
|
|
383
388
|
}
|
|
384
389
|
function emitSwiftPackageManifest(args) {
|
|
385
390
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
391
|
+
const reachedFrameworks = new Set(
|
|
392
|
+
[...siblings.values()].flat().filter(
|
|
393
|
+
(name) => OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name)
|
|
394
|
+
)
|
|
395
|
+
);
|
|
396
|
+
const distributionObjects = distribution?.objects.filter(
|
|
397
|
+
(object) => [...OPTIONAL_FRAMEWORKS].every(
|
|
398
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name)
|
|
399
|
+
)
|
|
400
|
+
);
|
|
386
401
|
const executable = targets.find((target) => target.executable);
|
|
387
402
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
388
403
|
const stanza = (target) => {
|
|
@@ -395,10 +410,12 @@ function emitSwiftPackageManifest(args) {
|
|
|
395
410
|
...oneModule ? [ONE_PRODUCT] : [],
|
|
396
411
|
...spriteKit ? [SPRITEKIT_PRODUCT] : []
|
|
397
412
|
],
|
|
398
|
-
...(siblings.get(target.name) ?? []).
|
|
413
|
+
...(siblings.get(target.name) ?? []).flatMap(
|
|
414
|
+
(dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
415
|
+
)
|
|
399
416
|
].join(", ");
|
|
400
417
|
const library = distribution ? [
|
|
401
|
-
...
|
|
418
|
+
...(distributionObjects ?? []).map((object) => path2.join(moduleRoot, object)),
|
|
402
419
|
...distribution.link
|
|
403
420
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
404
421
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
@@ -620,6 +637,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
620
637
|
path2.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
621
638
|
"utf8"
|
|
622
639
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
640
|
+
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
641
|
+
if (optionalProducts.length > 0) {
|
|
642
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
643
|
+
if (!manifest.includes(product))
|
|
644
|
+
throw new Error("Swift app template lost its framework dependency anchor");
|
|
645
|
+
manifest = manifest.replace(
|
|
646
|
+
product,
|
|
647
|
+
[
|
|
648
|
+
product,
|
|
649
|
+
...optionalProducts.map(
|
|
650
|
+
(name) => `.product(name: "${name}", package: "sootsim-swift"),`
|
|
651
|
+
)
|
|
652
|
+
].join("\n ")
|
|
653
|
+
);
|
|
654
|
+
}
|
|
623
655
|
if (input.oneModule) {
|
|
624
656
|
const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
|
|
625
657
|
const flags = `"-Osize"${OBJC_IMPLICIT_FLAGS}`;
|
|
@@ -665,7 +697,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
665
697
|
path2.join(layout.root, "Package.swift"),
|
|
666
698
|
emitSwiftPackageManifest({
|
|
667
699
|
targets,
|
|
668
|
-
siblings:
|
|
700
|
+
siblings: swiftTargetDependencies(
|
|
701
|
+
input.files,
|
|
702
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
|
|
703
|
+
),
|
|
669
704
|
moduleRoot,
|
|
670
705
|
oneModule: input.oneModule,
|
|
671
706
|
spriteKit: importsSpriteKit(input.files),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.687 | (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.687 | (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.687 | (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.687 | (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.687 | (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;
|
|
@@ -401,14 +401,19 @@ function withNativeSourceGlue(input, glue) {
|
|
|
401
401
|
oneModule: true
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
var OPTIONAL_FRAMEWORKS = /* @__PURE__ */ new Set(["CryptoKit", "Security"]);
|
|
405
|
+
function swiftTargetDependencies(files, targets) {
|
|
406
|
+
const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
|
|
406
407
|
const siblings = /* @__PURE__ */ new Map();
|
|
407
408
|
for (const target of targets) {
|
|
408
|
-
const prefix = `${target.path}/`;
|
|
409
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
409
410
|
const deps = /* @__PURE__ */ new Set();
|
|
410
411
|
for (const [file, contents] of Object.entries(files)) {
|
|
411
412
|
if (file === "Package.swift" || !file.startsWith(prefix)) continue;
|
|
413
|
+
if (targets.some(
|
|
414
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
415
|
+
))
|
|
416
|
+
continue;
|
|
412
417
|
for (const match of contents.matchAll(
|
|
413
418
|
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
|
|
414
419
|
)) {
|
|
@@ -428,10 +433,10 @@ var importsSpriteKit = (files) => Object.entries(files).some(
|
|
|
428
433
|
);
|
|
429
434
|
var OBJC_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC"';
|
|
430
435
|
var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
431
|
-
var MULTI_MANIFEST_VERSION =
|
|
436
|
+
var MULTI_MANIFEST_VERSION = 8;
|
|
432
437
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
433
438
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
434
|
-
hash.update(`swift-compile/
|
|
439
|
+
hash.update(`swift-compile/v8
|
|
435
440
|
${release}
|
|
436
441
|
`);
|
|
437
442
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -460,7 +465,7 @@ ${release}
|
|
|
460
465
|
hash.update(
|
|
461
466
|
JSON.stringify({
|
|
462
467
|
targets,
|
|
463
|
-
siblings: [...
|
|
468
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort(
|
|
464
469
|
(a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
|
|
465
470
|
)
|
|
466
471
|
})
|
|
@@ -470,6 +475,16 @@ ${release}
|
|
|
470
475
|
}
|
|
471
476
|
function emitSwiftPackageManifest(args) {
|
|
472
477
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
478
|
+
const reachedFrameworks = new Set(
|
|
479
|
+
[...siblings.values()].flat().filter(
|
|
480
|
+
(name) => OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name)
|
|
481
|
+
)
|
|
482
|
+
);
|
|
483
|
+
const distributionObjects = distribution?.objects.filter(
|
|
484
|
+
(object) => [...OPTIONAL_FRAMEWORKS].every(
|
|
485
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name)
|
|
486
|
+
)
|
|
487
|
+
);
|
|
473
488
|
const executable = targets.find((target) => target.executable);
|
|
474
489
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
475
490
|
const stanza = (target) => {
|
|
@@ -482,10 +497,12 @@ function emitSwiftPackageManifest(args) {
|
|
|
482
497
|
...oneModule ? [ONE_PRODUCT] : [],
|
|
483
498
|
...spriteKit ? [SPRITEKIT_PRODUCT] : []
|
|
484
499
|
],
|
|
485
|
-
...(siblings.get(target.name) ?? []).
|
|
500
|
+
...(siblings.get(target.name) ?? []).flatMap(
|
|
501
|
+
(dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
502
|
+
)
|
|
486
503
|
].join(", ");
|
|
487
504
|
const library = distribution ? [
|
|
488
|
-
...
|
|
505
|
+
...(distributionObjects ?? []).map((object) => import_node_path2.default.join(moduleRoot, object)),
|
|
489
506
|
...distribution.link
|
|
490
507
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
491
508
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
@@ -707,6 +724,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
707
724
|
import_node_path2.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
708
725
|
"utf8"
|
|
709
726
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
727
|
+
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
728
|
+
if (optionalProducts.length > 0) {
|
|
729
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
730
|
+
if (!manifest.includes(product))
|
|
731
|
+
throw new Error("Swift app template lost its framework dependency anchor");
|
|
732
|
+
manifest = manifest.replace(
|
|
733
|
+
product,
|
|
734
|
+
[
|
|
735
|
+
product,
|
|
736
|
+
...optionalProducts.map(
|
|
737
|
+
(name) => `.product(name: "${name}", package: "sootsim-swift"),`
|
|
738
|
+
)
|
|
739
|
+
].join("\n ")
|
|
740
|
+
);
|
|
741
|
+
}
|
|
710
742
|
if (input.oneModule) {
|
|
711
743
|
const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
|
|
712
744
|
const flags = `"-Osize"${OBJC_IMPLICIT_FLAGS}`;
|
|
@@ -752,7 +784,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
752
784
|
import_node_path2.default.join(layout.root, "Package.swift"),
|
|
753
785
|
emitSwiftPackageManifest({
|
|
754
786
|
targets,
|
|
755
|
-
siblings:
|
|
787
|
+
siblings: swiftTargetDependencies(
|
|
788
|
+
input.files,
|
|
789
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
|
|
790
|
+
),
|
|
756
791
|
moduleRoot,
|
|
757
792
|
oneModule: input.oneModule,
|
|
758
793
|
spriteKit: importsSpriteKit(input.files),
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.687 | (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;
|