peachsim 0.1.1979 → 0.1.1982
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/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +155 -39
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +154 -38
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +155 -39
- 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 +2 -2
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +2 -2
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +155 -39
- package/dist-lib/swift-compile.cjs +22 -5
- package/dist-lib/swift-compile.mjs +22 -5
- 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 +23 -6
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/visible-frame.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
- package/package.json +1 -1
- package/src/expo-discovery-cache.ts +2 -0
- package/src/expo-swift-host.ts +144 -31
- package/src/expoSwiftContract.ts +1 -0
- package/src/swift-compile.ts +21 -2
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1982 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -16267,7 +16267,7 @@ function swiftModuleDigest(root) {
|
|
|
16267
16267
|
return digest;
|
|
16268
16268
|
}
|
|
16269
16269
|
function swiftProjectBuildKey(moduleRoot, release) {
|
|
16270
|
-
return (0, import_node_crypto13.createHash)("sha256").update(
|
|
16270
|
+
return (0, import_node_crypto13.createHash)("sha256").update(`swift-framework/v2\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
|
|
16271
16271
|
}
|
|
16272
16272
|
var SYSTEM_MODULE_LIBRARIES = {
|
|
16273
16273
|
"sqlite3.h": "sqlite3",
|
|
@@ -16784,7 +16784,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
|
|
|
16784
16784
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
16785
16785
|
var MULTI_MANIFEST_VERSION = 66;
|
|
16786
16786
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
16787
|
-
var compilerSourceDigest = true ? "
|
|
16787
|
+
var compilerSourceDigest = true ? "2b36a6526c1736968b10c07d3f0413954b745c6a495b4b68702c61e477ba2565" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
16788
16788
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
16789
16789
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
16790
16790
|
hash.update(`swift-compile
|
|
@@ -20587,7 +20587,7 @@ function mirrorTree2(source, target, skip) {
|
|
|
20587
20587
|
if (!wanted.has(name3) && name3 !== skip)
|
|
20588
20588
|
(0, import_node_fs26.rmSync)(import_node_path27.default.join(target, name3), { recursive: true, force: true });
|
|
20589
20589
|
}
|
|
20590
|
-
function stageFrameworkSource(moduleRoot, slot, frameworkKey) {
|
|
20590
|
+
function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
20591
20591
|
if (!slot) return moduleRoot;
|
|
20592
20592
|
const staged = import_node_path27.default.join(slot, "source");
|
|
20593
20593
|
const stagedModule = import_node_path27.default.join(staged, "packages", import_node_path27.default.basename(moduleRoot));
|
|
@@ -20598,6 +20598,16 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey) {
|
|
|
20598
20598
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
20599
20599
|
import_node_path27.default.join(staged, "packages/peachsim/sdk/ios")
|
|
20600
20600
|
);
|
|
20601
|
+
for (const file of swiftModuleInputFiles(moduleRoot)) {
|
|
20602
|
+
if (!file.startsWith("../")) continue;
|
|
20603
|
+
const from = import_node_path27.default.resolve(moduleRoot, file);
|
|
20604
|
+
const to = import_node_path27.default.resolve(stagedModule, file);
|
|
20605
|
+
if ((0, import_node_fs26.existsSync)(to) && (0, import_node_fs26.readFileSync)(from).equals((0, import_node_fs26.readFileSync)(to))) continue;
|
|
20606
|
+
(0, import_node_fs26.mkdirSync)(import_node_path27.default.dirname(to), { recursive: true });
|
|
20607
|
+
(0, import_node_fs26.copyFileSync)(from, to);
|
|
20608
|
+
}
|
|
20609
|
+
if (swiftProjectBuildKey(stagedModule, release) !== frameworkKey)
|
|
20610
|
+
throw new Error("Swift staged framework source differs from the caller");
|
|
20601
20611
|
const modules = import_node_path27.default.join(staged, "node_modules");
|
|
20602
20612
|
const target = (0, import_node_fs26.realpathSync)(import_node_path27.default.join(moduleRoot, "../../node_modules"));
|
|
20603
20613
|
if (!(0, import_node_fs26.existsSync)(modules) || (0, import_node_fs26.readlinkSync)(modules) !== target) {
|
|
@@ -20774,7 +20784,14 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20774
20784
|
const frameworkScratch = swiftFrameworkScratch(frameworkKey);
|
|
20775
20785
|
const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(frameworkKey, moduleRoot, options.signal, work);
|
|
20776
20786
|
return withFrameworkLock(async (slot, frameworkLease) => {
|
|
20777
|
-
const frameworkRoot = stageFrameworkSource(
|
|
20787
|
+
const frameworkRoot = stageFrameworkSource(
|
|
20788
|
+
moduleRoot,
|
|
20789
|
+
slot,
|
|
20790
|
+
frameworkKey,
|
|
20791
|
+
options.release
|
|
20792
|
+
);
|
|
20793
|
+
if (swiftArtifactHash(input, options.release, frameworkRoot) !== hash)
|
|
20794
|
+
throw new Error("Swift staged project source differs from the caller");
|
|
20778
20795
|
report("preparing compiler plugins");
|
|
20779
20796
|
const pluginsFor = (pluginLease) => ensureMacroPlugins(
|
|
20780
20797
|
frameworkRoot,
|
|
@@ -29738,7 +29755,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
29738
29755
|
return hash.digest("hex");
|
|
29739
29756
|
}
|
|
29740
29757
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
29741
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
29758
|
+
var STANDIN_SOURCE_DIGEST = true ? "5cfe4c5e593a540246f73f905de64026203a300735fd8f8a64343838e88f2bb9" : standinSourceDigest();
|
|
29742
29759
|
|
|
29743
29760
|
// src/swift-standins.ts
|
|
29744
29761
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1982 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1982 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -65,6 +65,7 @@ export interface FilterValue {
|
|
|
65
65
|
_colorMatrix?: number[];
|
|
66
66
|
_colorMultiply?: unknown;
|
|
67
67
|
_luminanceToAlpha?: boolean;
|
|
68
|
+
_opaqueBlur?: number;
|
|
68
69
|
_metalShaderEffect?: unknown;
|
|
69
70
|
}
|
|
70
71
|
export interface CssLengthPct {
|
|
@@ -180,6 +181,9 @@ export type ParsedFilterOp = {
|
|
|
180
181
|
} | {
|
|
181
182
|
type: 'blur';
|
|
182
183
|
value: number;
|
|
184
|
+
} | {
|
|
185
|
+
type: 'opaque-blur';
|
|
186
|
+
value: number;
|
|
183
187
|
} | {
|
|
184
188
|
type: 'contrast';
|
|
185
189
|
value: number;
|
package/package.json
CHANGED
|
@@ -124,6 +124,7 @@ function isExpoSwiftSourceUnit(value: unknown): value is ExpoSwiftSourceUnit {
|
|
|
124
124
|
strings(value.reactDelegateHandlers) &&
|
|
125
125
|
stringRecord(value.files) &&
|
|
126
126
|
strings(value.frameworks) &&
|
|
127
|
+
(value.workspaceSources === undefined || strings(value.workspaceSources)) &&
|
|
127
128
|
(value.nativeTargets === undefined ||
|
|
128
129
|
(Array.isArray(value.nativeTargets) && value.nativeTargets.every(isRecord))) &&
|
|
129
130
|
(value.nativeFiles === undefined || stringRecord(value.nativeFiles)) &&
|
|
@@ -161,6 +162,7 @@ function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
|
161
162
|
strings(value.reactDelegateHandlers) &&
|
|
162
163
|
digestRecord(value.files) &&
|
|
163
164
|
strings(value.frameworks) &&
|
|
165
|
+
(value.workspaceSources === undefined || strings(value.workspaceSources)) &&
|
|
164
166
|
(value.nativeTargets === undefined ||
|
|
165
167
|
(strings(value.nativeTargets) && value.nativeTargets.every(isDigest))) &&
|
|
166
168
|
(value.nativeFiles === undefined || digestRecord(value.nativeFiles)) &&
|
package/src/expo-swift-host.ts
CHANGED
|
@@ -577,12 +577,17 @@ function cloneUnits(units: ExpoSwiftSourceUnit[] | null): ExpoSwiftSourceUnit[]
|
|
|
577
577
|
appDelegateSubscribers: unit.appDelegateSubscribers.slice(),
|
|
578
578
|
reactDelegateHandlers: unit.reactDelegateHandlers.slice(),
|
|
579
579
|
frameworks: unit.frameworks.slice(),
|
|
580
|
+
...(unit.workspaceSources ? { workspaceSources: unit.workspaceSources.slice() } : {}),
|
|
580
581
|
files: { ...unit.files },
|
|
581
582
|
...(unit.nativeFiles ? { nativeFiles: { ...unit.nativeFiles } } : {}),
|
|
582
583
|
...(unit.headerAliases ? { headerAliases: { ...unit.headerAliases } } : {}),
|
|
583
584
|
...(unit.resources ? { resources: { ...unit.resources } } : {}),
|
|
584
585
|
...(unit.resourceBundles
|
|
585
|
-
? {
|
|
586
|
+
? {
|
|
587
|
+
resourceBundles: unit.resourceBundles.map((bundle) => ({
|
|
588
|
+
...bundle,
|
|
589
|
+
})),
|
|
590
|
+
}
|
|
586
591
|
: {}),
|
|
587
592
|
...(unit.nativeTargets
|
|
588
593
|
? { nativeTargets: unit.nativeTargets.map(cloneNativeTarget) }
|
|
@@ -1152,6 +1157,8 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1152
1157
|
installed?.input.files['Package.swift'] ?? '',
|
|
1153
1158
|
)
|
|
1154
1159
|
const units: ExpoSwiftSourceUnit[] = []
|
|
1160
|
+
const dependencyUnits: ExpoSwiftSourceUnit[] = []
|
|
1161
|
+
const processed = new Set<string>()
|
|
1155
1162
|
const namespacesSeen = new Set<string>()
|
|
1156
1163
|
const namespaceGroups = new Map<string, string[]>()
|
|
1157
1164
|
let answeredInstalled = false
|
|
@@ -1160,9 +1167,19 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1160
1167
|
let fileCount = 0
|
|
1161
1168
|
// native Expo resolves packages by name before generating its Apple provider.
|
|
1162
1169
|
// the search result is keyed by that name; older autolinkers add no name field.
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
))
|
|
1170
|
+
const entries = Object.entries(search).sort(([a], [b]) => a.localeCompare(b))
|
|
1171
|
+
const queue = entries.slice()
|
|
1172
|
+
const queued = new Set(entries.map(([name]) => name))
|
|
1173
|
+
const reconsider = () => {
|
|
1174
|
+
for (const entry of entries)
|
|
1175
|
+
if (!processed.has(entry[0]) && !queued.has(entry[0])) {
|
|
1176
|
+
queue.push(entry)
|
|
1177
|
+
queued.add(entry[0])
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
for (const [packageName, entry] of queue) {
|
|
1181
|
+
queued.delete(packageName)
|
|
1182
|
+
if (processed.has(packageName)) continue
|
|
1166
1183
|
if (!entry || typeof entry !== 'object')
|
|
1167
1184
|
throw new Error('invalid Expo autolinking entry')
|
|
1168
1185
|
const sourceRoot = Reflect.get(entry, 'path')
|
|
@@ -1171,12 +1188,15 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1171
1188
|
const canonical = fs.realpathSync(sourceRoot)
|
|
1172
1189
|
// an installed package with a native seam keeps it; one without compiles
|
|
1173
1190
|
// through the same autolinker-selected route as app-local modules.
|
|
1174
|
-
|
|
1191
|
+
const answered =
|
|
1175
1192
|
canonical.split(path.sep).includes('node_modules') &&
|
|
1176
1193
|
peachAnsweredNativePackages().has(packageName)
|
|
1177
|
-
) {
|
|
1194
|
+
if (answered) {
|
|
1178
1195
|
answeredInstalled = true
|
|
1179
|
-
|
|
1196
|
+
if (installed || prepareNative) {
|
|
1197
|
+
processed.add(packageName)
|
|
1198
|
+
continue
|
|
1199
|
+
}
|
|
1180
1200
|
}
|
|
1181
1201
|
// the autolinker read these in a child, so the parent can only stamp them
|
|
1182
1202
|
// afterwards. one modified since the child started may be newer than what
|
|
@@ -1223,12 +1243,25 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1223
1243
|
// a package with pods is rediscovered in the prepared workspace, which has no caps.
|
|
1224
1244
|
const deferredToWorkspace =
|
|
1225
1245
|
prepareNative && !installedWorkspace && Array.isArray(pods) && pods.length > 0
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1246
|
+
const dependencyOnly =
|
|
1247
|
+
answered ||
|
|
1248
|
+
((!Array.isArray(modules) || modules.length === 0) &&
|
|
1249
|
+
subscriberNames.length === 0 &&
|
|
1250
|
+
handlerNames.length === 0)
|
|
1251
|
+
if (dependencyOnly) {
|
|
1252
|
+
if (installed || prepareNative || !Array.isArray(namespaces)) {
|
|
1253
|
+
processed.add(packageName)
|
|
1254
|
+
continue
|
|
1255
|
+
}
|
|
1256
|
+
const imports = new Set(
|
|
1257
|
+
[...units, ...dependencyUnits].flatMap((unit) =>
|
|
1258
|
+
Object.values(unit.files).flatMap((source) => swiftImportNames(source)),
|
|
1259
|
+
),
|
|
1260
|
+
)
|
|
1261
|
+
if (!namespaces.some((name) => typeof name === 'string' && imports.has(name)))
|
|
1262
|
+
continue
|
|
1263
|
+
}
|
|
1264
|
+
processed.add(packageName)
|
|
1232
1265
|
if (
|
|
1233
1266
|
!Array.isArray(namespaces) ||
|
|
1234
1267
|
namespaces.length === 0 ||
|
|
@@ -1252,9 +1285,10 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1252
1285
|
// without that membership the package's natives cannot be split, so it
|
|
1253
1286
|
// stays unbuilt and the app reports it like any module Peach lacks.
|
|
1254
1287
|
if (!nativeWorkspaceAvailable()) {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1288
|
+
if (!answered)
|
|
1289
|
+
report(
|
|
1290
|
+
`${packageName}: ${namespaces.join(', ')} need CocoaPods target membership, which only a Mac prepares; not compiled`,
|
|
1291
|
+
)
|
|
1258
1292
|
continue
|
|
1259
1293
|
}
|
|
1260
1294
|
const prepared = await prepareExpoNativeWorkspace(appRoot, signal, iosTarget)
|
|
@@ -1382,8 +1416,16 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1382
1416
|
walk(file, binary || framework)
|
|
1383
1417
|
continue
|
|
1384
1418
|
}
|
|
1385
|
-
if (!binary && target.isFile() && /\.(?:mm?|c|cc|cpp)$/.test(child.name))
|
|
1386
|
-
|
|
1419
|
+
if (!binary && target.isFile() && /\.(?:mm?|c|cc|cpp)$/.test(child.name)) {
|
|
1420
|
+
const source = linked ?? resolveSource(file)
|
|
1421
|
+
if (
|
|
1422
|
+
fs.statSync(source).size > 4096 ||
|
|
1423
|
+
!/^(?:\s|\/\/[^\n]*|\/\*[\s\S]*?\*\/)*$/.test(
|
|
1424
|
+
fs.readFileSync(source, 'utf8'),
|
|
1425
|
+
)
|
|
1426
|
+
)
|
|
1427
|
+
nativeSources.add(path.relative(ios, file))
|
|
1428
|
+
}
|
|
1387
1429
|
if (!target.isFile() || !child.name.endsWith('.swift')) continue
|
|
1388
1430
|
const source = linked ?? resolveSource(file)
|
|
1389
1431
|
if (sources.has(source)) continue
|
|
@@ -1493,6 +1535,26 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1493
1535
|
fs.readFileSync(path.join(ios, podspec), 'utf8'),
|
|
1494
1536
|
)?.[1]
|
|
1495
1537
|
: undefined
|
|
1538
|
+
if (dependencyOnly && Object.keys(files).length > 0) {
|
|
1539
|
+
dependencyUnits.push({
|
|
1540
|
+
namespace,
|
|
1541
|
+
moduleId: namespace,
|
|
1542
|
+
classes: [],
|
|
1543
|
+
bridgeModules: [],
|
|
1544
|
+
appDelegateSubscribers: [],
|
|
1545
|
+
reactDelegateHandlers: [],
|
|
1546
|
+
files,
|
|
1547
|
+
frameworks: [...frameworks],
|
|
1548
|
+
...(nativeSources.size ? { workspaceSources: [namespace] } : {}),
|
|
1549
|
+
...(podspecFloor
|
|
1550
|
+
? {
|
|
1551
|
+
nativeTargets: [synthesizedNativeTarget(namespace, podspecFloor)],
|
|
1552
|
+
}
|
|
1553
|
+
: {}),
|
|
1554
|
+
})
|
|
1555
|
+
reconsider()
|
|
1556
|
+
}
|
|
1557
|
+
if (dependencyOnly) continue
|
|
1496
1558
|
for (const declaration of declarations) {
|
|
1497
1559
|
const className = declaration.reference
|
|
1498
1560
|
const owner = className.split('.')[0]!
|
|
@@ -1536,11 +1598,14 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1536
1598
|
frameworks: [...frameworks],
|
|
1537
1599
|
...(absentFrameworks.length > 0 ? { absentFrameworks } : {}),
|
|
1538
1600
|
...(podspecFloor
|
|
1539
|
-
? {
|
|
1601
|
+
? {
|
|
1602
|
+
nativeTargets: [synthesizedNativeTarget(namespace, podspecFloor)],
|
|
1603
|
+
}
|
|
1540
1604
|
: {}),
|
|
1541
1605
|
}
|
|
1542
1606
|
unit.files[EXPO_SWIFT_ENTRY] = expoEntry([unit])
|
|
1543
1607
|
units.push(unit)
|
|
1608
|
+
reconsider()
|
|
1544
1609
|
}
|
|
1545
1610
|
}
|
|
1546
1611
|
if (namespaces.length > 1) {
|
|
@@ -1675,23 +1740,29 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1675
1740
|
)
|
|
1676
1741
|
const allFiles: Record<string, string> = Object.assign(
|
|
1677
1742
|
{},
|
|
1678
|
-
...units.map((unit) => unit.files),
|
|
1743
|
+
...[...units, ...dependencyUnits].map((unit) => unit.files),
|
|
1679
1744
|
)
|
|
1680
|
-
const targets = [
|
|
1745
|
+
const targets = [
|
|
1746
|
+
...new Set([...units, ...dependencyUnits].map((unit) => unit.namespace)),
|
|
1747
|
+
].map((namespace) => ({
|
|
1681
1748
|
name: namespace,
|
|
1682
1749
|
path: `Sources/${namespace}`,
|
|
1683
1750
|
}))
|
|
1684
1751
|
const dependencies = swiftTargetDependencies(allFiles, targets)
|
|
1685
1752
|
const byNamespace = new Map<string, ExpoSwiftSourceUnit[]>()
|
|
1686
|
-
for (const unit of units) {
|
|
1753
|
+
for (const unit of [...units, ...dependencyUnits]) {
|
|
1687
1754
|
const entries = byNamespace.get(unit.namespace) ?? []
|
|
1688
1755
|
entries.push(unit)
|
|
1689
1756
|
byNamespace.set(unit.namespace, entries)
|
|
1690
1757
|
}
|
|
1691
1758
|
for (const unit of units) {
|
|
1692
1759
|
const included = new Set([unit.namespace])
|
|
1760
|
+
const ownDependencies =
|
|
1761
|
+
swiftTargetDependencies(unit.files, targets).get(unit.namespace) ?? []
|
|
1693
1762
|
const visit = (namespace: string) => {
|
|
1694
|
-
for (const dependency of
|
|
1763
|
+
for (const dependency of namespace === unit.namespace
|
|
1764
|
+
? ownDependencies
|
|
1765
|
+
: (dependencies.get(namespace) ?? [])) {
|
|
1695
1766
|
if (!byNamespace.has(dependency) || included.has(dependency)) continue
|
|
1696
1767
|
included.add(dependency)
|
|
1697
1768
|
visit(dependency)
|
|
@@ -1708,6 +1779,12 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1708
1779
|
...dependency.flatMap((item) => item.frameworks),
|
|
1709
1780
|
]),
|
|
1710
1781
|
]
|
|
1782
|
+
unit.workspaceSources = [
|
|
1783
|
+
...new Set([
|
|
1784
|
+
...(unit.workspaceSources ?? []),
|
|
1785
|
+
...dependency.flatMap((item) => item.workspaceSources ?? []),
|
|
1786
|
+
]),
|
|
1787
|
+
]
|
|
1711
1788
|
unit.nativeTargets = [
|
|
1712
1789
|
...new Map(
|
|
1713
1790
|
[
|
|
@@ -1730,11 +1807,24 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1730
1807
|
if (name.startsWith(`Sources/${namespace}/`)) unit.files[name] = source
|
|
1731
1808
|
}
|
|
1732
1809
|
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
'',
|
|
1736
|
-
targetSettings([...included].flatMap((namespace) => byNamespace.get(namespace)!)),
|
|
1810
|
+
const settings = targetSettings(
|
|
1811
|
+
[...included].flatMap((namespace) => byNamespace.get(namespace)!),
|
|
1737
1812
|
)
|
|
1813
|
+
if (!installed)
|
|
1814
|
+
for (const namespace of included)
|
|
1815
|
+
settings.set(namespace, {
|
|
1816
|
+
languageMode: 5,
|
|
1817
|
+
mainActorIsolation: false,
|
|
1818
|
+
resources: false,
|
|
1819
|
+
...settings.get(namespace),
|
|
1820
|
+
dependencies: (namespace === unit.namespace
|
|
1821
|
+
? ownDependencies
|
|
1822
|
+
: (dependencies.get(namespace) ?? [])
|
|
1823
|
+
)
|
|
1824
|
+
.filter((name) => included.has(name))
|
|
1825
|
+
.map((name) => ({ kind: 'target', name })),
|
|
1826
|
+
})
|
|
1827
|
+
unit.files['Package.swift'] = expoManifest(unit.files, '', settings)
|
|
1738
1828
|
}
|
|
1739
1829
|
if (nativeAppIdentity)
|
|
1740
1830
|
for (const unit of units) unit.nativeAppIdentity = nativeAppIdentity
|
|
@@ -1790,8 +1880,21 @@ function targetSettings(units: ExpoSwiftSourceUnit[]) {
|
|
|
1790
1880
|
Partial<Pick<SwiftPackageTarget, 'resources'>>
|
|
1791
1881
|
>()
|
|
1792
1882
|
for (const unit of units) {
|
|
1793
|
-
for (const target of swiftManifestTargets(unit.files['Package.swift'] ?? ''))
|
|
1794
|
-
settings.
|
|
1883
|
+
for (const target of swiftManifestTargets(unit.files['Package.swift'] ?? '')) {
|
|
1884
|
+
const previous = settings.get(target.name)
|
|
1885
|
+
const dependencies = [
|
|
1886
|
+
...(previous?.dependencies ?? []),
|
|
1887
|
+
...(target.dependencies ?? []),
|
|
1888
|
+
]
|
|
1889
|
+
settings.set(target.name, {
|
|
1890
|
+
...target,
|
|
1891
|
+
dependencies: [
|
|
1892
|
+
...new Map(
|
|
1893
|
+
dependencies.map((dependency) => [JSON.stringify(dependency), dependency]),
|
|
1894
|
+
).values(),
|
|
1895
|
+
],
|
|
1896
|
+
})
|
|
1897
|
+
}
|
|
1795
1898
|
if (unit.swiftLanguageMode !== undefined)
|
|
1796
1899
|
settings.set(unit.namespace, {
|
|
1797
1900
|
...settings.get(unit.namespace),
|
|
@@ -2248,7 +2351,11 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2248
2351
|
projectFor(packagePath).headerAliases = unit.headerAliases
|
|
2249
2352
|
projectFor(packagePath).resourceBundles = unit.resourceBundles
|
|
2250
2353
|
projectFor(packagePath).bundleFiles = unit.resources
|
|
2251
|
-
? {
|
|
2354
|
+
? {
|
|
2355
|
+
files: unit.resources,
|
|
2356
|
+
bundles: unit.resourceBundles ?? [],
|
|
2357
|
+
watched: [],
|
|
2358
|
+
}
|
|
2252
2359
|
: undefined
|
|
2253
2360
|
const stamp = sourceContentStamp(packagePath, module.root)
|
|
2254
2361
|
const failed = readFailedCompilation(packagePath)
|
|
@@ -2451,8 +2558,14 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2451
2558
|
linked.push(unit)
|
|
2452
2559
|
} catch (error) {
|
|
2453
2560
|
signal.throwIfAborted()
|
|
2561
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
2562
|
+
const missingImports = [...message.matchAll(/^ (\S+)/gm)].map(
|
|
2563
|
+
(match) => match[1],
|
|
2564
|
+
)
|
|
2454
2565
|
const diagnostic = [
|
|
2455
|
-
error instanceof
|
|
2566
|
+
error instanceof SwiftMissingModulesError && unit.workspaceSources?.length
|
|
2567
|
+
? `${unit.workspaceSources.map((name) => `${name} needs a Mac-prepared workspace`).join('; ')}; unresolved imports: ${missingImports.join(', ')}`
|
|
2568
|
+
: message,
|
|
2456
2569
|
...(gaps.get(unit) ?? []),
|
|
2457
2570
|
].join('\n')
|
|
2458
2571
|
// a unit from the installed workspace carries no app source
|
package/src/expoSwiftContract.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface ExpoSwiftSourceUnit {
|
|
|
27
27
|
reactDelegateHandlers: string[]
|
|
28
28
|
files: Record<string, string>
|
|
29
29
|
frameworks: string[]
|
|
30
|
+
workspaceSources?: string[]
|
|
30
31
|
// vendored_frameworks the module's podspec declares that are not on disk
|
|
31
32
|
absentFrameworks?: string[]
|
|
32
33
|
nativeTargets?: SwiftNativeTarget[]
|
package/src/swift-compile.ts
CHANGED
|
@@ -738,7 +738,7 @@ export function swiftModuleDigest(root: string): Buffer {
|
|
|
738
738
|
// source revisions need separate object trees, while app edits keep one warm tree.
|
|
739
739
|
export function swiftProjectBuildKey(moduleRoot: string, release: string): string {
|
|
740
740
|
return createHash('sha256')
|
|
741
|
-
.update(
|
|
741
|
+
.update(`swift-framework/v2\0${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`)
|
|
742
742
|
.update(swiftModuleDigest(moduleRoot))
|
|
743
743
|
.digest('hex')
|
|
744
744
|
.slice(0, 32)
|
|
@@ -6706,6 +6706,7 @@ function stageFrameworkSource(
|
|
|
6706
6706
|
moduleRoot: string,
|
|
6707
6707
|
slot: string | null,
|
|
6708
6708
|
frameworkKey: string,
|
|
6709
|
+
release: string,
|
|
6709
6710
|
): string {
|
|
6710
6711
|
if (!slot) return moduleRoot
|
|
6711
6712
|
const staged = path.join(slot, 'source')
|
|
@@ -6718,6 +6719,17 @@ function stageFrameworkSource(
|
|
|
6718
6719
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
6719
6720
|
path.join(staged, 'packages/peachsim/sdk/ios'),
|
|
6720
6721
|
)
|
|
6722
|
+
// producer inputs outside the mirrored trees also belong to the snapshot.
|
|
6723
|
+
for (const file of swiftModuleInputFiles(moduleRoot)) {
|
|
6724
|
+
if (!file.startsWith('../')) continue
|
|
6725
|
+
const from = path.resolve(moduleRoot, file)
|
|
6726
|
+
const to = path.resolve(stagedModule, file)
|
|
6727
|
+
if (existsSync(to) && readFileSync(from).equals(readFileSync(to))) continue
|
|
6728
|
+
mkdirSync(path.dirname(to), { recursive: true })
|
|
6729
|
+
copyFileSync(from, to)
|
|
6730
|
+
}
|
|
6731
|
+
if (swiftProjectBuildKey(stagedModule, release) !== frameworkKey)
|
|
6732
|
+
throw new Error('Swift staged framework source differs from the caller')
|
|
6721
6733
|
// the plugin build resolves the macro scanner from the module's node_modules
|
|
6722
6734
|
const modules = path.join(staged, 'node_modules')
|
|
6723
6735
|
const target = realpathSync(path.join(moduleRoot, '../../node_modules'))
|
|
@@ -6931,7 +6943,14 @@ function compileSwiftProjectOnce(
|
|
|
6931
6943
|
? work(null)
|
|
6932
6944
|
: withSwiftFrameworkSlot(frameworkKey, moduleRoot, options.signal, work)
|
|
6933
6945
|
return withFrameworkLock(async (slot, frameworkLease) => {
|
|
6934
|
-
const frameworkRoot = stageFrameworkSource(
|
|
6946
|
+
const frameworkRoot = stageFrameworkSource(
|
|
6947
|
+
moduleRoot,
|
|
6948
|
+
slot,
|
|
6949
|
+
frameworkKey,
|
|
6950
|
+
options.release,
|
|
6951
|
+
)
|
|
6952
|
+
if (swiftArtifactHash(input, options.release, frameworkRoot) !== hash)
|
|
6953
|
+
throw new Error('Swift staged project source differs from the caller')
|
|
6935
6954
|
report('preparing compiler plugins')
|
|
6936
6955
|
const pluginsFor = (pluginLease?: SwiftRootLease) =>
|
|
6937
6956
|
ensureMacroPlugins(
|