peachsim 0.1.800 → 0.1.809
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/drivers/playwright-sim-host.ts +2 -0
- package/cli/outbound-endpoints.ts +0 -4
- 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/bundle-channel.cjs +132 -10
- 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 +46 -7
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +132 -10
- 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 +252 -108
- 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 +252 -108
- package/dist-lib/swift-compile.cjs +141 -11
- package/dist-lib/swift-compile.mjs +140 -11
- 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 +132 -10
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +119 -0
- package/dist-lib/worklet-executable.mjs +93 -0
- package/package.json +9 -1
- package/src/swift-compile.ts +160 -11
- package/src/vite-plugin.ts +5 -2
- package/src/worklet-executable.ts +125 -0
- package/src/worklets-babel.ts +47 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -61,6 +61,7 @@ __export(swift_compile_exports, {
|
|
|
61
61
|
swiftSourceClosure: () => swiftSourceClosure,
|
|
62
62
|
swiftTargetDependencies: () => swiftTargetDependencies,
|
|
63
63
|
syncSwiftTree: () => syncSwiftTree,
|
|
64
|
+
tableProtocolConformances: () => tableProtocolConformances,
|
|
64
65
|
withNativeSourceGlue: () => withNativeSourceGlue,
|
|
65
66
|
writeSwiftProject: () => writeSwiftProject
|
|
66
67
|
});
|
|
@@ -649,7 +650,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
649
650
|
var MULTI_MANIFEST_VERSION = 12;
|
|
650
651
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
651
652
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
652
|
-
hash.update(`swift-compile/
|
|
653
|
+
hash.update(`swift-compile/v20
|
|
653
654
|
${release}
|
|
654
655
|
`);
|
|
655
656
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -1247,6 +1248,125 @@ function lowerNotificationDelegate(source) {
|
|
|
1247
1248
|
result = result.slice(0, at) + text + result.slice(at + count);
|
|
1248
1249
|
return result;
|
|
1249
1250
|
}
|
|
1251
|
+
function tableProtocolConformances(sources) {
|
|
1252
|
+
const parents = /* @__PURE__ */ new Map();
|
|
1253
|
+
for (const source of sources) {
|
|
1254
|
+
const code = swiftCodeMask(source);
|
|
1255
|
+
for (const owner of code.matchAll(
|
|
1256
|
+
/\b(?:class|extension)\s+([A-Za-z_]\w*)\s*:\s*([^{}]+)\{/g
|
|
1257
|
+
)) {
|
|
1258
|
+
const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
|
|
1259
|
+
for (const type of owner[2].matchAll(/\b[A-Za-z_]\w*\b/g)) inherited.add(type[0]);
|
|
1260
|
+
parents.set(owner[1], inherited);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
const result = /* @__PURE__ */ new Map();
|
|
1264
|
+
const protocols = ["UITableViewDataSource", "UITableViewDelegate"];
|
|
1265
|
+
for (const type of parents.keys()) {
|
|
1266
|
+
const pending = [type];
|
|
1267
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1268
|
+
const conformances = /* @__PURE__ */ new Set();
|
|
1269
|
+
while (pending.length) {
|
|
1270
|
+
const next = pending.pop();
|
|
1271
|
+
if (seen.has(next)) continue;
|
|
1272
|
+
seen.add(next);
|
|
1273
|
+
if (protocols.includes(next)) conformances.add(next);
|
|
1274
|
+
for (const parent of parents.get(next) ?? []) pending.push(parent);
|
|
1275
|
+
}
|
|
1276
|
+
if (conformances.size) result.set(type, conformances);
|
|
1277
|
+
}
|
|
1278
|
+
return result;
|
|
1279
|
+
}
|
|
1280
|
+
function lowerTableProtocolMethods(source, conformances) {
|
|
1281
|
+
const code = swiftCodeMask(source);
|
|
1282
|
+
const dataSource = {
|
|
1283
|
+
numberOfRowsInSection: "tableView:numberOfRowsInSection:",
|
|
1284
|
+
cellForRowAt: "tableView:cellForRowAtIndexPath:",
|
|
1285
|
+
titleForHeaderInSection: "tableView:titleForHeaderInSection:",
|
|
1286
|
+
titleForFooterInSection: "tableView:titleForFooterInSection:",
|
|
1287
|
+
canEditRowAt: "tableView:canEditRowAtIndexPath:",
|
|
1288
|
+
commit: "tableView:commitEditingStyle:forRowAtIndexPath:"
|
|
1289
|
+
};
|
|
1290
|
+
const delegate = {
|
|
1291
|
+
willDisplay: "tableView:willDisplayCell:forRowAtIndexPath:",
|
|
1292
|
+
didEndDisplaying: "tableView:didEndDisplayingCell:forRowAtIndexPath:",
|
|
1293
|
+
heightForRowAt: "tableView:heightForRowAtIndexPath:",
|
|
1294
|
+
estimatedHeightForRowAt: "tableView:estimatedHeightForRowAtIndexPath:",
|
|
1295
|
+
heightForHeaderInSection: "tableView:heightForHeaderInSection:",
|
|
1296
|
+
heightForFooterInSection: "tableView:heightForFooterInSection:",
|
|
1297
|
+
estimatedHeightForHeaderInSection: "tableView:estimatedHeightForHeaderInSection:",
|
|
1298
|
+
estimatedHeightForFooterInSection: "tableView:estimatedHeightForFooterInSection:",
|
|
1299
|
+
viewForHeaderInSection: "tableView:viewForHeaderInSection:",
|
|
1300
|
+
viewForFooterInSection: "tableView:viewForFooterInSection:",
|
|
1301
|
+
willDisplayHeaderView: "tableView:willDisplayHeaderView:forSection:",
|
|
1302
|
+
willDisplayFooterView: "tableView:willDisplayFooterView:forSection:",
|
|
1303
|
+
didEndDisplayingHeaderView: "tableView:didEndDisplayingHeaderView:forSection:",
|
|
1304
|
+
didEndDisplayingFooterView: "tableView:didEndDisplayingFooterView:forSection:",
|
|
1305
|
+
shouldHighlightRowAt: "tableView:shouldHighlightRowAtIndexPath:",
|
|
1306
|
+
didHighlightRowAt: "tableView:didHighlightRowAtIndexPath:",
|
|
1307
|
+
didUnhighlightRowAt: "tableView:didUnhighlightRowAtIndexPath:",
|
|
1308
|
+
willSelectRowAt: "tableView:willSelectRowAtIndexPath:",
|
|
1309
|
+
willDeselectRowAt: "tableView:willDeselectRowAtIndexPath:",
|
|
1310
|
+
didSelectRowAt: "tableView:didSelectRowAtIndexPath:",
|
|
1311
|
+
didDeselectRowAt: "tableView:didDeselectRowAtIndexPath:",
|
|
1312
|
+
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:",
|
|
1313
|
+
editingStyleForRowAt: "tableView:editingStyleForRowAtIndexPath:",
|
|
1314
|
+
leadingSwipeActionsConfigurationForRowAt: "tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1315
|
+
trailingSwipeActionsConfigurationForRowAt: "tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1316
|
+
willBeginEditingRowAt: "tableView:willBeginEditingRowAtIndexPath:",
|
|
1317
|
+
didEndEditingRowAt: "tableView:didEndEditingRowAtIndexPath:"
|
|
1318
|
+
};
|
|
1319
|
+
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
1320
|
+
const edits = [];
|
|
1321
|
+
for (const owner of code.matchAll(/\b(?:class|extension)\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
|
|
1322
|
+
const conforms = conformances.get(owner[1]);
|
|
1323
|
+
if (!conforms) continue;
|
|
1324
|
+
const selectors = {
|
|
1325
|
+
...conforms.has("UITableViewDataSource") ? dataSource : {},
|
|
1326
|
+
...conforms.has("UITableViewDelegate") ? delegate : {}
|
|
1327
|
+
};
|
|
1328
|
+
const open = owner.index + owner[0].length - 1;
|
|
1329
|
+
const close = closingBrace(code, braces, open);
|
|
1330
|
+
let depth = 1;
|
|
1331
|
+
let previous = open + 1;
|
|
1332
|
+
for (const token of swiftCodeScan(code.slice(open + 1, close - 1)).tokens) {
|
|
1333
|
+
const at = open + 1 + token;
|
|
1334
|
+
if (code[at] === "{") depth++;
|
|
1335
|
+
else if (code[at] === "}") {
|
|
1336
|
+
depth--;
|
|
1337
|
+
if (depth === 1) previous = at + 1;
|
|
1338
|
+
} else if (depth === 1 && /^func\b/.test(code.slice(at))) {
|
|
1339
|
+
const signature = code.slice(at, code.indexOf("{", at));
|
|
1340
|
+
const prefix = code.slice(previous, at);
|
|
1341
|
+
const attributes = /(?:@\w+(?:\([^{}]*\))?\s*|(?:public|open|private|fileprivate|internal|final|override|static|class|nonisolated|dynamic)\s+)*$/.exec(
|
|
1342
|
+
prefix
|
|
1343
|
+
)?.[0] ?? "";
|
|
1344
|
+
if (/\b(?:override|static|class)\b|@(?:objc|ObjC|IBAction)\b/.test(attributes))
|
|
1345
|
+
continue;
|
|
1346
|
+
let selector;
|
|
1347
|
+
if (conforms.has("UITableViewDataSource") && /^func\s+numberOfSections\s*\(\s*in\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*\)/.test(
|
|
1348
|
+
signature
|
|
1349
|
+
))
|
|
1350
|
+
selector = "numberOfSectionsInTableView:";
|
|
1351
|
+
else {
|
|
1352
|
+
const match = /^func\s+tableView\s*\(\s*_\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*,\s*(\w+)\b/.exec(
|
|
1353
|
+
signature
|
|
1354
|
+
);
|
|
1355
|
+
if (match) selector = selectors[match[1]];
|
|
1356
|
+
}
|
|
1357
|
+
if (selector)
|
|
1358
|
+
edits.push([
|
|
1359
|
+
at,
|
|
1360
|
+
`${/\bnonisolated\b/.test(attributes) ? "" : "@MainActor "}@ObjC(${JSON.stringify(selector)}) `
|
|
1361
|
+
]);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
let result = source;
|
|
1366
|
+
for (const [at, text] of edits.sort((a, b) => b[0] - a[0]))
|
|
1367
|
+
result = result.slice(0, at) + text + result.slice(at);
|
|
1368
|
+
return result;
|
|
1369
|
+
}
|
|
1250
1370
|
function swiftCodeMask(source) {
|
|
1251
1371
|
const chars = source.split("");
|
|
1252
1372
|
const blank = (from, to) => {
|
|
@@ -1350,9 +1470,9 @@ function swiftCodeMask(source) {
|
|
|
1350
1470
|
scanCode(0, false);
|
|
1351
1471
|
return chars.join("");
|
|
1352
1472
|
}
|
|
1353
|
-
function swiftSourceAsIOS(original, extraObjCExtensions) {
|
|
1473
|
+
function swiftSourceAsIOS(original, extraObjCExtensions, tableConformances = tableProtocolConformances([original])) {
|
|
1354
1474
|
const source = liftExtensionOverrides(
|
|
1355
|
-
lowerNotificationDelegate(original),
|
|
1475
|
+
lowerTableProtocolMethods(lowerNotificationDelegate(original), tableConformances),
|
|
1356
1476
|
extraObjCExtensions
|
|
1357
1477
|
);
|
|
1358
1478
|
const { lineStarts, tokens } = swiftCodeScan(source);
|
|
@@ -1607,7 +1727,7 @@ function swiftCodeScan(source) {
|
|
|
1607
1727
|
}
|
|
1608
1728
|
return { lineStarts: starts, tokens };
|
|
1609
1729
|
}
|
|
1610
|
-
var compiledSource = (file, contents, extraObjCExtensions) => file.endsWith(".swift") ? swiftSourceAsIOS(contents, extraObjCExtensions) : contents;
|
|
1730
|
+
var compiledSource = (file, contents, extraObjCExtensions, tableConformances) => file.endsWith(".swift") ? swiftSourceAsIOS(contents, extraObjCExtensions, tableConformances) : contents;
|
|
1611
1731
|
function prepareSwiftDependency(source, destination) {
|
|
1612
1732
|
(0, import_node_fs2.rmSync)(destination, { recursive: true, force: true });
|
|
1613
1733
|
const origins = [];
|
|
@@ -1623,6 +1743,7 @@ function prepareSwiftDependency(source, destination) {
|
|
|
1623
1743
|
};
|
|
1624
1744
|
gather(source, true);
|
|
1625
1745
|
const objcExtensions = objcExtensionMemberIndex(origins);
|
|
1746
|
+
const tableConformances = tableProtocolConformances(origins);
|
|
1626
1747
|
const copy = (from, to, root) => {
|
|
1627
1748
|
(0, import_node_fs2.mkdirSync)(to, { recursive: true });
|
|
1628
1749
|
for (const entry of (0, import_node_fs2.readdirSync)(from, { withFileTypes: true })) {
|
|
@@ -1634,7 +1755,12 @@ function prepareSwiftDependency(source, destination) {
|
|
|
1634
1755
|
else if (entry.isFile() && entry.name.endsWith(".swift") && !(root && /^Package(@swift-[\d.]+)?\.swift$/.test(entry.name)))
|
|
1635
1756
|
(0, import_node_fs2.writeFileSync)(
|
|
1636
1757
|
target,
|
|
1637
|
-
compiledSource(
|
|
1758
|
+
compiledSource(
|
|
1759
|
+
file,
|
|
1760
|
+
(0, import_node_fs2.readFileSync)(file, "utf8"),
|
|
1761
|
+
objcExtensions,
|
|
1762
|
+
tableConformances
|
|
1763
|
+
)
|
|
1638
1764
|
);
|
|
1639
1765
|
else (0, import_node_fs2.cpSync)(file, target, { verbatimSymlinks: true });
|
|
1640
1766
|
}
|
|
@@ -1673,15 +1799,15 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1673
1799
|
// sootsim-swift files ${modulePlan.digest("hex").slice(0, 16)}
|
|
1674
1800
|
// resource accessors ${resourcePlan}
|
|
1675
1801
|
`;
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1678
|
-
);
|
|
1802
|
+
const swiftSources = Object.entries(input.files).filter(([file]) => file.endsWith(".swift")).map(([, contents]) => contents);
|
|
1803
|
+
const objcExtensions = objcExtensionMemberIndex(swiftSources);
|
|
1804
|
+
const tableConformances = tableProtocolConformances(swiftSources);
|
|
1679
1805
|
if (targets.length === 0) {
|
|
1680
1806
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
1681
1807
|
if (file === "Package.swift") continue;
|
|
1682
1808
|
files.set(
|
|
1683
1809
|
import_node_path2.default.join(layout.sources, file),
|
|
1684
|
-
compiledSource(file, contents, objcExtensions)
|
|
1810
|
+
compiledSource(file, contents, objcExtensions, tableConformances)
|
|
1685
1811
|
);
|
|
1686
1812
|
}
|
|
1687
1813
|
let manifest = (0, import_node_fs2.readFileSync)(
|
|
@@ -1728,7 +1854,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1728
1854
|
const base = layout.multi ? layout.root : layout.sources;
|
|
1729
1855
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
1730
1856
|
if (file === "Package.swift") continue;
|
|
1731
|
-
files.set(
|
|
1857
|
+
files.set(
|
|
1858
|
+
import_node_path2.default.join(base, file),
|
|
1859
|
+
compiledSource(file, contents, objcExtensions, tableConformances)
|
|
1860
|
+
);
|
|
1732
1861
|
}
|
|
1733
1862
|
files.set(
|
|
1734
1863
|
import_node_path2.default.join(layout.root, "Package.swift"),
|
|
@@ -1963,6 +2092,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
1963
2092
|
swiftSourceClosure,
|
|
1964
2093
|
swiftTargetDependencies,
|
|
1965
2094
|
syncSwiftTree,
|
|
2095
|
+
tableProtocolConformances,
|
|
1966
2096
|
withNativeSourceGlue,
|
|
1967
2097
|
writeSwiftProject
|
|
1968
2098
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
4
|
import { execFile as execFile2, execFileSync } from "node:child_process";
|
|
@@ -596,7 +596,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
596
596
|
var MULTI_MANIFEST_VERSION = 12;
|
|
597
597
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
598
598
|
const hash = createHash2("sha256");
|
|
599
|
-
hash.update(`swift-compile/
|
|
599
|
+
hash.update(`swift-compile/v20
|
|
600
600
|
${release}
|
|
601
601
|
`);
|
|
602
602
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -1194,6 +1194,125 @@ function lowerNotificationDelegate(source) {
|
|
|
1194
1194
|
result = result.slice(0, at) + text + result.slice(at + count);
|
|
1195
1195
|
return result;
|
|
1196
1196
|
}
|
|
1197
|
+
function tableProtocolConformances(sources) {
|
|
1198
|
+
const parents = /* @__PURE__ */ new Map();
|
|
1199
|
+
for (const source of sources) {
|
|
1200
|
+
const code = swiftCodeMask(source);
|
|
1201
|
+
for (const owner of code.matchAll(
|
|
1202
|
+
/\b(?:class|extension)\s+([A-Za-z_]\w*)\s*:\s*([^{}]+)\{/g
|
|
1203
|
+
)) {
|
|
1204
|
+
const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
|
|
1205
|
+
for (const type of owner[2].matchAll(/\b[A-Za-z_]\w*\b/g)) inherited.add(type[0]);
|
|
1206
|
+
parents.set(owner[1], inherited);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
const result = /* @__PURE__ */ new Map();
|
|
1210
|
+
const protocols = ["UITableViewDataSource", "UITableViewDelegate"];
|
|
1211
|
+
for (const type of parents.keys()) {
|
|
1212
|
+
const pending = [type];
|
|
1213
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1214
|
+
const conformances = /* @__PURE__ */ new Set();
|
|
1215
|
+
while (pending.length) {
|
|
1216
|
+
const next = pending.pop();
|
|
1217
|
+
if (seen.has(next)) continue;
|
|
1218
|
+
seen.add(next);
|
|
1219
|
+
if (protocols.includes(next)) conformances.add(next);
|
|
1220
|
+
for (const parent of parents.get(next) ?? []) pending.push(parent);
|
|
1221
|
+
}
|
|
1222
|
+
if (conformances.size) result.set(type, conformances);
|
|
1223
|
+
}
|
|
1224
|
+
return result;
|
|
1225
|
+
}
|
|
1226
|
+
function lowerTableProtocolMethods(source, conformances) {
|
|
1227
|
+
const code = swiftCodeMask(source);
|
|
1228
|
+
const dataSource = {
|
|
1229
|
+
numberOfRowsInSection: "tableView:numberOfRowsInSection:",
|
|
1230
|
+
cellForRowAt: "tableView:cellForRowAtIndexPath:",
|
|
1231
|
+
titleForHeaderInSection: "tableView:titleForHeaderInSection:",
|
|
1232
|
+
titleForFooterInSection: "tableView:titleForFooterInSection:",
|
|
1233
|
+
canEditRowAt: "tableView:canEditRowAtIndexPath:",
|
|
1234
|
+
commit: "tableView:commitEditingStyle:forRowAtIndexPath:"
|
|
1235
|
+
};
|
|
1236
|
+
const delegate = {
|
|
1237
|
+
willDisplay: "tableView:willDisplayCell:forRowAtIndexPath:",
|
|
1238
|
+
didEndDisplaying: "tableView:didEndDisplayingCell:forRowAtIndexPath:",
|
|
1239
|
+
heightForRowAt: "tableView:heightForRowAtIndexPath:",
|
|
1240
|
+
estimatedHeightForRowAt: "tableView:estimatedHeightForRowAtIndexPath:",
|
|
1241
|
+
heightForHeaderInSection: "tableView:heightForHeaderInSection:",
|
|
1242
|
+
heightForFooterInSection: "tableView:heightForFooterInSection:",
|
|
1243
|
+
estimatedHeightForHeaderInSection: "tableView:estimatedHeightForHeaderInSection:",
|
|
1244
|
+
estimatedHeightForFooterInSection: "tableView:estimatedHeightForFooterInSection:",
|
|
1245
|
+
viewForHeaderInSection: "tableView:viewForHeaderInSection:",
|
|
1246
|
+
viewForFooterInSection: "tableView:viewForFooterInSection:",
|
|
1247
|
+
willDisplayHeaderView: "tableView:willDisplayHeaderView:forSection:",
|
|
1248
|
+
willDisplayFooterView: "tableView:willDisplayFooterView:forSection:",
|
|
1249
|
+
didEndDisplayingHeaderView: "tableView:didEndDisplayingHeaderView:forSection:",
|
|
1250
|
+
didEndDisplayingFooterView: "tableView:didEndDisplayingFooterView:forSection:",
|
|
1251
|
+
shouldHighlightRowAt: "tableView:shouldHighlightRowAtIndexPath:",
|
|
1252
|
+
didHighlightRowAt: "tableView:didHighlightRowAtIndexPath:",
|
|
1253
|
+
didUnhighlightRowAt: "tableView:didUnhighlightRowAtIndexPath:",
|
|
1254
|
+
willSelectRowAt: "tableView:willSelectRowAtIndexPath:",
|
|
1255
|
+
willDeselectRowAt: "tableView:willDeselectRowAtIndexPath:",
|
|
1256
|
+
didSelectRowAt: "tableView:didSelectRowAtIndexPath:",
|
|
1257
|
+
didDeselectRowAt: "tableView:didDeselectRowAtIndexPath:",
|
|
1258
|
+
accessoryButtonTappedForRowWith: "tableView:accessoryButtonTappedForRowWithIndexPath:",
|
|
1259
|
+
editingStyleForRowAt: "tableView:editingStyleForRowAtIndexPath:",
|
|
1260
|
+
leadingSwipeActionsConfigurationForRowAt: "tableView:leadingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1261
|
+
trailingSwipeActionsConfigurationForRowAt: "tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:",
|
|
1262
|
+
willBeginEditingRowAt: "tableView:willBeginEditingRowAtIndexPath:",
|
|
1263
|
+
didEndEditingRowAt: "tableView:didEndEditingRowAtIndexPath:"
|
|
1264
|
+
};
|
|
1265
|
+
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
1266
|
+
const edits = [];
|
|
1267
|
+
for (const owner of code.matchAll(/\b(?:class|extension)\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
|
|
1268
|
+
const conforms = conformances.get(owner[1]);
|
|
1269
|
+
if (!conforms) continue;
|
|
1270
|
+
const selectors = {
|
|
1271
|
+
...conforms.has("UITableViewDataSource") ? dataSource : {},
|
|
1272
|
+
...conforms.has("UITableViewDelegate") ? delegate : {}
|
|
1273
|
+
};
|
|
1274
|
+
const open = owner.index + owner[0].length - 1;
|
|
1275
|
+
const close = closingBrace(code, braces, open);
|
|
1276
|
+
let depth = 1;
|
|
1277
|
+
let previous = open + 1;
|
|
1278
|
+
for (const token of swiftCodeScan(code.slice(open + 1, close - 1)).tokens) {
|
|
1279
|
+
const at = open + 1 + token;
|
|
1280
|
+
if (code[at] === "{") depth++;
|
|
1281
|
+
else if (code[at] === "}") {
|
|
1282
|
+
depth--;
|
|
1283
|
+
if (depth === 1) previous = at + 1;
|
|
1284
|
+
} else if (depth === 1 && /^func\b/.test(code.slice(at))) {
|
|
1285
|
+
const signature = code.slice(at, code.indexOf("{", at));
|
|
1286
|
+
const prefix = code.slice(previous, at);
|
|
1287
|
+
const attributes = /(?:@\w+(?:\([^{}]*\))?\s*|(?:public|open|private|fileprivate|internal|final|override|static|class|nonisolated|dynamic)\s+)*$/.exec(
|
|
1288
|
+
prefix
|
|
1289
|
+
)?.[0] ?? "";
|
|
1290
|
+
if (/\b(?:override|static|class)\b|@(?:objc|ObjC|IBAction)\b/.test(attributes))
|
|
1291
|
+
continue;
|
|
1292
|
+
let selector;
|
|
1293
|
+
if (conforms.has("UITableViewDataSource") && /^func\s+numberOfSections\s*\(\s*in\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*\)/.test(
|
|
1294
|
+
signature
|
|
1295
|
+
))
|
|
1296
|
+
selector = "numberOfSectionsInTableView:";
|
|
1297
|
+
else {
|
|
1298
|
+
const match = /^func\s+tableView\s*\(\s*_\s+\w+\s*:\s*(?:UIKit\.)?UITableView\s*,\s*(\w+)\b/.exec(
|
|
1299
|
+
signature
|
|
1300
|
+
);
|
|
1301
|
+
if (match) selector = selectors[match[1]];
|
|
1302
|
+
}
|
|
1303
|
+
if (selector)
|
|
1304
|
+
edits.push([
|
|
1305
|
+
at,
|
|
1306
|
+
`${/\bnonisolated\b/.test(attributes) ? "" : "@MainActor "}@ObjC(${JSON.stringify(selector)}) `
|
|
1307
|
+
]);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
let result = source;
|
|
1312
|
+
for (const [at, text] of edits.sort((a, b) => b[0] - a[0]))
|
|
1313
|
+
result = result.slice(0, at) + text + result.slice(at);
|
|
1314
|
+
return result;
|
|
1315
|
+
}
|
|
1197
1316
|
function swiftCodeMask(source) {
|
|
1198
1317
|
const chars = source.split("");
|
|
1199
1318
|
const blank = (from, to) => {
|
|
@@ -1297,9 +1416,9 @@ function swiftCodeMask(source) {
|
|
|
1297
1416
|
scanCode(0, false);
|
|
1298
1417
|
return chars.join("");
|
|
1299
1418
|
}
|
|
1300
|
-
function swiftSourceAsIOS(original, extraObjCExtensions) {
|
|
1419
|
+
function swiftSourceAsIOS(original, extraObjCExtensions, tableConformances = tableProtocolConformances([original])) {
|
|
1301
1420
|
const source = liftExtensionOverrides(
|
|
1302
|
-
lowerNotificationDelegate(original),
|
|
1421
|
+
lowerTableProtocolMethods(lowerNotificationDelegate(original), tableConformances),
|
|
1303
1422
|
extraObjCExtensions
|
|
1304
1423
|
);
|
|
1305
1424
|
const { lineStarts, tokens } = swiftCodeScan(source);
|
|
@@ -1554,7 +1673,7 @@ function swiftCodeScan(source) {
|
|
|
1554
1673
|
}
|
|
1555
1674
|
return { lineStarts: starts, tokens };
|
|
1556
1675
|
}
|
|
1557
|
-
var compiledSource = (file, contents, extraObjCExtensions) => file.endsWith(".swift") ? swiftSourceAsIOS(contents, extraObjCExtensions) : contents;
|
|
1676
|
+
var compiledSource = (file, contents, extraObjCExtensions, tableConformances) => file.endsWith(".swift") ? swiftSourceAsIOS(contents, extraObjCExtensions, tableConformances) : contents;
|
|
1558
1677
|
function prepareSwiftDependency(source, destination) {
|
|
1559
1678
|
rmSync(destination, { recursive: true, force: true });
|
|
1560
1679
|
const origins = [];
|
|
@@ -1570,6 +1689,7 @@ function prepareSwiftDependency(source, destination) {
|
|
|
1570
1689
|
};
|
|
1571
1690
|
gather(source, true);
|
|
1572
1691
|
const objcExtensions = objcExtensionMemberIndex(origins);
|
|
1692
|
+
const tableConformances = tableProtocolConformances(origins);
|
|
1573
1693
|
const copy = (from, to, root) => {
|
|
1574
1694
|
mkdirSync(to, { recursive: true });
|
|
1575
1695
|
for (const entry of readdirSync(from, { withFileTypes: true })) {
|
|
@@ -1581,7 +1701,12 @@ function prepareSwiftDependency(source, destination) {
|
|
|
1581
1701
|
else if (entry.isFile() && entry.name.endsWith(".swift") && !(root && /^Package(@swift-[\d.]+)?\.swift$/.test(entry.name)))
|
|
1582
1702
|
writeFileSync(
|
|
1583
1703
|
target,
|
|
1584
|
-
compiledSource(
|
|
1704
|
+
compiledSource(
|
|
1705
|
+
file,
|
|
1706
|
+
readFileSync2(file, "utf8"),
|
|
1707
|
+
objcExtensions,
|
|
1708
|
+
tableConformances
|
|
1709
|
+
)
|
|
1585
1710
|
);
|
|
1586
1711
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
1587
1712
|
}
|
|
@@ -1620,15 +1745,15 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1620
1745
|
// sootsim-swift files ${modulePlan.digest("hex").slice(0, 16)}
|
|
1621
1746
|
// resource accessors ${resourcePlan}
|
|
1622
1747
|
`;
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
);
|
|
1748
|
+
const swiftSources = Object.entries(input.files).filter(([file]) => file.endsWith(".swift")).map(([, contents]) => contents);
|
|
1749
|
+
const objcExtensions = objcExtensionMemberIndex(swiftSources);
|
|
1750
|
+
const tableConformances = tableProtocolConformances(swiftSources);
|
|
1626
1751
|
if (targets.length === 0) {
|
|
1627
1752
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
1628
1753
|
if (file === "Package.swift") continue;
|
|
1629
1754
|
files.set(
|
|
1630
1755
|
path2.join(layout.sources, file),
|
|
1631
|
-
compiledSource(file, contents, objcExtensions)
|
|
1756
|
+
compiledSource(file, contents, objcExtensions, tableConformances)
|
|
1632
1757
|
);
|
|
1633
1758
|
}
|
|
1634
1759
|
let manifest = readFileSync2(
|
|
@@ -1675,7 +1800,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
1675
1800
|
const base = layout.multi ? layout.root : layout.sources;
|
|
1676
1801
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
1677
1802
|
if (file === "Package.swift") continue;
|
|
1678
|
-
files.set(
|
|
1803
|
+
files.set(
|
|
1804
|
+
path2.join(base, file),
|
|
1805
|
+
compiledSource(file, contents, objcExtensions, tableConformances)
|
|
1806
|
+
);
|
|
1679
1807
|
}
|
|
1680
1808
|
files.set(
|
|
1681
1809
|
path2.join(layout.root, "Package.swift"),
|
|
@@ -1909,6 +2037,7 @@ export {
|
|
|
1909
2037
|
swiftSourceClosure,
|
|
1910
2038
|
swiftTargetDependencies,
|
|
1911
2039
|
syncSwiftTree,
|
|
2040
|
+
tableProtocolConformances,
|
|
1912
2041
|
withNativeSourceGlue,
|
|
1913
2042
|
writeSwiftProject
|
|
1914
2043
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } 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.809 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|