peachsim 0.1.686 → 0.1.688
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/cloud-client.ts +3 -3
- package/cli/command-registry.ts +2 -0
- package/cli/commands/control.ts +1 -0
- package/cli/commands/debug.ts +10 -33
- package/cli/commands/do-chain.ts +56 -6
- package/cli/commands/inspect/core.ts +2 -0
- package/cli/commands/inspect/list.ts +2 -1
- package/cli/commands/inspect/settling.ts +17 -3
- package/cli/commands/inspect/shared.ts +2 -0
- package/cli/commands/inspect/wait-idle.ts +2 -2
- package/cli/commands/inspect/wait-ready.ts +3 -3
- package/cli/commands/inspect.ts +33 -7
- package/cli/commands/location.ts +164 -0
- package/cli/commands/platform.ts +1 -1
- package/cli/drivers/playwright-sim-host.ts +46 -25
- package/cli/main.ts +6 -0
- package/detox/index.ts +13 -8
- 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 +4 -3
- package/dist-lib/bridge-contract-input.cjs +12 -1
- package/dist-lib/bridge-contract-input.mjs +12 -1
- package/dist-lib/bridge-contract.cjs +4 -3
- package/dist-lib/bridge-contract.mjs +4 -3
- 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 +2 -1
- package/dist-lib/cloud-contract.mjs +2 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -1
- package/dist-lib/cloud.mjs +2 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1197 -65
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +402 -113
- package/dist-lib/host/fetch-proxy-handler.cjs +50 -40
- package/dist-lib/host/fetch-proxy-overrides.cjs +50 -6
- package/dist-lib/host/fetch-proxy-overrides.mjs +48 -5
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +29 -11
- 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 +89 -13
- 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 +5 -3
- package/dist-lib/native-app-identity.cjs +8 -3
- package/dist-lib/native-app-identity.mjs +8 -3
- 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 +2 -2
- package/dist-lib/sdk.cjs +21 -6
- package/dist-lib/sdk.mjs +21 -6
- package/dist-lib/skills.cjs +441 -135
- package/dist-lib/swift-compile.cjs +317 -27
- package/dist-lib/swift-compile.mjs +315 -27
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +10 -10
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +320 -49
- package/dist-lib/vite.cjs +1 -1
- package/kotlin/AppSources/android/content/res/Configuration.kt +2 -0
- package/kotlin/AppSources/android/content/res/Resources.kt +6 -3
- package/kotlin/AppSources/android/util/DisplayMetrics.kt +12 -0
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +70 -0
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +12 -10
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +95 -0
- package/kotlin/fixtures/kotlin-app-variants/Bitmaps.kt +50 -0
- package/kotlin/fixtures/kotlin-app-variants/Drawables.kt +53 -0
- package/package.json +2 -2
- package/scripts/dev-server-scanner.ts +3 -1
- package/skills/contrast/SKILL.md +1 -0
- package/src/android-drawables.ts +315 -0
- package/src/android-theme.ts +9 -0
- package/src/bridge-constants.ts +3 -2
- package/src/bridge-contract-input.ts +11 -0
- package/src/bridge-contract.ts +45 -3
- package/src/cloud-contract.ts +1 -0
- package/src/host/fetch-proxy-handler.ts +13 -49
- package/src/host/fetch-proxy-overrides.ts +69 -12
- package/src/kotlin-app.ts +6 -0
- package/src/kotlin-host.ts +103 -15
- package/src/native-app-identity.ts +16 -3
- package/src/swift-compile.ts +426 -29
- package/src/swift-distribution-contract.ts +11 -4
- package/src/swift-distribution.lock.json +11 -9
- package/src/swift-distribution.ts +4 -4
- package/src/swift-icu.ts +8 -11
- package/src/swift-submit.ts +13 -1
- package/src/swift-toolchain.ts +17 -9
- package/src/vite-plugin.ts +86 -34
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.688 | (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;
|
|
@@ -95,7 +95,7 @@ function swiftDistributionHost(platform, arch) {
|
|
|
95
95
|
}
|
|
96
96
|
var isStrings = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
97
97
|
function parseSwiftDistributionManifest(value) {
|
|
98
|
-
if (!isRecord(value) || typeof value.id !== "string" || typeof value.release !== "string" || typeof value.wasmSdkChecksum !== "string" || !isStrings(value.modules) || !isStrings(value.objects) || !isStrings(value.link) || !isRecord(value.files) || !Object.values(value.files).every((sha) => typeof sha === "string") || typeof value.host !== "string" || !isStrings(value.plugins)) {
|
|
98
|
+
if (!isRecord(value) || typeof value.id !== "string" || typeof value.release !== "string" || typeof value.wasmSdkId !== "string" || typeof value.wasmSdkUrl !== "string" || typeof value.wasmSdkChecksum !== "string" || !isStrings(value.modules) || !isStrings(value.objects) || !isStrings(value.link) || !isRecord(value.files) || !Object.values(value.files).every((sha) => typeof sha === "string") || typeof value.host !== "string" || !isStrings(value.plugins)) {
|
|
99
99
|
throw new Error(`invalid Swift distribution ${SWIFT_DISTRIBUTION_MANIFEST}`);
|
|
100
100
|
}
|
|
101
101
|
const host2 = SWIFT_DISTRIBUTION_HOSTS.find((candidate) => candidate === value.host);
|
|
@@ -103,6 +103,8 @@ function parseSwiftDistributionManifest(value) {
|
|
|
103
103
|
return {
|
|
104
104
|
id: value.id,
|
|
105
105
|
release: value.release,
|
|
106
|
+
wasmSdkId: value.wasmSdkId,
|
|
107
|
+
wasmSdkUrl: value.wasmSdkUrl,
|
|
106
108
|
wasmSdkChecksum: value.wasmSdkChecksum,
|
|
107
109
|
modules: value.modules,
|
|
108
110
|
objects: value.objects,
|
|
@@ -115,7 +117,7 @@ function parseSwiftDistributionManifest(value) {
|
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
119
|
function parseSwiftDistributionLock(value) {
|
|
118
|
-
if (!isRecord(value) || typeof value.id !== "string" || !/^[a-f0-9]{16}$/.test(value.id) || typeof value.release !== "string" || typeof value.wasmSdkChecksum !== "string" || typeof value.source !== "string" || !isRecord(value.hosts)) {
|
|
120
|
+
if (!isRecord(value) || typeof value.id !== "string" || !/^[a-f0-9]{16}$/.test(value.id) || typeof value.release !== "string" || typeof value.wasmSdkId !== "string" || typeof value.wasmSdkUrl !== "string" || typeof value.wasmSdkChecksum !== "string" || typeof value.source !== "string" || !isRecord(value.hosts)) {
|
|
119
121
|
throw new Error("invalid Swift distribution lock");
|
|
120
122
|
}
|
|
121
123
|
const hosts = value.hosts;
|
|
@@ -129,6 +131,8 @@ function parseSwiftDistributionLock(value) {
|
|
|
129
131
|
return {
|
|
130
132
|
id: value.id,
|
|
131
133
|
release: value.release,
|
|
134
|
+
wasmSdkId: value.wasmSdkId,
|
|
135
|
+
wasmSdkUrl: value.wasmSdkUrl,
|
|
132
136
|
wasmSdkChecksum: value.wasmSdkChecksum,
|
|
133
137
|
source: value.source,
|
|
134
138
|
hosts: {
|
|
@@ -164,25 +168,25 @@ function memo(cache, key, load2) {
|
|
|
164
168
|
}
|
|
165
169
|
return pending;
|
|
166
170
|
}
|
|
167
|
-
function swiftIcuData(toolchainBin,
|
|
168
|
-
return memo(raw, `${toolchainBin}\0${
|
|
171
|
+
function swiftIcuData(toolchainBin, sdk) {
|
|
172
|
+
return memo(raw, `${toolchainBin}\0${sdk}`, () => load(toolchainBin, sdk));
|
|
169
173
|
}
|
|
170
|
-
function swiftIcuAsset(toolchainBin,
|
|
171
|
-
return memo(assets, `${toolchainBin}\0${
|
|
172
|
-
const zipped = await deflate(await swiftIcuData(toolchainBin,
|
|
174
|
+
function swiftIcuAsset(toolchainBin, sdk) {
|
|
175
|
+
return memo(assets, `${toolchainBin}\0${sdk}`, async () => {
|
|
176
|
+
const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
|
|
173
177
|
return { sha256: (0, import_node_crypto.createHash)("sha256").update(zipped).digest("hex"), gzip: zipped };
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
|
-
async function load(toolchainBin,
|
|
180
|
+
async function load(toolchainBin, sdk) {
|
|
177
181
|
const { stdout } = await run(import_node_path.default.join(toolchainBin, "swift"), [
|
|
178
182
|
"sdk",
|
|
179
183
|
"configure",
|
|
180
184
|
"--show-configuration",
|
|
181
|
-
|
|
185
|
+
sdk,
|
|
182
186
|
"wasm32-unknown-wasip1"
|
|
183
187
|
]);
|
|
184
188
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
185
|
-
if (!resources) throw new Error(`swift-icu: ${
|
|
189
|
+
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
186
190
|
return Buffer.from(
|
|
187
191
|
icuSegment(archiveMember((0, import_node_fs.readFileSync)(import_node_path.default.join(resources, ARCHIVE)), MEMBER))
|
|
188
192
|
);
|
|
@@ -311,6 +315,16 @@ function swiftDistributionAt(root) {
|
|
|
311
315
|
if (!(0, import_node_fs2.existsSync)(file)) return null;
|
|
312
316
|
return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs2.readFileSync)(file, "utf8")));
|
|
313
317
|
}
|
|
318
|
+
function swiftModuleSdk(root) {
|
|
319
|
+
const pin = swiftDistributionAt(root) ?? JSON.parse((0, import_node_fs2.readFileSync)(import_node_path2.default.join(root, "toolchain.json"), "utf8"));
|
|
320
|
+
if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
|
|
321
|
+
throw new Error(`${root} pins no wasm SDK id, url and checksum`);
|
|
322
|
+
return {
|
|
323
|
+
wasmSdkId: String(Reflect.get(pin, "wasmSdkId")),
|
|
324
|
+
wasmSdkUrl: String(Reflect.get(pin, "wasmSdkUrl")),
|
|
325
|
+
wasmSdkChecksum: String(Reflect.get(pin, "wasmSdkChecksum"))
|
|
326
|
+
};
|
|
327
|
+
}
|
|
314
328
|
function swiftModuleInputFiles(root) {
|
|
315
329
|
if (swiftDistributionAt(root)) return [SWIFT_DISTRIBUTION_MANIFEST];
|
|
316
330
|
const files = [
|
|
@@ -322,7 +336,7 @@ function swiftModuleInputFiles(root) {
|
|
|
322
336
|
for (const entry of (0, import_node_fs2.readdirSync)(import_node_path2.default.join(root, dir), { withFileTypes: true })) {
|
|
323
337
|
const relative = `${dir}/${entry.name}`;
|
|
324
338
|
if (entry.isDirectory()) walk(relative);
|
|
325
|
-
else if (/\.(swift|c|h)$/.test(entry.name)) files.push(relative);
|
|
339
|
+
else if (/\.(swift|c|cpp|h)$/.test(entry.name)) files.push(relative);
|
|
326
340
|
}
|
|
327
341
|
};
|
|
328
342
|
walk("Sources");
|
|
@@ -401,14 +415,29 @@ function withNativeSourceGlue(input, glue) {
|
|
|
401
415
|
oneModule: true
|
|
402
416
|
};
|
|
403
417
|
}
|
|
404
|
-
|
|
405
|
-
|
|
418
|
+
var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
|
|
419
|
+
Accelerate: [],
|
|
420
|
+
CryptoKit: [],
|
|
421
|
+
Security: [],
|
|
422
|
+
Statsig: [],
|
|
423
|
+
DatadogCore: [],
|
|
424
|
+
DatadogLogs: ["DatadogCore"],
|
|
425
|
+
DatadogRUM: ["DatadogCore"],
|
|
426
|
+
DatadogTrace: ["DatadogCore"]
|
|
427
|
+
};
|
|
428
|
+
var OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
|
|
429
|
+
function swiftTargetDependencies(files, targets) {
|
|
430
|
+
const names = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...targets.map((target) => target.name)]);
|
|
406
431
|
const siblings = /* @__PURE__ */ new Map();
|
|
407
432
|
for (const target of targets) {
|
|
408
|
-
const prefix = `${target.path}/`;
|
|
433
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
409
434
|
const deps = /* @__PURE__ */ new Set();
|
|
410
435
|
for (const [file, contents] of Object.entries(files)) {
|
|
411
436
|
if (file === "Package.swift" || !file.startsWith(prefix)) continue;
|
|
437
|
+
if (targets.some(
|
|
438
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
439
|
+
))
|
|
440
|
+
continue;
|
|
412
441
|
for (const match of contents.matchAll(
|
|
413
442
|
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/gm
|
|
414
443
|
)) {
|
|
@@ -426,12 +455,12 @@ var importsSpriteKit = (files) => Object.entries(files).some(
|
|
|
426
455
|
contents
|
|
427
456
|
)
|
|
428
457
|
);
|
|
429
|
-
var
|
|
458
|
+
var FOUNDATION_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "PeachObjC", "-Xfrontend", "-import-module", "-Xfrontend", "Dispatch", "-Xfrontend", "-import-module", "-Xfrontend", "FoundationNetworking"';
|
|
430
459
|
var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
431
|
-
var MULTI_MANIFEST_VERSION =
|
|
460
|
+
var MULTI_MANIFEST_VERSION = 10;
|
|
432
461
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
433
462
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
434
|
-
hash.update(`swift-compile/
|
|
463
|
+
hash.update(`swift-compile/v12
|
|
435
464
|
${release}
|
|
436
465
|
`);
|
|
437
466
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -460,7 +489,7 @@ ${release}
|
|
|
460
489
|
hash.update(
|
|
461
490
|
JSON.stringify({
|
|
462
491
|
targets,
|
|
463
|
-
siblings: [...
|
|
492
|
+
siblings: [...swiftTargetDependencies(input.files, targets)].sort(
|
|
464
493
|
(a, b) => String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0
|
|
465
494
|
)
|
|
466
495
|
})
|
|
@@ -470,22 +499,34 @@ ${release}
|
|
|
470
499
|
}
|
|
471
500
|
function emitSwiftPackageManifest(args) {
|
|
472
501
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
502
|
+
const reachedFrameworks = new Set(
|
|
503
|
+
[...siblings.values()].flat().filter(
|
|
504
|
+
(name) => OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name)
|
|
505
|
+
).flatMap((name) => [name, ...OPTIONAL_FRAMEWORK_DEPENDENCIES[name] ?? []])
|
|
506
|
+
);
|
|
507
|
+
const distributionObjects = distribution?.objects.filter(
|
|
508
|
+
(object) => [...OPTIONAL_FRAMEWORKS].every(
|
|
509
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name)
|
|
510
|
+
)
|
|
511
|
+
);
|
|
473
512
|
const executable = targets.find((target) => target.executable);
|
|
474
513
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
475
514
|
const stanza = (target) => {
|
|
476
515
|
const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
|
|
477
516
|
const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path2.default.join(moduleRoot, "modules"))}` : "";
|
|
478
|
-
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation} .unsafeFlags(["-Osize"${
|
|
517
|
+
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation} .unsafeFlags(["-Osize"${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}])]`;
|
|
479
518
|
const deps = [
|
|
480
519
|
...distribution ? [] : [
|
|
481
520
|
'.product(name: "SwiftUI", package: "sootsim-swift")',
|
|
482
521
|
...oneModule ? [ONE_PRODUCT] : [],
|
|
483
522
|
...spriteKit ? [SPRITEKIT_PRODUCT] : []
|
|
484
523
|
],
|
|
485
|
-
...(siblings.get(target.name) ?? []).
|
|
524
|
+
...(siblings.get(target.name) ?? []).flatMap(
|
|
525
|
+
(dependency) => OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? distribution ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
526
|
+
)
|
|
486
527
|
].join(", ");
|
|
487
528
|
const library = distribution ? [
|
|
488
|
-
...
|
|
529
|
+
...(distributionObjects ?? []).map((object) => import_node_path2.default.join(moduleRoot, object)),
|
|
489
530
|
...distribution.link
|
|
490
531
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
491
532
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
@@ -543,8 +584,185 @@ var DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
|
|
|
543
584
|
var OS_IOS = /\bos\(\s*iOS\s*\)/g;
|
|
544
585
|
var OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
|
|
545
586
|
var SELECTOR = /^#selector\b/;
|
|
587
|
+
var TYPE_AFTER_ATTRIBUTE = /^(?:\s+|\/\/[^\n]*|\/\*[\s\S]*?\*\/|@\w+(?:\([^()]*\))?|\b(?:public|open|final|internal|fileprivate|private|package|nonisolated|indirect)\b)*\b(?:class(?!\s+(?:func|var|let|subscript)\b)|struct|enum|protocol|extension|actor)\b/;
|
|
546
588
|
var DELEGATE_CLASS = /^class\s+[A-Za-z_]\w*\s*(?:<[^>{]*>)?\s*:[^{]*\b(?:UIApplicationDelegate|UISceneDelegate|UIWindowSceneDelegate)\b[^{]*\{/;
|
|
547
|
-
|
|
589
|
+
var REUSABLE_INIT = /^override(?=\s+init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/;
|
|
590
|
+
var REUSABLE_VIEW_BASES = [
|
|
591
|
+
"UICollectionReusableView",
|
|
592
|
+
"UICollectionViewCell",
|
|
593
|
+
"UICollectionViewListCell"
|
|
594
|
+
];
|
|
595
|
+
var CLASS_BASE = /^class\s+([A-Za-z_]\w*)\s*(?:<[^>{]*>)?\s*:\s*([A-Za-z_][\w.]*)[^{]*\{/;
|
|
596
|
+
var FRAME_INIT = /^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*frame\s*:)/;
|
|
597
|
+
var APPLE_CLASS = /^(?:UI|NS|CA|SK|WK|MK|AV|PK|CL|GK|PH|SF|AS|QL)[A-Z]/;
|
|
598
|
+
var EXTENSION_DECL = /^extension\s+([A-Za-z_][\w.]*)/;
|
|
599
|
+
var CLASS_DECL = /^class\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/;
|
|
600
|
+
var MODIFIERS = /(?:^|\s)(public|open|internal|fileprivate|private|final|nonisolated|@MainActor)(?=\s)/g;
|
|
601
|
+
var OVERRIDE_FUNC = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+func\s+([A-Za-z_]\w*)\s*(<[^>{}]*>)?\s*\(/;
|
|
602
|
+
var OVERRIDE_VAR = /^override((?:\s+(?:public|open|internal|fileprivate|private|final|nonisolated|dynamic|@\w+))*)\s+var\s+([A-Za-z_]\w*)\s*:\s*([^{=]+?)\s*\{/;
|
|
603
|
+
function splitTopLevel(text) {
|
|
604
|
+
const parts = [];
|
|
605
|
+
let depth = 0;
|
|
606
|
+
let start = 0;
|
|
607
|
+
for (let i = 0; i < text.length; i++) {
|
|
608
|
+
const char = text[i];
|
|
609
|
+
if (char === "(" || char === "[" || char === "<") depth++;
|
|
610
|
+
else if (char === ")" || char === "]" || char === ">" && text[i - 1] !== "-")
|
|
611
|
+
depth--;
|
|
612
|
+
else if (char === "," && depth === 0) {
|
|
613
|
+
parts.push(text.slice(start, i));
|
|
614
|
+
start = i + 1;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
parts.push(text.slice(start));
|
|
618
|
+
return parts.map((part) => part.trim()).filter((part) => part !== "");
|
|
619
|
+
}
|
|
620
|
+
function forwardedArguments(parameters) {
|
|
621
|
+
const args = [];
|
|
622
|
+
for (const parameter of splitTopLevel(parameters)) {
|
|
623
|
+
const match = /^(?:([A-Za-z_]\w*)\s+)?([A-Za-z_]\w*)\s*:\s*([\s\S]*)$/.exec(parameter);
|
|
624
|
+
if (!match || match[3].includes("...")) return null;
|
|
625
|
+
const label = match[1] ?? match[2];
|
|
626
|
+
const value = (/^(?:@\w+\s+)*inout\b/.test(match[3]) ? "&" : "") + match[2];
|
|
627
|
+
args.push(label === "_" ? value : `${label}: ${value}`);
|
|
628
|
+
}
|
|
629
|
+
return args.join(", ");
|
|
630
|
+
}
|
|
631
|
+
function liftExtensionOverrides(source) {
|
|
632
|
+
const { tokens } = swiftCodeScan(source);
|
|
633
|
+
const stack = [];
|
|
634
|
+
let pending = null;
|
|
635
|
+
const classes = /* @__PURE__ */ new Map();
|
|
636
|
+
let declaredBase = null;
|
|
637
|
+
let declaredObjCMembers = false;
|
|
638
|
+
const lifted = [];
|
|
639
|
+
const closing = (open) => {
|
|
640
|
+
let depth = 0;
|
|
641
|
+
for (const at of tokens) {
|
|
642
|
+
if (at < open) continue;
|
|
643
|
+
if (source[at] === "{") depth++;
|
|
644
|
+
else if (source[at] === "}" && --depth === 0) return at + 1;
|
|
645
|
+
}
|
|
646
|
+
return source.length;
|
|
647
|
+
};
|
|
648
|
+
for (const at of tokens) {
|
|
649
|
+
const rest = source.slice(at, at + 600);
|
|
650
|
+
if (rest.startsWith("{")) {
|
|
651
|
+
const frame = pending ?? { kind: "other", name: "" };
|
|
652
|
+
if (frame.kind === "class" && !classes.has(frame.name))
|
|
653
|
+
classes.set(frame.name, {
|
|
654
|
+
brace: at,
|
|
655
|
+
base: declaredBase,
|
|
656
|
+
objcMembers: declaredObjCMembers
|
|
657
|
+
});
|
|
658
|
+
stack.push(frame);
|
|
659
|
+
pending = null;
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (rest.startsWith("}")) {
|
|
663
|
+
stack.pop();
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
const declared = CLASS_DECL.exec(rest);
|
|
667
|
+
if (declared) {
|
|
668
|
+
pending = { kind: "class", name: declared[1] };
|
|
669
|
+
declaredBase = CLASS_BASE.exec(rest)?.[2]?.split(".").pop() ?? null;
|
|
670
|
+
const lines = source.lastIndexOf("\n", source.lastIndexOf("\n", at - 1) - 1) + 1;
|
|
671
|
+
declaredObjCMembers = /@objcMembers\b/.test(source.slice(lines, at));
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
const extended = EXTENSION_DECL.exec(rest);
|
|
675
|
+
if (extended) {
|
|
676
|
+
pending = { kind: "extension", name: extended[1].split(".").pop() };
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
const top = stack.at(-1);
|
|
680
|
+
if (!rest.startsWith("override") || top?.kind !== "extension" || pending) continue;
|
|
681
|
+
const line = source.slice(source.lastIndexOf("\n", at - 1) + 1, at);
|
|
682
|
+
const modifiers = (` ${line} `.match(MODIFIERS) ?? []).map((word) => word.trim());
|
|
683
|
+
const func = OVERRIDE_FUNC.exec(rest);
|
|
684
|
+
if (func) {
|
|
685
|
+
const name = func[2];
|
|
686
|
+
const open = at + func[0].length - 1;
|
|
687
|
+
let depth = 0;
|
|
688
|
+
let close = open;
|
|
689
|
+
for (; close < source.length; close++) {
|
|
690
|
+
if (source[close] === "(") depth++;
|
|
691
|
+
else if (source[close] === ")" && --depth === 0) break;
|
|
692
|
+
}
|
|
693
|
+
const body = tokens.find((token) => token > close && source[token] === "{");
|
|
694
|
+
if (body === void 0) continue;
|
|
695
|
+
const clause = source.slice(close + 1, body).trim();
|
|
696
|
+
const args = forwardedArguments(source.slice(open + 1, close));
|
|
697
|
+
if (args === null) continue;
|
|
698
|
+
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name}(${args})`;
|
|
699
|
+
const signature = `func ${name}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
700
|
+
lifted.push({
|
|
701
|
+
type: top.name,
|
|
702
|
+
member: name,
|
|
703
|
+
stub: `${[...modifiers, "override"].join(" ")} ${signature} { ${call} };`,
|
|
704
|
+
edits: [
|
|
705
|
+
[at, "override".length, " ".repeat("override".length)],
|
|
706
|
+
[
|
|
707
|
+
at + rest.indexOf(
|
|
708
|
+
name,
|
|
709
|
+
rest.indexOf("func", "override".length + func[1].length) + 4
|
|
710
|
+
),
|
|
711
|
+
0,
|
|
712
|
+
"__peach_ext_"
|
|
713
|
+
]
|
|
714
|
+
]
|
|
715
|
+
});
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
const property = OVERRIDE_VAR.exec(rest);
|
|
719
|
+
if (property) {
|
|
720
|
+
const open = at + property[0].length - 1;
|
|
721
|
+
if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
|
|
722
|
+
const name = property[2];
|
|
723
|
+
lifted.push({
|
|
724
|
+
type: top.name,
|
|
725
|
+
member: name,
|
|
726
|
+
stub: `${[...modifiers, "override"].join(" ")} var ${name}: ${property[3].trim()} { __peach_ext_${name} };`,
|
|
727
|
+
edits: [
|
|
728
|
+
[at, "override".length, " ".repeat("override".length)],
|
|
729
|
+
[at + rest.indexOf(name, rest.indexOf("var")), 0, "__peach_ext_"]
|
|
730
|
+
]
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
const overridesObjC = (type, member) => {
|
|
735
|
+
let base = classes.get(type)?.base ?? null;
|
|
736
|
+
while (base !== null) {
|
|
737
|
+
if (APPLE_CLASS.test(base)) return true;
|
|
738
|
+
const declaredClass = classes.get(base);
|
|
739
|
+
if (!declaredClass) return false;
|
|
740
|
+
const body = source.slice(declaredClass.brace, closing(declaredClass.brace));
|
|
741
|
+
const found = new RegExp(`\\b(?:func|var)\\s+${member}\\b`).exec(body);
|
|
742
|
+
if (found) {
|
|
743
|
+
const line = body.slice(body.lastIndexOf("\n", found.index) + 1, found.index);
|
|
744
|
+
return declaredClass.objcMembers || /@objc\b/.test(line);
|
|
745
|
+
}
|
|
746
|
+
base = declaredClass.base;
|
|
747
|
+
}
|
|
748
|
+
return false;
|
|
749
|
+
};
|
|
750
|
+
const edits = [];
|
|
751
|
+
const stubs = /* @__PURE__ */ new Map();
|
|
752
|
+
for (const entry of lifted) {
|
|
753
|
+
const brace = classes.get(entry.type)?.brace;
|
|
754
|
+
if (brace === void 0 || !overridesObjC(entry.type, entry.member)) continue;
|
|
755
|
+
edits.push(...entry.edits);
|
|
756
|
+
stubs.set(brace, [...stubs.get(brace) ?? [], entry.stub]);
|
|
757
|
+
}
|
|
758
|
+
for (const [brace, list] of stubs) edits.push([brace + 1, 0, ` ${list.join(" ")}`]);
|
|
759
|
+
let out = source;
|
|
760
|
+
for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
|
|
761
|
+
out = out.slice(0, at) + insert + out.slice(at + remove);
|
|
762
|
+
return out;
|
|
763
|
+
}
|
|
764
|
+
function swiftSourceAsIOS(original) {
|
|
765
|
+
const source = liftExtensionOverrides(original);
|
|
548
766
|
const { lineStarts, tokens } = swiftCodeScan(source);
|
|
549
767
|
let offset = 0;
|
|
550
768
|
const conditioned = source.split("\n").map((line) => {
|
|
@@ -555,8 +773,30 @@ function swiftSourceAsIOS(source) {
|
|
|
555
773
|
}).join("\n");
|
|
556
774
|
let out = "";
|
|
557
775
|
let copied = 0;
|
|
776
|
+
const reusableViews = new Set(REUSABLE_VIEW_BASES);
|
|
777
|
+
const reusableBodies = [];
|
|
778
|
+
let depth = 0;
|
|
779
|
+
let opensReusableBody = false;
|
|
558
780
|
for (const at of tokens) {
|
|
559
781
|
const rest = conditioned.slice(at, at + 400);
|
|
782
|
+
if (rest.startsWith("{")) {
|
|
783
|
+
depth++;
|
|
784
|
+
if (opensReusableBody) reusableBodies.push(depth);
|
|
785
|
+
opensReusableBody = false;
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
if (rest.startsWith("}")) {
|
|
789
|
+
if (reusableBodies.at(-1) === depth) reusableBodies.pop();
|
|
790
|
+
depth--;
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
if (rest.startsWith("override")) {
|
|
794
|
+
if (REUSABLE_INIT.test(rest) || reusableBodies.at(-1) === depth && FRAME_INIT.test(rest)) {
|
|
795
|
+
out += `${conditioned.slice(copied, at)}required`;
|
|
796
|
+
copied = at + "override".length;
|
|
797
|
+
}
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
560
800
|
const imported = /^import\s+CoreImage\.CIFilterBuiltins\b/.exec(rest);
|
|
561
801
|
if (imported) {
|
|
562
802
|
out += conditioned.slice(copied, at) + "import CoreImage".padEnd(imported[0].length);
|
|
@@ -569,6 +809,11 @@ function swiftSourceAsIOS(source) {
|
|
|
569
809
|
continue;
|
|
570
810
|
}
|
|
571
811
|
if (rest.startsWith("class")) {
|
|
812
|
+
const declared = CLASS_BASE.exec(rest);
|
|
813
|
+
if (declared && reusableViews.has(declared[2].split(".").pop())) {
|
|
814
|
+
reusableViews.add(declared[1]);
|
|
815
|
+
opensReusableBody = true;
|
|
816
|
+
}
|
|
572
817
|
const modifiers = conditioned.slice(conditioned.lastIndexOf("\n", at - 1) + 1, at);
|
|
573
818
|
if (DELEGATE_CLASS.test(rest) && !/\b(?:final|open)\b/.test(modifiers)) {
|
|
574
819
|
out += `${conditioned.slice(copied, at)}final `;
|
|
@@ -583,6 +828,8 @@ function swiftSourceAsIOS(source) {
|
|
|
583
828
|
if (selector) replacement = "#Selector";
|
|
584
829
|
else if (match[0] === "@objcMembers") replacement = "@ObjCMembers";
|
|
585
830
|
else if (match[0] === "@IBAction") replacement = "@ObjC".padEnd(match[0].length);
|
|
831
|
+
else if (TYPE_AFTER_ATTRIBUTE.test(rest.slice(match[0].length)))
|
|
832
|
+
replacement = " ".repeat(match[0].length);
|
|
586
833
|
else if (match[2] !== void 0)
|
|
587
834
|
replacement = `@ObjC${match[1]}("${match[2].trim()}")`;
|
|
588
835
|
out += conditioned.slice(copied, at) + replacement;
|
|
@@ -661,6 +908,9 @@ function swiftCodeScan(source) {
|
|
|
661
908
|
if (hashes > 0) tokens.push(at - 1);
|
|
662
909
|
i = Math.max(at, i + 1);
|
|
663
910
|
}
|
|
911
|
+
} else if (char === "{" || char === "}") {
|
|
912
|
+
tokens.push(i);
|
|
913
|
+
i++;
|
|
664
914
|
} else if (char === "(") {
|
|
665
915
|
top.parens++;
|
|
666
916
|
i++;
|
|
@@ -669,7 +919,7 @@ function swiftCodeScan(source) {
|
|
|
669
919
|
else top.parens--;
|
|
670
920
|
i++;
|
|
671
921
|
} else {
|
|
672
|
-
const keyword = source.startsWith("class", i) ? "class" : source.startsWith("import", i) ? "import" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : null;
|
|
922
|
+
const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : null;
|
|
673
923
|
if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
|
|
674
924
|
tokens.push(i);
|
|
675
925
|
i += keyword.length;
|
|
@@ -707,9 +957,24 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
707
957
|
import_node_path2.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
708
958
|
"utf8"
|
|
709
959
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
960
|
+
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
961
|
+
if (optionalProducts.length > 0) {
|
|
962
|
+
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
963
|
+
if (!manifest.includes(product))
|
|
964
|
+
throw new Error("Swift app template lost its framework dependency anchor");
|
|
965
|
+
manifest = manifest.replace(
|
|
966
|
+
product,
|
|
967
|
+
[
|
|
968
|
+
product,
|
|
969
|
+
...optionalProducts.map(
|
|
970
|
+
(name) => `.product(name: "${name}", package: "sootsim-swift"),`
|
|
971
|
+
)
|
|
972
|
+
].join("\n ")
|
|
973
|
+
);
|
|
974
|
+
}
|
|
710
975
|
if (input.oneModule) {
|
|
711
976
|
const product = '.product(name: "CoreLocation", package: "sootsim-swift"),';
|
|
712
|
-
const flags = `"-Osize"${
|
|
977
|
+
const flags = `"-Osize"${FOUNDATION_IMPLICIT_FLAGS}`;
|
|
713
978
|
if (!manifest.includes(product) || !manifest.includes(flags)) {
|
|
714
979
|
throw new Error(
|
|
715
980
|
"scripts/contrast-app-Package.swift lost the lines the One module links at"
|
|
@@ -752,7 +1017,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
752
1017
|
import_node_path2.default.join(layout.root, "Package.swift"),
|
|
753
1018
|
emitSwiftPackageManifest({
|
|
754
1019
|
targets,
|
|
755
|
-
siblings:
|
|
1020
|
+
siblings: swiftTargetDependencies(
|
|
1021
|
+
input.files,
|
|
1022
|
+
layout.multi ? targets : targets.map((target) => ({ ...target, path: "." }))
|
|
1023
|
+
),
|
|
756
1024
|
moduleRoot,
|
|
757
1025
|
oneModule: input.oneModule,
|
|
758
1026
|
spriteKit: importsSpriteKit(input.files),
|
|
@@ -830,7 +1098,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
830
1098
|
);
|
|
831
1099
|
}
|
|
832
1100
|
const macroPlugins = await ensureMacroPlugins(moduleRoot, options.toolchainBin);
|
|
833
|
-
const
|
|
1101
|
+
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
1102
|
+
const icu = swiftIcuAsset(options.toolchainBin, sdk);
|
|
834
1103
|
try {
|
|
835
1104
|
await run2(
|
|
836
1105
|
swift,
|
|
@@ -841,7 +1110,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
841
1110
|
"--package-path",
|
|
842
1111
|
root,
|
|
843
1112
|
"--swift-sdk",
|
|
844
|
-
|
|
1113
|
+
sdk,
|
|
845
1114
|
"-c",
|
|
846
1115
|
"release",
|
|
847
1116
|
"-Xswiftc",
|
|
@@ -1452,22 +1721,24 @@ function extractTarball(tarPath, destDir, stripComponents) {
|
|
|
1452
1721
|
|
|
1453
1722
|
// src/swift-distribution.lock.json
|
|
1454
1723
|
var swift_distribution_lock_default = {
|
|
1455
|
-
id: "
|
|
1724
|
+
id: "37329dbb7d21fea3",
|
|
1456
1725
|
release: "swift-6.3-RELEASE",
|
|
1457
|
-
|
|
1458
|
-
|
|
1726
|
+
wasmSdkId: "swift-6.3-RELEASE_wasm-peach-503c2533",
|
|
1727
|
+
wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-503c2533.artifactbundle.tar.gz",
|
|
1728
|
+
wasmSdkChecksum: "00fd9cc559652638552cc19c27624ea350f30bb866d87c41bbfe97d2ae1810eb",
|
|
1729
|
+
source: "dd8c803162eb6e23ce3fca4ab40d5eedf8717d9f",
|
|
1459
1730
|
hosts: {
|
|
1460
1731
|
"darwin-arm64": {
|
|
1461
|
-
sha256: "
|
|
1462
|
-
size:
|
|
1732
|
+
sha256: "b00c5daa751bd315c8157bddb2dc5037b475c3587e4040d12ccb624bfe3f1bb2",
|
|
1733
|
+
size: 6796662
|
|
1463
1734
|
},
|
|
1464
1735
|
"linux-x64": {
|
|
1465
|
-
sha256: "
|
|
1466
|
-
size:
|
|
1736
|
+
sha256: "d3f00367c7d3858e922574a49f5c80281fecaa0b2fc595f43c6bbdfc1aed9ac6",
|
|
1737
|
+
size: 6802137
|
|
1467
1738
|
},
|
|
1468
1739
|
"linux-arm64": {
|
|
1469
|
-
sha256: "
|
|
1470
|
-
size:
|
|
1740
|
+
sha256: "2b58ae90a2c2c9709a6487ada493e2f556e74db42d16ebb93bc819e60139b363",
|
|
1741
|
+
size: 6801173
|
|
1471
1742
|
}
|
|
1472
1743
|
}
|
|
1473
1744
|
};
|
|
@@ -1492,8 +1763,8 @@ function swiftToolchainBin(release) {
|
|
|
1492
1763
|
return (process.env.PATH ?? "").split(import_node_path6.default.delimiter).find((dir) => dir && import_node_fs5.default.existsSync(import_node_path6.default.join(dir, "swift"))) ?? image;
|
|
1493
1764
|
}
|
|
1494
1765
|
var verified = /* @__PURE__ */ new Map();
|
|
1495
|
-
function swiftToolchain(release,
|
|
1496
|
-
const cached = verified.get(release);
|
|
1766
|
+
function swiftToolchain(release, sdk) {
|
|
1767
|
+
const cached = verified.get(`${release}\0${sdk.wasmSdkId}`);
|
|
1497
1768
|
if (cached) return cached;
|
|
1498
1769
|
const bin = swiftToolchainBin(release);
|
|
1499
1770
|
const swift = import_node_path6.default.join(bin, "swift");
|
|
@@ -1505,26 +1776,26 @@ function swiftToolchain(release, wasmSdkChecksum) {
|
|
|
1505
1776
|
const found = version ? `found ${version.split("\n")[0]?.trim()} at ${swift}` : process.platform === "darwin" ? `found no ${release}.xctoolchain in ~/Library/Developer/Toolchains or /Library/Developer/Toolchains` : "found no swift on PATH";
|
|
1506
1777
|
throw new Error(
|
|
1507
1778
|
`peach compiles Swift with the swift.org toolchain ${release} and its wasm SDK; ${found}.
|
|
1508
|
-
${swiftInstallSteps(release,
|
|
1779
|
+
${swiftInstallSteps(release, sdk)}`
|
|
1509
1780
|
);
|
|
1510
1781
|
}
|
|
1511
1782
|
const sdks = (0, import_node_child_process4.execFileSync)(swift, ["sdk", "list"], {
|
|
1512
1783
|
encoding: "utf8",
|
|
1513
1784
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1514
1785
|
});
|
|
1515
|
-
if (!sdks.split("\n").some((line) => line.trim() ===
|
|
1786
|
+
if (!sdks.split("\n").some((line) => line.trim() === sdk.wasmSdkId)) {
|
|
1516
1787
|
throw new Error(
|
|
1517
|
-
`peach compiles Swift with the ${
|
|
1518
|
-
${swiftInstallSteps(release,
|
|
1788
|
+
`peach compiles Swift with the ${sdk.wasmSdkId} SDK, which ${swift} does not have.
|
|
1789
|
+
${swiftInstallSteps(release, sdk)}`
|
|
1519
1790
|
);
|
|
1520
1791
|
}
|
|
1521
|
-
verified.set(release
|
|
1792
|
+
verified.set(`${release}\0${sdk.wasmSdkId}`, bin);
|
|
1522
1793
|
return bin;
|
|
1523
1794
|
}
|
|
1524
|
-
function swiftInstallSteps(release,
|
|
1795
|
+
function swiftInstallSteps(release, wasmSdk) {
|
|
1525
1796
|
const version = release.replace(/^swift-/, "").toLowerCase();
|
|
1526
1797
|
const downloads = `https://download.swift.org/swift-${version}`;
|
|
1527
|
-
const sdk = `swift sdk install ${
|
|
1798
|
+
const sdk = `swift sdk install ${wasmSdk.wasmSdkUrl} --checksum ${wasmSdk.wasmSdkChecksum}`;
|
|
1528
1799
|
if (process.platform === "darwin") {
|
|
1529
1800
|
const swift = `~/Library/Developer/Toolchains/${release}.xctoolchain/usr/bin/swift`;
|
|
1530
1801
|
return [
|
|
@@ -1557,7 +1828,7 @@ function swiftDistributionRoot() {
|
|
|
1557
1828
|
`peach has no Swift distribution for ${process.platform}-${process.arch}; it ships for macOS arm64 and Linux x64 and arm64`
|
|
1558
1829
|
);
|
|
1559
1830
|
}
|
|
1560
|
-
swiftToolchain(lock.release, lock
|
|
1831
|
+
swiftToolchain(lock.release, lock);
|
|
1561
1832
|
const dir = import_node_path7.default.join(rnxHomeDir(), "swift", `${lock.id}-${host2}`);
|
|
1562
1833
|
let pending = installs.get(dir);
|
|
1563
1834
|
if (!pending) {
|
|
@@ -1594,7 +1865,7 @@ function swiftModuleToolchain(root) {
|
|
|
1594
1865
|
const pin = swiftDistributionAt(root) ?? JSON.parse(import_node_fs6.default.readFileSync(import_node_path7.default.join(root, "toolchain.json"), "utf8"));
|
|
1595
1866
|
return {
|
|
1596
1867
|
release: pin.release,
|
|
1597
|
-
toolchainBin: swiftToolchain(pin.release,
|
|
1868
|
+
toolchainBin: swiftToolchain(pin.release, swiftModuleSdk(root))
|
|
1598
1869
|
};
|
|
1599
1870
|
}
|
|
1600
1871
|
|
|
@@ -1608,7 +1879,7 @@ var MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
|
1608
1879
|
var MAX_SWIFT_COMPILE_IMAGES = 128;
|
|
1609
1880
|
var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
1610
1881
|
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
1611
|
-
var SWIFT_HOST_ABI =
|
|
1882
|
+
var SWIFT_HOST_ABI = 15;
|
|
1612
1883
|
var POLL_INTERVAL_MS = 1500;
|
|
1613
1884
|
function swiftNativeEntry(native, file) {
|
|
1614
1885
|
return {
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.688 | (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;
|
|
@@ -7,6 +7,8 @@ class Configuration {
|
|
|
7
7
|
var uiMode: Int = UI_MODE_TYPE_NORMAL or UI_MODE_NIGHT_NO
|
|
8
8
|
internal var localeTag: String = ""
|
|
9
9
|
|
|
10
|
+
internal fun isNight() = uiMode and UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
|
|
11
|
+
|
|
10
12
|
fun setTo(other: Configuration) {
|
|
11
13
|
uiMode = other.uiMode
|
|
12
14
|
localeTag = other.localeTag
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
package android.content.res
|
|
2
2
|
|
|
3
|
+
import android.util.DisplayMetrics
|
|
3
4
|
import dev.peach.app.javaFormat
|
|
4
5
|
import dev.peach.app.peachAppArrays
|
|
5
6
|
import dev.peach.app.peachAppColors
|
|
6
7
|
import dev.peach.app.peachAppPlurals
|
|
7
8
|
import dev.peach.app.peachAppStrings
|
|
8
9
|
|
|
9
|
-
class Resources internal constructor(
|
|
10
|
+
class Resources internal constructor(
|
|
11
|
+
val configuration: Configuration,
|
|
12
|
+
val displayMetrics: DisplayMetrics,
|
|
13
|
+
) {
|
|
10
14
|
class NotFoundException(name: String) : RuntimeException(name)
|
|
11
15
|
|
|
12
16
|
// a context's theme; app color resources are plain values, so getColor
|
|
@@ -40,8 +44,7 @@ class Resources internal constructor(val configuration: Configuration) {
|
|
|
40
44
|
// values
|
|
41
45
|
fun getColor(id: Int, theme: Theme?): Int {
|
|
42
46
|
val colors = peachAppColors[id] ?: throw NotFoundException("Resource ID #0x${id.toString(16)}")
|
|
43
|
-
|
|
44
|
-
return colors[if (night) 1 else 0]
|
|
47
|
+
return colors[if (configuration.isNight()) 1 else 0]
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
@Deprecated("Use getColor(int, Theme) instead.")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package android.util
|
|
2
|
+
|
|
3
|
+
// the display's density as resources read it: densityDpi is the bucketless
|
|
4
|
+
// dots per inch and density its scale over the 160 dpi baseline
|
|
5
|
+
class DisplayMetrics {
|
|
6
|
+
var density: Float = 0f
|
|
7
|
+
var densityDpi: Int = 0
|
|
8
|
+
|
|
9
|
+
companion object {
|
|
10
|
+
const val DENSITY_DEFAULT = 160
|
|
11
|
+
}
|
|
12
|
+
}
|