peachsim 0.1.2530 → 0.1.2532
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/outbound-endpoints.ts +1 -1
- 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 +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +33 -15
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-YVRVG3K7.mjs → acorn-TZ5PF3KN.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-YOIJ4H4H.mjs → chunk-2MKQPSDN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-Y2NPAJV3.mjs → chunk-2XASNK6T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XY5OJABO.mjs → chunk-42SSRZYU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VSH5P6JS.mjs → chunk-5MPQROQI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GUIH6C3J.mjs → chunk-5QYIUNH4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IYR5Q33V.mjs → chunk-6NED5Q2N.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZKAF7FRZ.mjs → chunk-AWTELPIZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QQ3SVDCR.mjs → chunk-CLSNUKAZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WM26AFHQ.mjs → chunk-G5BCU5ZO.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-ZNYML6R7.mjs → chunk-ID63CARL.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-2WH6I726.mjs → chunk-IOTWFHYU.mjs} +38 -18
- package/dist-lib/esm-chunks/{chunk-AFCI2JQL.mjs → chunk-J4BQEGDW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EQRX3NE2.mjs → chunk-JBDDB6NG.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-YO6WUDWP.mjs → chunk-NCQGQ6PA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NBOGCAWQ.mjs → chunk-O6O4F2TV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6PHCBORD.mjs → chunk-Q3P3TYU7.mjs} +7 -6
- package/dist-lib/esm-chunks/{chunk-X3MXQKQ3.mjs → chunk-UHYLBEKZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BACARNR4.mjs → chunk-XS6UNGOO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3V3QWLVG.mjs → chunk-YGCMYVJ5.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-B5YOIP4V.mjs → chunk-ZHGKXGBN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FRV2MWLR.mjs → chunk-ZZ6DQAJY.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-MZ26V7TP.mjs → metro-layout-parser-QE6OG7ST.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-SK54BG3Y.mjs → swift-package-prebuilt-GSQHH7HN.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-4EUT66BB.mjs → swift-sdk-app-module-Y6SPJUF6.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-image-2Y4Q3HYS.mjs → swift-sdk-image-RLJ2JW6P.mjs} +13 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-KQC2JCMQ.mjs → swift-sdk-image-producer-YOUR3PUP.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +31 -13
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +33 -15
- package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- 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/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +15 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +79 -79
- package/dist-lib/public-origins-lib.json +69 -69
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- 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 +7 -7
- package/dist-lib/skills.cjs +33 -15
- package/dist-lib/swift-compile.cjs +29 -11
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +5 -5
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +62 -0
- package/dist-types/packages/peach-engine/src/render-worker/shellScrollContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/swift-header-compiler.ts +9 -4
- package/src/swift-sdk-app-module.ts +2 -5
- package/src/swift-sdk-image.ts +2 -4
- package/src/swift-wasm-prune.ts +17 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2532 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
parse
|
|
4
|
-
} from "./esm-chunks/chunk-
|
|
4
|
+
} from "./esm-chunks/chunk-5MPQROQI.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__privateAdd,
|
|
7
7
|
__privateGet,
|
|
8
8
|
__publicField
|
|
9
|
-
} from "./esm-chunks/chunk-
|
|
9
|
+
} from "./esm-chunks/chunk-J4BQEGDW.mjs";
|
|
10
10
|
|
|
11
11
|
// src/worklet-kernel.ts
|
|
12
12
|
var Unsupported = class extends Error {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type DisplayServerMessage } from '../engine/remote-display-protocol.d.ts';
|
|
1
2
|
import { type RemotePeerIdentity } from './cloud-display.d.ts';
|
|
3
|
+
import type { SootSimSceneStreamCommand as SceneStreamCommand, SootSimSceneStreamResult as SceneStreamResult } from '../../../peach-globals/src/index.d.ts';
|
|
2
4
|
declare const FORMAT = 1;
|
|
3
5
|
export declare const MAX_SCENE_RECORDING_BYTES: number;
|
|
4
6
|
export declare const SCENE_RECORDING_CONTENT_TYPE = "application/vnd.peach.scene-stream+gzip";
|
|
@@ -49,4 +51,64 @@ export declare class SceneRecorder {
|
|
|
49
51
|
private push;
|
|
50
52
|
finish(stoppedAtMs: number, peer: RemotePeerIdentity): SceneRecording;
|
|
51
53
|
}
|
|
54
|
+
export declare class SceneReplayLink {
|
|
55
|
+
private readonly frames;
|
|
56
|
+
readonly durationMs: number;
|
|
57
|
+
private rateValue;
|
|
58
|
+
private readonly deliver;
|
|
59
|
+
readonly open = true;
|
|
60
|
+
readonly bufferedAmount = 0;
|
|
61
|
+
private next;
|
|
62
|
+
private originMs;
|
|
63
|
+
private pausedAtMs;
|
|
64
|
+
private timer;
|
|
65
|
+
private closed;
|
|
66
|
+
constructor(frames: readonly SceneRecordingFrame[], durationMs: number, rateValue: number, deliver: (bytes: Uint8Array, arrivalMs: number | null) => void);
|
|
67
|
+
send(): void;
|
|
68
|
+
close(): void;
|
|
69
|
+
get timeMs(): number;
|
|
70
|
+
get playing(): boolean;
|
|
71
|
+
get ended(): boolean;
|
|
72
|
+
canReach(timeMs: number): boolean;
|
|
73
|
+
play(): void;
|
|
74
|
+
pause(): void;
|
|
75
|
+
setRate(rate: number): void;
|
|
76
|
+
seek(timeMs: number): void;
|
|
77
|
+
private cancel;
|
|
78
|
+
private pump;
|
|
79
|
+
}
|
|
80
|
+
export interface SceneStreamControllerHost {
|
|
81
|
+
readonly url: string;
|
|
82
|
+
readonly autoplay: boolean;
|
|
83
|
+
readonly expectedPeer: RemotePeerIdentity;
|
|
84
|
+
isDisposed(): boolean;
|
|
85
|
+
isLive(): boolean;
|
|
86
|
+
awaitInbound(): Promise<void>;
|
|
87
|
+
replaceReplayLink(link: SceneReplayLink): void;
|
|
88
|
+
deliverReplayFrame(link: SceneReplayLink, bytes: Uint8Array, arrivalMs: number | null): void;
|
|
89
|
+
sendResync(surfaceId: string, reason: 'reconnect'): void;
|
|
90
|
+
onError(error: unknown, fallback: string): void;
|
|
91
|
+
}
|
|
92
|
+
export declare class SceneStreamController {
|
|
93
|
+
private readonly host;
|
|
94
|
+
private replay;
|
|
95
|
+
private replayRate;
|
|
96
|
+
private replayLoad;
|
|
97
|
+
private replaySource;
|
|
98
|
+
private recorder;
|
|
99
|
+
private readonly stateFrames;
|
|
100
|
+
constructor(host: SceneStreamControllerHost);
|
|
101
|
+
get hasSource(): boolean;
|
|
102
|
+
get isReplaying(): boolean;
|
|
103
|
+
get replayLink(): SceneReplayLink | null;
|
|
104
|
+
reopenCurrentReplay(): boolean;
|
|
105
|
+
clearReplay(): void;
|
|
106
|
+
reset(): void;
|
|
107
|
+
takeIncoming(message: DisplayServerMessage, bytes: Uint8Array, arrivalMs: number | null, fullSceneReady: boolean): void;
|
|
108
|
+
startLoad(): void;
|
|
109
|
+
private loadReplay;
|
|
110
|
+
private openReplay;
|
|
111
|
+
private replayState;
|
|
112
|
+
handle(command: SceneStreamCommand): Promise<SceneStreamResult>;
|
|
113
|
+
}
|
|
52
114
|
export {};
|
|
@@ -76,7 +76,7 @@ export interface ShellScrollCommands {
|
|
|
76
76
|
10: (surface: string, pointer: number, node: number) => boolean;
|
|
77
77
|
11: (owner: ScrollMirrorOwner, pointer: number) => boolean;
|
|
78
78
|
12: (owner: ScrollMirrorOwner, pointer: number) => boolean;
|
|
79
|
-
13: (surface: string, x: number, y: number, dx: number, dy: number, timestamp: number, root?: number) =>
|
|
79
|
+
13: (surface: string, x: number, y: number, dx: number, dy: number, timestamp: number, root?: number) => boolean;
|
|
80
80
|
14: (surface: string, input: WheelTrackInput, root?: number) => {
|
|
81
81
|
id: number;
|
|
82
82
|
target: WheelTrackTarget | null;
|
|
@@ -37,7 +37,7 @@ export type TenantToShellPeerMessage = Extract<ShellHostToWorker, {
|
|
|
37
37
|
type: 'worklet' | 'workletBatch' | 'scrollNodeSnapshot' | 'scrollControl' | 'nativeUIRequest' | 'gestureSeamRequest' | 'gestureSeamRequestBatch' | 'nativeMenuGestureBegin' | 'nativeMenuTouchContinued' | 'cursorMirror' | 'editMenuMirror' | 'loupeMirror' | 'registerAppFonts' | 'nativeFetchUserAgent' | 'requestEngineResource' | 'engineResource' | 'storageSync';
|
|
38
38
|
}>;
|
|
39
39
|
export type ShellToTenantPeerMessage = Extract<HostToWorker, {
|
|
40
|
-
type: 'worklet' | 'scrollControl' | 'scrollControlPacket' | 'scrollSlotsRetired' | 'gestureSeamEvent' | 'screenEdgeSwipeCommit' | 'shellScreenInteractive' | 'screenFormSheetCommit' | 'shellControlEvent' | 'screenTransitionStarted' | 'screenTransitionProgress' | 'cursorRectBack' | 'editMenuRectsBack' | 'imageLifecycleEvent' | 'lottieLifecycleEvent' | 'appFontsRegistered' | 'engineResource' | 'requestEngineResource';
|
|
40
|
+
type: 'worklet' | 'scrollControl' | 'scrollControlPacket' | 'scrollSlotsRetired' | 'wheelOnSurface' | 'gestureSeamEvent' | 'screenEdgeSwipeCommit' | 'shellScreenInteractive' | 'screenFormSheetCommit' | 'shellControlEvent' | 'screenTransitionStarted' | 'screenTransitionProgress' | 'cursorRectBack' | 'editMenuRectsBack' | 'imageLifecycleEvent' | 'lottieLifecycleEvent' | 'appFontsRegistered' | 'engineResource' | 'requestEngineResource';
|
|
41
41
|
}>;
|
|
42
42
|
export declare function isTenantToShellPeerMessage(message: object): message is TenantToShellPeerMessage;
|
|
43
43
|
export declare function isShellToTenantPeerMessage(message: object): message is ShellToTenantPeerMessage;
|
package/kotlin/sdk.tar.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/runtime-companion.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":1,"sha256":"
|
|
1
|
+
{"abi":1,"sha256":"2df38358a3ae16176e6f31e890e3d87514f926f3425b2496548155d93b0e7691","file":"node/cli-2df38358a3ae16176e6f31e890e3d87514f926f3425b2496548155d93b0e7691.cjs"}
|
|
@@ -22,8 +22,9 @@ const argument = (value: string) => `'${value.replaceAll("'", `'"'"'`)}'`
|
|
|
22
22
|
|
|
23
23
|
const client = `const { request } = require('node:http')
|
|
24
24
|
const { spawnSync } = require('node:child_process')
|
|
25
|
-
const { existsSync } = require('node:fs')
|
|
26
|
-
const [
|
|
25
|
+
const { existsSync, readFileSync } = require('node:fs')
|
|
26
|
+
const [socketFile, moduleName, swiftc, receipt, ...args] = process.argv.slice(2)
|
|
27
|
+
const socketPath = readFileSync(socketFile, 'utf8')
|
|
27
28
|
const body = JSON.stringify(args)
|
|
28
29
|
const notify = (method) => new Promise((resolve, reject) => {
|
|
29
30
|
const req = request({ socketPath, path: '/' + moduleName, method, agent: false }, response => {
|
|
@@ -105,6 +106,7 @@ export async function withSwiftHeaderCompiler<T>(
|
|
|
105
106
|
const wrapper = path.join(root, SWIFT_HEADER_COMPILER_WRAPPER)
|
|
106
107
|
const script = path.join(root, '.build', 'peach-swift-header.cjs')
|
|
107
108
|
const checkpoints = path.join(root, '.build', 'peach-swift-header-checkpoints')
|
|
109
|
+
const socketFile = path.join(root, '.build', 'peach-swift-header-socket')
|
|
108
110
|
mkdirSync(checkpoints, { recursive: true })
|
|
109
111
|
const swiftc = argument(path.join(toolchainBin, 'swiftc'))
|
|
110
112
|
writeBuildFile(script, client)
|
|
@@ -120,7 +122,7 @@ export async function withSwiftHeaderCompiler<T>(
|
|
|
120
122
|
'done',
|
|
121
123
|
'case "$compile:$module" in',
|
|
122
124
|
` ${[...producers.keys()].map((name) => argument(`1:${name}`)).join('|')})`,
|
|
123
|
-
` ${PEACH_FORKED_SCRIPT_ENV}=1 exec ${argument(process.execPath)} ${argument(script)}
|
|
125
|
+
` ${PEACH_FORKED_SCRIPT_ENV}=1 exec ${argument(process.execPath)} ${argument(script)} ${argument(socketFile)} "$module" ${swiftc} ${argument(checkpoints)}/"$module" "$@" ;;`,
|
|
124
126
|
'esac',
|
|
125
127
|
`exec ${swiftc} "$@"`,
|
|
126
128
|
'',
|
|
@@ -176,10 +178,13 @@ export async function withSwiftHeaderCompiler<T>(
|
|
|
176
178
|
server.once('error', reject)
|
|
177
179
|
server.listen(socket, resolve)
|
|
178
180
|
})
|
|
179
|
-
|
|
181
|
+
// swiftpm includes the entire environment in its build plan signature.
|
|
182
|
+
writeFileSync(socketFile, socket)
|
|
183
|
+
return await build({ SWIFT_EXEC: wrapper })
|
|
180
184
|
} finally {
|
|
181
185
|
server.close()
|
|
182
186
|
server.closeAllConnections()
|
|
187
|
+
rmSync(socketFile, { force: true })
|
|
183
188
|
rmSync(directory, { recursive: true, force: true })
|
|
184
189
|
}
|
|
185
190
|
}
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
moduleFamily,
|
|
51
51
|
objcCategoryNeedsFamily,
|
|
52
52
|
readArMembers,
|
|
53
|
+
readSwiftPrunedLinkResponse,
|
|
53
54
|
SWIFT_PRUNED_LINK_MAP,
|
|
54
55
|
} from './swift-wasm-prune'
|
|
55
56
|
import { SWIFT_SDK_FUNCTION_ADDRESS_PREFIX } from './swiftSdkLinkContract'
|
|
@@ -79,16 +80,12 @@ export async function buildSwiftAppModule(options: {
|
|
|
79
80
|
project?: SwiftProjectUser & { sdkRoot: string; linked: string }
|
|
80
81
|
}): Promise<SwiftSdkBindingAsset> {
|
|
81
82
|
const { buildRoot, toolchainBin, sdk, project } = options
|
|
82
|
-
const rsp = path.join(buildRoot, '.peach-link.pruned.rsp')
|
|
83
83
|
const work = project
|
|
84
84
|
? mkdtempSync(path.join(buildRoot, '.peach-sdk-module-'))
|
|
85
85
|
: path.join(buildRoot, '.peach-sdk-module')
|
|
86
86
|
if (project) chownSync(work, project.uid, project.gid)
|
|
87
87
|
else mkdirSync(work, { recursive: true })
|
|
88
|
-
const tokens =
|
|
89
|
-
.trim()
|
|
90
|
-
.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
|
91
|
-
.map((token) => token.replace(/^"|"$/g, '').replace(/\\(.)/g, '$1'))
|
|
88
|
+
const tokens = readSwiftPrunedLinkResponse(buildRoot)
|
|
92
89
|
// the pruned link of the whole program names the sdk data and constructors the app keeps
|
|
93
90
|
const outputAt = tokens.indexOf('-o')
|
|
94
91
|
const pruned = project?.linked ?? (outputAt < 0 ? undefined : tokens[outputAt + 1])
|
package/src/swift-sdk-image.ts
CHANGED
|
@@ -42,6 +42,7 @@ import { sourceSwiftCheckout, swiftCacheDir } from './swift-toolchain'
|
|
|
42
42
|
import {
|
|
43
43
|
guestWasmSymbols,
|
|
44
44
|
readArMembers,
|
|
45
|
+
readSwiftPrunedLinkResponse,
|
|
45
46
|
type SwiftSdkObjectOrigin,
|
|
46
47
|
} from './swift-wasm-prune'
|
|
47
48
|
import { SWIFT_WASM_TRIPLE } from './swiftTargetContract'
|
|
@@ -609,10 +610,7 @@ async function linkSwiftSdkImage(
|
|
|
609
610
|
// replaces the pruned copies the app linked) and its libraries
|
|
610
611
|
function sdkLinkInputs(appRoot: string) {
|
|
611
612
|
const unquote = (token: string) => token.replace(/^"|"$/g, '').replace(/\\(.)/g, '$1')
|
|
612
|
-
const tokens =
|
|
613
|
-
.trim()
|
|
614
|
-
.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
|
615
|
-
.map(unquote)
|
|
613
|
+
const tokens = readSwiftPrunedLinkResponse(appRoot)
|
|
616
614
|
// a distribution's prebuilt objects, or the frameworks a source checkout built
|
|
617
615
|
const list = readdirSync(appRoot).find(
|
|
618
616
|
(name) =>
|
package/src/swift-wasm-prune.ts
CHANGED
|
@@ -1425,6 +1425,22 @@ export function keepsSwiftUIReflection(
|
|
|
1425
1425
|
|
|
1426
1426
|
/** the pruned link's map, from which an app module selects the sdk data it keeps. */
|
|
1427
1427
|
export const SWIFT_PRUNED_LINK_MAP = '.peach-link.map'
|
|
1428
|
+
const SWIFT_PRUNED_LINK_RESPONSE = '.peach-link.pruned.rsp'
|
|
1429
|
+
|
|
1430
|
+
export function readSwiftPrunedLinkResponse(directory: string): string[] {
|
|
1431
|
+
const file = path.join(directory, SWIFT_PRUNED_LINK_RESPONSE)
|
|
1432
|
+
const text = fs.readFileSync(file, 'utf8').trim()
|
|
1433
|
+
const argument = /("(?:[^"\\]|\\.)*")(?:\s+|$)/gy
|
|
1434
|
+
const args: string[] = []
|
|
1435
|
+
while (argument.lastIndex < text.length) {
|
|
1436
|
+
const offset = argument.lastIndex
|
|
1437
|
+
const match = argument.exec(text)
|
|
1438
|
+
if (!match) throw new Error(`invalid Swift link argument at ${file}:${offset}`)
|
|
1439
|
+
const token: string = JSON.parse(match[1]!)
|
|
1440
|
+
args.push(token)
|
|
1441
|
+
}
|
|
1442
|
+
return args
|
|
1443
|
+
}
|
|
1428
1444
|
|
|
1429
1445
|
export function pruneSwiftWasmLink(
|
|
1430
1446
|
directory: string,
|
|
@@ -2823,7 +2839,7 @@ export function pruneSwiftWasmLink(
|
|
|
2823
2839
|
leftoverArchiveFiles.length = 0
|
|
2824
2840
|
}
|
|
2825
2841
|
|
|
2826
|
-
const prunedRspPath = path.join(directory,
|
|
2842
|
+
const prunedRspPath = path.join(directory, SWIFT_PRUNED_LINK_RESPONSE)
|
|
2827
2843
|
fs.writeFileSync(prunedRspPath, outTokens.map((t) => JSON.stringify(t)).join(' '))
|
|
2828
2844
|
if (link) {
|
|
2829
2845
|
const sdk = { wasiDirectory: sdkWasiDir, objectDirectory: sdkObjsDir }
|