peachsim 0.1.1965 → 0.1.1967
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 +44 -10
- 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 +43 -9
- 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 +44 -10
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +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 +44 -10
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +42 -8
- 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-compat/src/stubs/screen-transition-math.d.ts +15 -1
- package/package.json +1 -1
- package/src/swift-objc-standin.ts +31 -2
- package/src/swift-standin-emit.ts +21 -2
- package/src/swift-standins.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
4
|
import {
|
|
@@ -12359,7 +12359,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
|
|
|
12359
12359
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
12360
12360
|
var MULTI_MANIFEST_VERSION = 66;
|
|
12361
12361
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
12362
|
-
var compilerSourceDigest = true ? "
|
|
12362
|
+
var compilerSourceDigest = true ? "2e5698309de758f9fcfd857f44c8fe794ab3ef36f7b28f6a042e4326bbc8113a" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
12363
12363
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
12364
12364
|
const hash = createHash13("sha256");
|
|
12365
12365
|
hash.update(`swift-compile
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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;
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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;
|
|
@@ -6272,6 +6272,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6272
6272
|
const superclass = /* @__PURE__ */ new Map();
|
|
6273
6273
|
const superId = /* @__PURE__ */ new Map();
|
|
6274
6274
|
const conforms = /* @__PURE__ */ new Map();
|
|
6275
|
+
const conditional = [];
|
|
6275
6276
|
const conformanceTargets = /* @__PURE__ */ new Map();
|
|
6276
6277
|
const objectConformers = /* @__PURE__ */ new Set();
|
|
6277
6278
|
const conformIds = /* @__PURE__ */ new Map();
|
|
@@ -6302,6 +6303,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6302
6303
|
if (edge.sourceOrigin) origins.set(edge.source, edge.sourceOrigin.displayName);
|
|
6303
6304
|
switch (edge.kind) {
|
|
6304
6305
|
case "memberOf": {
|
|
6306
|
+
if (edge.source === edge.target) break;
|
|
6305
6307
|
const parent = byId.get(edge.target);
|
|
6306
6308
|
if (parent) {
|
|
6307
6309
|
owner.set(edge.source, edge.target);
|
|
@@ -6332,7 +6334,15 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6332
6334
|
path: pathOf(source),
|
|
6333
6335
|
reason: `unsupported Objective-C protocol parent ${edge.target}`
|
|
6334
6336
|
});
|
|
6335
|
-
if (name3) {
|
|
6337
|
+
if (name3 && edge.swiftConstraints?.length) {
|
|
6338
|
+
conditional.push({
|
|
6339
|
+
source,
|
|
6340
|
+
name: name3,
|
|
6341
|
+
where: edge.swiftConstraints.map(
|
|
6342
|
+
({ kind, lhs, rhs }) => kind === "sameType" ? `${lhs} == ${rhs}` : `${lhs}: ${rhs}`
|
|
6343
|
+
).join(", ")
|
|
6344
|
+
});
|
|
6345
|
+
} else if (name3) {
|
|
6336
6346
|
conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
|
|
6337
6347
|
const targets = conformanceTargets.get(edge.source) ?? /* @__PURE__ */ new Map();
|
|
6338
6348
|
targets.set(name3, edge.target);
|
|
@@ -6813,7 +6823,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
6813
6823
|
if (!parentSymbol || !ownIds.has(parentSymbol.identifier.precise))
|
|
6814
6824
|
list2.push(standinMarker);
|
|
6815
6825
|
const open = symbol2.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
|
|
6816
|
-
const objcName = /^c:objc\(cs\)(\w+)$/.exec(id)?.[1];
|
|
6826
|
+
const objcName = shape.generics ? void 0 : /^c:objc\(cs\)(\w+)$/.exec(id)?.[1];
|
|
6817
6827
|
emit(
|
|
6818
6828
|
`${indent2}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ""}${shape.final}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
|
|
6819
6829
|
);
|
|
@@ -7208,6 +7218,8 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
7208
7218
|
emitWitness(witness.member, " ", witness.path);
|
|
7209
7219
|
emit("}");
|
|
7210
7220
|
}
|
|
7221
|
+
for (const { source, name: name3, where } of conditional)
|
|
7222
|
+
emitAt(pathOf(source), `extension ${pathOf(source)}: ${name3} where ${where} {}`);
|
|
7211
7223
|
const banner = [
|
|
7212
7224
|
...options.placeholder ? [
|
|
7213
7225
|
`// placeholder for ${options.module}, generated from ${options.source}: ${options.placeholder}.`,
|
|
@@ -7596,6 +7608,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
|
|
|
7596
7608
|
import_node_fs7.default.mkdirSync(import_node_path7.default.dirname(file), { recursive: true });
|
|
7597
7609
|
import_node_fs7.default.writeFileSync(file, text5);
|
|
7598
7610
|
}
|
|
7611
|
+
const interfaceCopies = [];
|
|
7599
7612
|
if (framework) {
|
|
7600
7613
|
import_node_fs7.default.mkdirSync(import_node_path7.default.join(frameworks, `${surface.module}.framework`, "Modules"), {
|
|
7601
7614
|
recursive: true
|
|
@@ -7614,11 +7627,16 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
|
|
|
7614
7627
|
);
|
|
7615
7628
|
import_node_fs7.default.mkdirSync(to, { recursive: true });
|
|
7616
7629
|
for (const name3 of import_node_fs7.default.readdirSync(from))
|
|
7617
|
-
if (name3.endsWith(".swiftinterface"))
|
|
7630
|
+
if (name3.endsWith(".swiftinterface")) {
|
|
7631
|
+
interfaceCopies.push(import_node_path7.default.join(to, name3));
|
|
7618
7632
|
import_node_fs7.default.writeFileSync(
|
|
7619
7633
|
import_node_path7.default.join(to, name3),
|
|
7620
|
-
import_node_fs7.default.readFileSync(import_node_path7.default.join(from, name3), "utf8").replace(/\bCoreFoundation\.(?=CG)/g, "CoreGraphics.").replace(/\bCoreFoundation\.(?=\w)/g, "Foundation.")
|
|
7634
|
+
import_node_fs7.default.readFileSync(import_node_path7.default.join(from, name3), "utf8").replace(/\bCoreFoundation\.(?=CG)/g, "CoreGraphics.").replace(/\bCoreFoundation\.(?=\w)/g, "Foundation.").replace(
|
|
7635
|
+
/\bFoundation\.Data\.(?=Base64(?:En|De)codingOptions\b)/g,
|
|
7636
|
+
"Foundation.NSData."
|
|
7637
|
+
)
|
|
7621
7638
|
);
|
|
7639
|
+
}
|
|
7622
7640
|
}
|
|
7623
7641
|
} else {
|
|
7624
7642
|
import_node_fs7.default.copyFileSync(surface.modulemap, import_node_path7.default.join(headersDir, "module.modulemap"));
|
|
@@ -7776,6 +7794,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
|
|
|
7776
7794
|
return name3 ? { name: name3, before: text5.slice(0, column - 1), after: rest.slice(name3.length) } : null;
|
|
7777
7795
|
};
|
|
7778
7796
|
const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
|
|
7797
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
7779
7798
|
for (let round = 0; ; round++) {
|
|
7780
7799
|
import_node_fs7.default.rmSync(out, { recursive: true, force: true });
|
|
7781
7800
|
import_node_fs7.default.mkdirSync(out, { recursive: true });
|
|
@@ -7813,6 +7832,21 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
|
|
|
7813
7832
|
`original Objective-C declarations do not import as Swift: ${run5.stderr.trim() || run5.stdout.trim()}`
|
|
7814
7833
|
);
|
|
7815
7834
|
let progress = false;
|
|
7835
|
+
for (const [, shadowed, same] of run5.stderr.matchAll(
|
|
7836
|
+
/is not a member type of class '(\w+)\.(\w+)'/g
|
|
7837
|
+
))
|
|
7838
|
+
if (shadowed === same && !selectors.has(shadowed)) {
|
|
7839
|
+
selectors.add(shadowed);
|
|
7840
|
+
progress = true;
|
|
7841
|
+
for (const file of interfaceCopies)
|
|
7842
|
+
import_node_fs7.default.writeFileSync(
|
|
7843
|
+
file,
|
|
7844
|
+
import_node_fs7.default.readFileSync(file, "utf8").replace(
|
|
7845
|
+
new RegExp(`\\b${shadowed}\\.(?=[A-Za-z_])`, "g"),
|
|
7846
|
+
`${shadowed}::`
|
|
7847
|
+
)
|
|
7848
|
+
);
|
|
7849
|
+
}
|
|
7816
7850
|
const learn = (name3, kind) => {
|
|
7817
7851
|
if (missing.has(name3)) return;
|
|
7818
7852
|
missing.set(name3, kind);
|
|
@@ -16710,7 +16744,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
|
|
|
16710
16744
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
16711
16745
|
var MULTI_MANIFEST_VERSION = 66;
|
|
16712
16746
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
16713
|
-
var compilerSourceDigest = true ? "
|
|
16747
|
+
var compilerSourceDigest = true ? "2e5698309de758f9fcfd857f44c8fe794ab3ef36f7b28f6a042e4326bbc8113a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
16714
16748
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
16715
16749
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
16716
16750
|
hash.update(`swift-compile
|
|
@@ -29664,7 +29698,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
29664
29698
|
return hash.digest("hex");
|
|
29665
29699
|
}
|
|
29666
29700
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
29667
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
29701
|
+
var STANDIN_SOURCE_DIGEST = true ? "af579d23be157d779601d4f3373566fac852d588d01fe54fa87ad7cd82139fd8" : standinSourceDigest();
|
|
29668
29702
|
|
|
29669
29703
|
// src/swift-standins.ts
|
|
29670
29704
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -32514,7 +32548,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32514
32548
|
siblings.get(binary)
|
|
32515
32549
|
);
|
|
32516
32550
|
console.error(
|
|
32517
|
-
`[swift-standins] ${binary.target} ${typeof result === "string" ? `gap: ${result}` : "ready"} in ${Date.now() - started}ms`
|
|
32551
|
+
`[swift-standins] ${binary.target} ${typeof result === "string" ? `gap: ${gapText(result)}` : "ready"} in ${Date.now() - started}ms`
|
|
32518
32552
|
);
|
|
32519
32553
|
if (typeof result === "string") {
|
|
32520
32554
|
gaps.set(binary.target, result);
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1967 | (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.1967 | (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;
|
|
@@ -54,6 +54,12 @@ export interface ZoomSourceRect {
|
|
|
54
54
|
width: number;
|
|
55
55
|
height: number;
|
|
56
56
|
cornerRadius?: number;
|
|
57
|
+
alignment?: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
};
|
|
57
63
|
}
|
|
58
64
|
export interface ScreenSlideInput {
|
|
59
65
|
rtl?: boolean;
|
|
@@ -142,6 +148,9 @@ export interface ScreenSlideTransforms {
|
|
|
142
148
|
export interface ZoomClip<T = number> {
|
|
143
149
|
insetX: T;
|
|
144
150
|
insetY: T;
|
|
151
|
+
contentX: T;
|
|
152
|
+
contentY: T;
|
|
153
|
+
contentScale: T;
|
|
145
154
|
innerRadii: ScreenTransitionCornerRadii<T>;
|
|
146
155
|
rect: {
|
|
147
156
|
x: T;
|
|
@@ -150,7 +159,12 @@ export interface ZoomClip<T = number> {
|
|
|
150
159
|
height: T;
|
|
151
160
|
};
|
|
152
161
|
radii: ScreenTransitionCornerRadii<T>;
|
|
153
|
-
|
|
162
|
+
snapshot: {
|
|
163
|
+
x: T;
|
|
164
|
+
y: T;
|
|
165
|
+
width: T;
|
|
166
|
+
height: T;
|
|
167
|
+
};
|
|
154
168
|
caster: {
|
|
155
169
|
translateX: T;
|
|
156
170
|
translateY: T;
|
package/package.json
CHANGED
|
@@ -482,6 +482,7 @@ export function objcView(
|
|
|
482
482
|
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
483
483
|
fs.writeFileSync(file, text)
|
|
484
484
|
}
|
|
485
|
+
const interfaceCopies: string[] = []
|
|
485
486
|
if (framework) {
|
|
486
487
|
fs.mkdirSync(path.join(frameworks, `${surface.module}.framework`, 'Modules'), {
|
|
487
488
|
recursive: true,
|
|
@@ -504,14 +505,22 @@ export function objcView(
|
|
|
504
505
|
)
|
|
505
506
|
fs.mkdirSync(to, { recursive: true })
|
|
506
507
|
for (const name of fs.readdirSync(from))
|
|
507
|
-
if (name.endsWith('.swiftinterface'))
|
|
508
|
+
if (name.endsWith('.swiftinterface')) {
|
|
509
|
+
interfaceCopies.push(path.join(to, name))
|
|
508
510
|
fs.writeFileSync(
|
|
509
511
|
path.join(to, name),
|
|
510
512
|
fs
|
|
511
513
|
.readFileSync(path.join(from, name), 'utf8')
|
|
512
514
|
.replace(/\bCoreFoundation\.(?=CG)/g, 'CoreGraphics.')
|
|
513
|
-
.replace(/\bCoreFoundation\.(?=\w)/g, 'Foundation.')
|
|
515
|
+
.replace(/\bCoreFoundation\.(?=\w)/g, 'Foundation.')
|
|
516
|
+
// Data's base64 option sets live in the swift overlay; the
|
|
517
|
+
// intake only has their NSData spelling, which Data aliases.
|
|
518
|
+
.replace(
|
|
519
|
+
/\bFoundation\.Data\.(?=Base64(?:En|De)codingOptions\b)/g,
|
|
520
|
+
'Foundation.NSData.',
|
|
521
|
+
),
|
|
514
522
|
)
|
|
523
|
+
}
|
|
515
524
|
}
|
|
516
525
|
} else {
|
|
517
526
|
fs.copyFileSync(surface.modulemap, path.join(headersDir, 'module.modulemap'))
|
|
@@ -684,6 +693,7 @@ export function objcView(
|
|
|
684
693
|
: /^\s*\*/.test(after)
|
|
685
694
|
? 'class'
|
|
686
695
|
: 'struct'
|
|
696
|
+
const selectors = new Set<string>()
|
|
687
697
|
for (let round = 0; ; round++) {
|
|
688
698
|
fs.rmSync(out, { recursive: true, force: true })
|
|
689
699
|
fs.mkdirSync(out, { recursive: true })
|
|
@@ -721,6 +731,25 @@ export function objcView(
|
|
|
721
731
|
`original Objective-C declarations do not import as Swift: ${run.stderr.trim() || run.stdout.trim()}`,
|
|
722
732
|
)
|
|
723
733
|
let progress = false
|
|
734
|
+
// a class named like its module shadows the module qualifier, which a module selector
|
|
735
|
+
// still reaches
|
|
736
|
+
for (const [, shadowed, same] of run.stderr.matchAll(
|
|
737
|
+
/is not a member type of class '(\w+)\.(\w+)'/g,
|
|
738
|
+
))
|
|
739
|
+
if (shadowed === same && !selectors.has(shadowed!)) {
|
|
740
|
+
selectors.add(shadowed!)
|
|
741
|
+
progress = true
|
|
742
|
+
for (const file of interfaceCopies)
|
|
743
|
+
fs.writeFileSync(
|
|
744
|
+
file,
|
|
745
|
+
fs
|
|
746
|
+
.readFileSync(file, 'utf8')
|
|
747
|
+
.replace(
|
|
748
|
+
new RegExp(`\\b${shadowed}\\.(?=[A-Za-z_])`, 'g'),
|
|
749
|
+
`${shadowed}::`,
|
|
750
|
+
),
|
|
751
|
+
)
|
|
752
|
+
}
|
|
724
753
|
const learn = (name: string, kind: 'class' | 'protocol' | 'struct' | 'macro') => {
|
|
725
754
|
if (missing.has(name)) return
|
|
726
755
|
missing.set(name, kind)
|
|
@@ -38,6 +38,7 @@ export type GraphRelationship = {
|
|
|
38
38
|
source: string
|
|
39
39
|
target: string
|
|
40
40
|
targetFallback?: string
|
|
41
|
+
swiftConstraints?: { kind: string; lhs: string; rhs: string }[]
|
|
41
42
|
sourceOrigin?: { identifier: string; displayName: string }
|
|
42
43
|
}
|
|
43
44
|
export type SymbolGraph = {
|
|
@@ -703,6 +704,7 @@ export function emitSwiftStandin(
|
|
|
703
704
|
const superclass = new Map<string, string>()
|
|
704
705
|
const superId = new Map<string, string>()
|
|
705
706
|
const conforms = new Map<string, string[]>()
|
|
707
|
+
const conditional: { source: GraphSymbol; name: string; where: string }[] = []
|
|
706
708
|
const conformanceTargets = new Map<string, Map<string, string>>()
|
|
707
709
|
const objectConformers = new Set<string>()
|
|
708
710
|
const conformIds = new Map<string, string[]>()
|
|
@@ -736,6 +738,8 @@ export function emitSwiftStandin(
|
|
|
736
738
|
if (edge.sourceOrigin) origins.set(edge.source, edge.sourceOrigin.displayName)
|
|
737
739
|
switch (edge.kind) {
|
|
738
740
|
case 'memberOf': {
|
|
741
|
+
// a synthesized alias shares its enum's id, so its edge can name itself
|
|
742
|
+
if (edge.source === edge.target) break
|
|
739
743
|
const parent = byId.get(edge.target)
|
|
740
744
|
if (parent) {
|
|
741
745
|
owner.set(edge.source, edge.target)
|
|
@@ -779,7 +783,17 @@ export function emitSwiftStandin(
|
|
|
779
783
|
path: pathOf(source),
|
|
780
784
|
reason: `unsupported Objective-C protocol parent ${edge.target}`,
|
|
781
785
|
})
|
|
782
|
-
if (name) {
|
|
786
|
+
if (name && edge.swiftConstraints?.length) {
|
|
787
|
+
conditional.push({
|
|
788
|
+
source,
|
|
789
|
+
name,
|
|
790
|
+
where: edge.swiftConstraints
|
|
791
|
+
.map(({ kind, lhs, rhs }) =>
|
|
792
|
+
kind === 'sameType' ? `${lhs} == ${rhs}` : `${lhs}: ${rhs}`,
|
|
793
|
+
)
|
|
794
|
+
.join(', '),
|
|
795
|
+
})
|
|
796
|
+
} else if (name) {
|
|
783
797
|
conforms.set(edge.source, [...(conforms.get(edge.source) ?? []), name])
|
|
784
798
|
const targets =
|
|
785
799
|
conformanceTargets.get(edge.source) ?? new Map<string, string>()
|
|
@@ -1464,7 +1478,10 @@ export function emitSwiftStandin(
|
|
|
1464
1478
|
const open =
|
|
1465
1479
|
symbol.accessLevel === 'open' &&
|
|
1466
1480
|
(!parentSymbol || parentSymbol.accessLevel === 'open')
|
|
1467
|
-
|
|
1481
|
+
// swift rejects an explicit objc name on a generic subclass of an objc class
|
|
1482
|
+
const objcName = shape.generics
|
|
1483
|
+
? undefined
|
|
1484
|
+
: /^c:objc\(cs\)(\w+)$/.exec(id)?.[1]
|
|
1468
1485
|
emit(
|
|
1469
1486
|
`${indent}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ''}${shape.final}${open ? 'open' : 'public'} class ${shape.name}${shape.generics}${list.length ? `: ${list.join(', ')}` : ''}${selfConforming(shape.where)} {`,
|
|
1470
1487
|
)
|
|
@@ -2001,6 +2018,8 @@ export function emitSwiftStandin(
|
|
|
2001
2018
|
emitWitness(witness.member, ' ', witness.path)
|
|
2002
2019
|
emit('}')
|
|
2003
2020
|
}
|
|
2021
|
+
for (const { source, name, where } of conditional)
|
|
2022
|
+
emitAt(pathOf(source), `extension ${pathOf(source)}: ${name} where ${where} {}`)
|
|
2004
2023
|
const banner = [
|
|
2005
2024
|
...(options.placeholder
|
|
2006
2025
|
? [
|
package/src/swift-standins.ts
CHANGED
|
@@ -2956,7 +2956,7 @@ async function buildStandins(
|
|
|
2956
2956
|
siblings.get(binary)!,
|
|
2957
2957
|
)
|
|
2958
2958
|
console.error(
|
|
2959
|
-
`[swift-standins] ${binary.target} ${typeof result === 'string' ? `gap: ${result}` : 'ready'} in ${Date.now() - started}ms`,
|
|
2959
|
+
`[swift-standins] ${binary.target} ${typeof result === 'string' ? `gap: ${gapText(result)}` : 'ready'} in ${Date.now() - started}ms`,
|
|
2960
2960
|
)
|
|
2961
2961
|
if (typeof result === 'string') {
|
|
2962
2962
|
gaps.set(binary.target, result)
|