rnxsim 0.1.523 → 0.1.525
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/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/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.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- 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 +3 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.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/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 +1 -1
- package/dist-lib/swift.cjs +342 -28
- package/dist-lib/vite.cjs +255 -6
- package/package.json +1 -1
- package/src/vite-plugin-swift.ts +249 -7
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.525 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -44,6 +44,255 @@ var import_ui = require("contrast-kit/ui");
|
|
|
44
44
|
var import_react = require("react");
|
|
45
45
|
var import_react_native = require("react-native");
|
|
46
46
|
var import_react_native_bottom_tabs = __toESM(require("react-native-bottom-tabs"), 1);
|
|
47
|
+
|
|
48
|
+
// ../sootsim-swift/src/bundleAssets.ts
|
|
49
|
+
function resolveImageSource(source, table, onMiss) {
|
|
50
|
+
if (typeof source !== "string") return source;
|
|
51
|
+
const url = table[source];
|
|
52
|
+
if (typeof url === "string") return { uri: url };
|
|
53
|
+
onMiss(source);
|
|
54
|
+
return source;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ../sootsim-swift/src/resfs.ts
|
|
58
|
+
var RES_BADF = 8;
|
|
59
|
+
var RES_INVAL = 28;
|
|
60
|
+
var RES_NOENT = 44;
|
|
61
|
+
var RES_NOTDIR = 54;
|
|
62
|
+
var RES_NOTCAPABLE = 76;
|
|
63
|
+
var RES_DIRTYPE = 3;
|
|
64
|
+
var RES_FILETYPE = 4;
|
|
65
|
+
var O_CREAT = 1;
|
|
66
|
+
var O_DIRECTORY = 2;
|
|
67
|
+
var O_EXCL = 4;
|
|
68
|
+
var O_TRUNC = 8;
|
|
69
|
+
var RES_PREOPEN = 3;
|
|
70
|
+
var RES_DIR_NAME = "/res";
|
|
71
|
+
var B64_DIGITS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
72
|
+
function decodeBase64(text) {
|
|
73
|
+
const clean = text.replace(/\s/g, "");
|
|
74
|
+
if (clean.length % 4 !== 0) {
|
|
75
|
+
throw new Error(`swift bundle file is not base64 (length ${clean.length})`);
|
|
76
|
+
}
|
|
77
|
+
const values = new Uint8Array(clean.length);
|
|
78
|
+
let length = clean.length;
|
|
79
|
+
let pad = 0;
|
|
80
|
+
if (clean.endsWith("==")) pad = 2;
|
|
81
|
+
else if (clean.endsWith("=")) pad = 1;
|
|
82
|
+
length -= pad;
|
|
83
|
+
for (let index = 0; index < clean.length - pad; index += 1) {
|
|
84
|
+
const digit = B64_DIGITS.indexOf(clean[index]);
|
|
85
|
+
if (digit < 0) {
|
|
86
|
+
throw new Error(`swift bundle file is not base64 (char '${clean[index]}')`);
|
|
87
|
+
}
|
|
88
|
+
values[index] = digit;
|
|
89
|
+
}
|
|
90
|
+
const out = new Uint8Array((clean.length / 4 | 0) * 3 - pad);
|
|
91
|
+
let at = 0;
|
|
92
|
+
for (let index = 0; index < clean.length; index += 4) {
|
|
93
|
+
const group = values[index] << 18 | values[index + 1] << 12 | values[index + 2] << 6 | values[index + 3];
|
|
94
|
+
out[at] = group >> 16 & 255;
|
|
95
|
+
if (at + 1 < out.length) out[at + 1] = group >> 8 & 255;
|
|
96
|
+
if (at + 2 < out.length) out[at + 2] = group & 255;
|
|
97
|
+
at += 3;
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
function resIno(name) {
|
|
102
|
+
let hash = 0xcbf29ce484222325n;
|
|
103
|
+
const bytes = new TextEncoder().encode(name);
|
|
104
|
+
for (const byte of bytes) {
|
|
105
|
+
hash ^= BigInt(byte);
|
|
106
|
+
hash = hash * 0x100000001b3n & 0xffffffffffffffffn;
|
|
107
|
+
}
|
|
108
|
+
return hash === 0n ? 1n : hash;
|
|
109
|
+
}
|
|
110
|
+
function resArgv0(moduleUrl) {
|
|
111
|
+
const base = moduleUrl.split("/").pop()?.split("?")[0] ?? "app.wasm";
|
|
112
|
+
return `${RES_DIR_NAME}/${base === "" ? "app.wasm" : base}`;
|
|
113
|
+
}
|
|
114
|
+
function resolveName(files, rel) {
|
|
115
|
+
let rest = rel;
|
|
116
|
+
if (rest === RES_DIR_NAME || rest === `${RES_DIR_NAME}/`) return null;
|
|
117
|
+
if (rest.startsWith(`${RES_DIR_NAME}/`)) rest = rest.slice(RES_DIR_NAME.length + 1);
|
|
118
|
+
if (rest.startsWith("/")) rest = rest.slice(1);
|
|
119
|
+
while (rest.startsWith("./")) rest = rest.slice(2);
|
|
120
|
+
if (rest === "" || rest === ".") return null;
|
|
121
|
+
if (rest.includes("/")) return null;
|
|
122
|
+
return Object.prototype.hasOwnProperty.call(files, rest) ? rest : null;
|
|
123
|
+
}
|
|
124
|
+
function writeStat(mem, ptr, filetype, size, ino) {
|
|
125
|
+
mem.bytes().fill(0, ptr, ptr + 64);
|
|
126
|
+
mem.bytes()[ptr + 16] = filetype;
|
|
127
|
+
mem.writeU64(ptr + 8, ino);
|
|
128
|
+
mem.writeU64(ptr + 32, BigInt(size));
|
|
129
|
+
}
|
|
130
|
+
function createResFs(files) {
|
|
131
|
+
const names = Object.keys(files).sort();
|
|
132
|
+
const fds = /* @__PURE__ */ new Map();
|
|
133
|
+
let nextFd = RES_PREOPEN + 1;
|
|
134
|
+
const freeFds = [];
|
|
135
|
+
let preopenOpen = true;
|
|
136
|
+
const allocFd = () => {
|
|
137
|
+
if (freeFds.length > 0) return freeFds.shift();
|
|
138
|
+
nextFd += 1;
|
|
139
|
+
return nextFd - 1;
|
|
140
|
+
};
|
|
141
|
+
const dirFdOk = (fd) => {
|
|
142
|
+
if (fd === RES_PREOPEN) return preopenOpen;
|
|
143
|
+
const found = fds.get(fd);
|
|
144
|
+
return found !== void 0 && found.kind === "dir";
|
|
145
|
+
};
|
|
146
|
+
const inoOf = (name) => resIno(name);
|
|
147
|
+
return {
|
|
148
|
+
imports(mem) {
|
|
149
|
+
return {
|
|
150
|
+
path_open: (dirfd, _dirflags, pathPtr, pathLen, oflags, _r1, _r2, _r3, fdPtr) => {
|
|
151
|
+
if (!dirFdOk(dirfd)) return RES_BADF;
|
|
152
|
+
if ((oflags & (O_CREAT | O_EXCL | O_TRUNC)) !== 0) return RES_INVAL;
|
|
153
|
+
const rel = mem.readString(pathPtr, pathLen);
|
|
154
|
+
if (rel === "." || rel === "./" || rel === RES_DIR_NAME || rel === `${RES_DIR_NAME}/`) {
|
|
155
|
+
const fd2 = allocFd();
|
|
156
|
+
fds.set(fd2, { kind: "dir" });
|
|
157
|
+
mem.writeU32(fdPtr, fd2);
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
const hit = resolveName(files, rel);
|
|
161
|
+
if (hit === null) return RES_NOENT;
|
|
162
|
+
if ((oflags & O_DIRECTORY) !== 0) return RES_NOTDIR;
|
|
163
|
+
const fd = allocFd();
|
|
164
|
+
fds.set(fd, { kind: "file", name: hit, bytes: files[hit], offset: 0 });
|
|
165
|
+
mem.writeU32(fdPtr, fd);
|
|
166
|
+
return 0;
|
|
167
|
+
},
|
|
168
|
+
path_filestat_get: (dirfd, _flags, pathPtr, pathLen, statPtr) => {
|
|
169
|
+
if (!dirFdOk(dirfd)) return RES_BADF;
|
|
170
|
+
const rel = mem.readString(pathPtr, pathLen);
|
|
171
|
+
if (rel === "." || rel === "./" || rel === RES_DIR_NAME || rel === `${RES_DIR_NAME}/`) {
|
|
172
|
+
writeStat(mem, statPtr, RES_DIRTYPE, 0, inoOf(RES_DIR_NAME));
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
const hit = resolveName(files, rel);
|
|
176
|
+
if (hit === null) return RES_NOENT;
|
|
177
|
+
writeStat(mem, statPtr, RES_FILETYPE, files[hit].length, inoOf(hit));
|
|
178
|
+
return 0;
|
|
179
|
+
},
|
|
180
|
+
fd_fdstat_get: (fd, statPtr) => {
|
|
181
|
+
if (fd === RES_PREOPEN) {
|
|
182
|
+
if (!preopenOpen) return RES_BADF;
|
|
183
|
+
mem.bytes().fill(0, statPtr, statPtr + 24);
|
|
184
|
+
mem.bytes()[statPtr] = RES_DIRTYPE;
|
|
185
|
+
return 0;
|
|
186
|
+
}
|
|
187
|
+
const found = fds.get(fd);
|
|
188
|
+
if (!found) return RES_BADF;
|
|
189
|
+
mem.bytes().fill(0, statPtr, statPtr + 24);
|
|
190
|
+
mem.bytes()[statPtr] = found.kind === "dir" ? RES_DIRTYPE : RES_FILETYPE;
|
|
191
|
+
return 0;
|
|
192
|
+
},
|
|
193
|
+
fd_filestat_get: (fd, statPtr) => {
|
|
194
|
+
const found = fds.get(fd);
|
|
195
|
+
if (!found) return RES_BADF;
|
|
196
|
+
if (found.kind === "dir") {
|
|
197
|
+
writeStat(mem, statPtr, RES_DIRTYPE, 0, inoOf(RES_DIR_NAME));
|
|
198
|
+
return 0;
|
|
199
|
+
}
|
|
200
|
+
writeStat(mem, statPtr, RES_FILETYPE, found.bytes.length, inoOf(found.name));
|
|
201
|
+
return 0;
|
|
202
|
+
},
|
|
203
|
+
fd_prestat_get: (fd, prestatPtr) => {
|
|
204
|
+
if (fd === RES_PREOPEN && preopenOpen) {
|
|
205
|
+
mem.bytes().fill(0, prestatPtr, prestatPtr + 8);
|
|
206
|
+
mem.bytes()[prestatPtr] = 0;
|
|
207
|
+
mem.writeU32(prestatPtr + 4, RES_DIR_NAME.length);
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
return RES_BADF;
|
|
211
|
+
},
|
|
212
|
+
fd_prestat_dir_name: (fd, pathPtr, pathLen) => {
|
|
213
|
+
if (fd !== RES_PREOPEN || !preopenOpen) return RES_BADF;
|
|
214
|
+
if (pathLen < RES_DIR_NAME.length) return RES_INVAL;
|
|
215
|
+
mem.bytes().set(new TextEncoder().encode(RES_DIR_NAME), pathPtr);
|
|
216
|
+
return 0;
|
|
217
|
+
},
|
|
218
|
+
fd_readdir: (fd, bufPtr, bufLen, cookie, usedPtr) => {
|
|
219
|
+
const isPreopen = fd === RES_PREOPEN && preopenOpen;
|
|
220
|
+
const found = fds.get(fd);
|
|
221
|
+
if (!isPreopen && !found) return RES_BADF;
|
|
222
|
+
if (!isPreopen && found?.kind !== "dir") return RES_NOTCAPABLE;
|
|
223
|
+
let used = 0;
|
|
224
|
+
names.forEach((name, index) => {
|
|
225
|
+
const next = index + 1;
|
|
226
|
+
if (next <= cookie) return;
|
|
227
|
+
const encoded = new TextEncoder().encode(name);
|
|
228
|
+
if (used + 24 + encoded.length > bufLen) return;
|
|
229
|
+
const at = bufPtr + used;
|
|
230
|
+
mem.writeU64(at, BigInt(next));
|
|
231
|
+
mem.writeU64(at + 8, inoOf(name));
|
|
232
|
+
mem.writeU32(at + 16, encoded.length);
|
|
233
|
+
mem.bytes()[at + 20] = RES_FILETYPE;
|
|
234
|
+
mem.bytes().fill(0, at + 21, at + 24);
|
|
235
|
+
mem.bytes().set(encoded, at + 24);
|
|
236
|
+
used += 24 + encoded.length;
|
|
237
|
+
});
|
|
238
|
+
mem.writeU32(usedPtr, used);
|
|
239
|
+
return 0;
|
|
240
|
+
},
|
|
241
|
+
fd_read: (fd, iovsPtr, iovsLen, donePtr) => {
|
|
242
|
+
const found = fds.get(fd);
|
|
243
|
+
if (!found) return RES_BADF;
|
|
244
|
+
if (found.kind !== "file") return RES_NOTCAPABLE;
|
|
245
|
+
let done = 0;
|
|
246
|
+
for (let index = 0; index < iovsLen; index += 1) {
|
|
247
|
+
const ptr = mem.readU32(iovsPtr + index * 8);
|
|
248
|
+
const want = mem.readU32(iovsPtr + index * 8 + 4);
|
|
249
|
+
const chunk = found.bytes.subarray(found.offset, found.offset + want);
|
|
250
|
+
mem.bytes().set(chunk, ptr);
|
|
251
|
+
found.offset += chunk.length;
|
|
252
|
+
done += chunk.length;
|
|
253
|
+
if (chunk.length < want) break;
|
|
254
|
+
}
|
|
255
|
+
mem.writeU32(donePtr, done);
|
|
256
|
+
return 0;
|
|
257
|
+
},
|
|
258
|
+
// the tree is read-only: any write to it is not-capable, and an
|
|
259
|
+
// unknown fd is a bad descriptor. stdio never reaches here; the
|
|
260
|
+
// mount answers fds 0-2 itself before delegating.
|
|
261
|
+
fd_write: (fd, _iovsPtr, _iovsLen, _donePtr) => {
|
|
262
|
+
if (fd === RES_PREOPEN || fds.has(fd)) return RES_NOTCAPABLE;
|
|
263
|
+
return RES_BADF;
|
|
264
|
+
},
|
|
265
|
+
fd_pread: (fd, _iovsPtr, _iovsLen, _offset, _donePtr) => {
|
|
266
|
+
if (fd === RES_PREOPEN || fds.has(fd)) return RES_NOTCAPABLE;
|
|
267
|
+
return RES_BADF;
|
|
268
|
+
},
|
|
269
|
+
fd_seek: (fd, _offLo, _offHi, _whence, _posPtr) => {
|
|
270
|
+
if (fd === RES_PREOPEN || fds.has(fd)) return RES_NOTCAPABLE;
|
|
271
|
+
return RES_BADF;
|
|
272
|
+
},
|
|
273
|
+
fd_tell: (fd, _posPtr) => {
|
|
274
|
+
if (fd === RES_PREOPEN || fds.has(fd)) return RES_NOTCAPABLE;
|
|
275
|
+
return RES_BADF;
|
|
276
|
+
},
|
|
277
|
+
fd_close: (fd) => {
|
|
278
|
+
if (fd === RES_PREOPEN) {
|
|
279
|
+
if (!preopenOpen) return RES_BADF;
|
|
280
|
+
preopenOpen = false;
|
|
281
|
+
return 0;
|
|
282
|
+
}
|
|
283
|
+
if (!fds.has(fd)) return RES_BADF;
|
|
284
|
+
fds.delete(fd);
|
|
285
|
+
const at = freeFds.findIndex((other) => other > fd);
|
|
286
|
+
if (at < 0) freeFds.push(fd);
|
|
287
|
+
else freeFds.splice(at, 0, fd);
|
|
288
|
+
return 0;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ../sootsim-swift/src/mount.tsx
|
|
47
296
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
297
|
function isRecord(value) {
|
|
49
298
|
return typeof value === "object" && value !== null;
|
|
@@ -93,12 +342,28 @@ function readTree(text) {
|
|
|
93
342
|
}
|
|
94
343
|
var WASI_BADF = 8;
|
|
95
344
|
var WASI_INVAL = 28;
|
|
96
|
-
function wasiImports(host) {
|
|
345
|
+
function wasiImports(host, argv, resFiles) {
|
|
346
|
+
const argvBytes = argv.map((arg) => new TextEncoder().encode(`${arg}\0`));
|
|
347
|
+
const resImports = createResFs(resFiles).imports(host);
|
|
97
348
|
return {
|
|
98
|
-
args_get: () =>
|
|
349
|
+
args_get: (argvPtr, bufPtr) => {
|
|
350
|
+
let argp = argvPtr;
|
|
351
|
+
let bufp = bufPtr;
|
|
352
|
+
for (const bytes of argvBytes) {
|
|
353
|
+
host.writeU32(argp, bufp);
|
|
354
|
+
host.bytes().set(bytes, bufp);
|
|
355
|
+
argp += 4;
|
|
356
|
+
bufp += bytes.length;
|
|
357
|
+
}
|
|
358
|
+
host.writeU32(argp, 0);
|
|
359
|
+
return 0;
|
|
360
|
+
},
|
|
99
361
|
args_sizes_get: (argcPtr, argvSizePtr) => {
|
|
100
|
-
host.writeU32(argcPtr,
|
|
101
|
-
host.writeU32(
|
|
362
|
+
host.writeU32(argcPtr, argvBytes.length);
|
|
363
|
+
host.writeU32(
|
|
364
|
+
argvSizePtr,
|
|
365
|
+
argvBytes.reduce((total, bytes) => total + bytes.length, 0)
|
|
366
|
+
);
|
|
102
367
|
return 0;
|
|
103
368
|
},
|
|
104
369
|
environ_get: () => 0,
|
|
@@ -107,21 +372,23 @@ function wasiImports(host) {
|
|
|
107
372
|
host.writeU32(sizePtr, 0);
|
|
108
373
|
return 0;
|
|
109
374
|
},
|
|
110
|
-
fd_close: () =>
|
|
111
|
-
fd_fdstat_get: () =>
|
|
375
|
+
fd_close: (...args) => resImports.fd_close(...args),
|
|
376
|
+
fd_fdstat_get: (...args) => resImports.fd_fdstat_get(...args),
|
|
112
377
|
fd_fdstat_set_flags: () => WASI_BADF,
|
|
113
|
-
fd_filestat_get: () =>
|
|
378
|
+
fd_filestat_get: (...args) => resImports.fd_filestat_get(...args),
|
|
114
379
|
fd_filestat_set_size: () => WASI_BADF,
|
|
115
380
|
fd_filestat_set_times: () => WASI_BADF,
|
|
116
|
-
fd_pread: () =>
|
|
117
|
-
fd_prestat_get: () =>
|
|
118
|
-
fd_prestat_dir_name: () =>
|
|
119
|
-
fd_read: () =>
|
|
120
|
-
fd_readdir: () =>
|
|
121
|
-
fd_seek: () =>
|
|
381
|
+
fd_pread: (...args) => resImports.fd_pread(...args),
|
|
382
|
+
fd_prestat_get: (...args) => resImports.fd_prestat_get(...args),
|
|
383
|
+
fd_prestat_dir_name: (...args) => resImports.fd_prestat_dir_name(...args),
|
|
384
|
+
fd_read: (...args) => resImports.fd_read(...args),
|
|
385
|
+
fd_readdir: (...args) => resImports.fd_readdir(...args),
|
|
386
|
+
fd_seek: (...args) => resImports.fd_seek(...args),
|
|
122
387
|
fd_sync: () => WASI_BADF,
|
|
123
|
-
fd_tell: () =>
|
|
124
|
-
fd_write: (
|
|
388
|
+
fd_tell: (...args) => resImports.fd_tell(...args),
|
|
389
|
+
fd_write: (fd, iovsPtr, iovsLen, writtenPtr) => {
|
|
390
|
+
if (fd !== 1 && fd !== 2)
|
|
391
|
+
return resImports.fd_write(fd, iovsPtr, iovsLen, writtenPtr);
|
|
125
392
|
const view = new DataView(host.bytes().buffer);
|
|
126
393
|
let written = 0;
|
|
127
394
|
for (let index = 0; index < iovsLen; index += 1) {
|
|
@@ -131,10 +398,10 @@ function wasiImports(host) {
|
|
|
131
398
|
return 0;
|
|
132
399
|
},
|
|
133
400
|
path_create_directory: () => WASI_BADF,
|
|
134
|
-
path_filestat_get: () =>
|
|
401
|
+
path_filestat_get: (...args) => resImports.path_filestat_get(...args),
|
|
135
402
|
path_filestat_set_times: () => WASI_BADF,
|
|
136
403
|
path_link: () => WASI_BADF,
|
|
137
|
-
path_open: () =>
|
|
404
|
+
path_open: (...args) => resImports.path_open(...args),
|
|
138
405
|
path_readlink: () => WASI_BADF,
|
|
139
406
|
path_remove_directory: () => WASI_BADF,
|
|
140
407
|
path_rename: () => WASI_BADF,
|
|
@@ -195,7 +462,7 @@ function voidExport(exports2, name) {
|
|
|
195
462
|
Reflect.apply(fn, void 0, args);
|
|
196
463
|
};
|
|
197
464
|
}
|
|
198
|
-
function instantiate(module2) {
|
|
465
|
+
function instantiate(module2, bundle) {
|
|
199
466
|
let memory;
|
|
200
467
|
const requireMemory = () => {
|
|
201
468
|
if (!memory) throw new Error("swift artifact memory is not live");
|
|
@@ -208,10 +475,19 @@ function instantiate(module2) {
|
|
|
208
475
|
writeU64(ptr, value) {
|
|
209
476
|
new DataView(requireMemory().buffer).setBigUint64(ptr, value, true);
|
|
210
477
|
},
|
|
478
|
+
readU32(ptr) {
|
|
479
|
+
return new DataView(requireMemory().buffer).getUint32(ptr, true);
|
|
480
|
+
},
|
|
481
|
+
readString(ptr, len) {
|
|
482
|
+
return new TextDecoder().decode(
|
|
483
|
+
new Uint8Array(requireMemory().buffer).subarray(ptr, ptr + len)
|
|
484
|
+
);
|
|
485
|
+
},
|
|
211
486
|
bytes: () => new Uint8Array(requireMemory().buffer)
|
|
212
487
|
};
|
|
488
|
+
const argv = bundle === null ? [] : [bundle.argv0];
|
|
213
489
|
const instance = new WebAssembly.Instance(module2, {
|
|
214
|
-
wasi_snapshot_preview1: wasiImports(host)
|
|
490
|
+
wasi_snapshot_preview1: wasiImports(host, argv, bundle?.files ?? {})
|
|
215
491
|
});
|
|
216
492
|
const exportedMemory = instance.exports.memory;
|
|
217
493
|
if (!(exportedMemory instanceof WebAssembly.Memory)) {
|
|
@@ -266,7 +542,15 @@ function instantiate(module2) {
|
|
|
266
542
|
return result;
|
|
267
543
|
};
|
|
268
544
|
initialize();
|
|
269
|
-
|
|
545
|
+
if (bundle === null) {
|
|
546
|
+
mainArgv(0, 0);
|
|
547
|
+
} else {
|
|
548
|
+
const encoded = new TextEncoder().encode(`${bundle.argv0}\0`);
|
|
549
|
+
const ptr = alloc(encoded.length + 4);
|
|
550
|
+
new Uint8Array(requireMemory().buffer).set(encoded, ptr + 4);
|
|
551
|
+
new DataView(requireMemory().buffer).setUint32(ptr, ptr + 4, true);
|
|
552
|
+
mainArgv(1, ptr);
|
|
553
|
+
}
|
|
270
554
|
return {
|
|
271
555
|
mount: () => {
|
|
272
556
|
if (hasViewExport() === 1) {
|
|
@@ -317,6 +601,21 @@ function instantiate(module2) {
|
|
|
317
601
|
};
|
|
318
602
|
}
|
|
319
603
|
var compiledModules = /* @__PURE__ */ new Map();
|
|
604
|
+
function decodeBundle(moduleUrl, packed) {
|
|
605
|
+
if (packed === void 0) return null;
|
|
606
|
+
const files = {};
|
|
607
|
+
for (const [name, base64] of Object.entries(packed)) {
|
|
608
|
+
try {
|
|
609
|
+
files[name] = decodeBase64(base64);
|
|
610
|
+
} catch (error) {
|
|
611
|
+
throw new Error(
|
|
612
|
+
`swift bundle file '${name}' is not decodable: ${error instanceof Error ? error.message : String(error)}`
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
if (Object.keys(files).length === 0) return null;
|
|
617
|
+
return { files, argv0: resArgv0(moduleUrl) };
|
|
618
|
+
}
|
|
320
619
|
function compile(url) {
|
|
321
620
|
const cached = compiledModules.get(url);
|
|
322
621
|
if (cached) return cached;
|
|
@@ -392,10 +691,12 @@ var SwiftResourcesContext = (0, import_react.createContext)(void 0);
|
|
|
392
691
|
function SwiftImage(props) {
|
|
393
692
|
const table = (0, import_react.useContext)(SwiftResourcesContext);
|
|
394
693
|
const { source, ...rest } = props ?? {};
|
|
395
|
-
const
|
|
694
|
+
const resolved = resolveImageSource(source, table ?? {}, (name) => {
|
|
695
|
+
console.error(`swift: no bundle asset named '${name}' in this mount's resources`);
|
|
696
|
+
});
|
|
396
697
|
return (0, import_react.createElement)(import_ui.Image, {
|
|
397
698
|
...rest,
|
|
398
|
-
...source === void 0 ? {} : { source:
|
|
699
|
+
...source === void 0 ? {} : { source: resolved }
|
|
399
700
|
});
|
|
400
701
|
}
|
|
401
702
|
var NODE_COMPONENTS = {
|
|
@@ -637,8 +938,8 @@ function nodeProps(node, deliver) {
|
|
|
637
938
|
return {
|
|
638
939
|
...typeof props.systemName === "string" ? { systemName: props.systemName } : {},
|
|
639
940
|
// a bundle asset name rides as the kit image source; the kit paints
|
|
640
|
-
//
|
|
641
|
-
//
|
|
941
|
+
// resolved { uri } sources and keeps its placeholder for names the
|
|
942
|
+
// table could not resolve.
|
|
642
943
|
...typeof props.name === "string" ? { source: props.name } : {},
|
|
643
944
|
...props.resizable === true ? { resizable: true } : {},
|
|
644
945
|
...typeof props.renderingMode === "string" ? { renderingMode: props.renderingMode } : {},
|
|
@@ -678,6 +979,8 @@ function nodeProps(node, deliver) {
|
|
|
678
979
|
}
|
|
679
980
|
case "Button":
|
|
680
981
|
return pressProps(node, deliver);
|
|
982
|
+
case "EditButton":
|
|
983
|
+
return pressProps(node, deliver);
|
|
681
984
|
case "TabView": {
|
|
682
985
|
const onSelect = handlerId(node, "onSelect");
|
|
683
986
|
const tabs = (node.c ?? []).map((tab, index) => {
|
|
@@ -1192,10 +1495,18 @@ function SwiftTree({
|
|
|
1192
1495
|
// a navigation stack at the root lays its own bar out under the status
|
|
1193
1496
|
// bar and insets each screen itself, so the host must not also pad it
|
|
1194
1497
|
// down: that pad would move the whole stack a status bar lower
|
|
1498
|
+
// a swiftui scene is opaque: the window behind every screen is
|
|
1499
|
+
// systemBackground, and lists paint their grouped fill over it (the kit's
|
|
1500
|
+
// grouped container already does). without this a listless screen shows
|
|
1501
|
+
// whatever sits beneath the mount. RAN on the safeArea probe (iphone 17
|
|
1502
|
+
// pro): (600,1300) reads #ffffff ios against #f2f2f7 rnx, 99.92% of the
|
|
1503
|
+
// frame; dark matches on both legs (the oracle's falsifier: the two
|
|
1504
|
+
// fills coincide there). PlatformColor is this lane's spelling for a
|
|
1505
|
+
// semantic color.
|
|
1195
1506
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1196
1507
|
import_ui.Host,
|
|
1197
1508
|
{
|
|
1198
|
-
style: { flex: 1 },
|
|
1509
|
+
style: { flex: 1, backgroundColor: (0, import_react_native.PlatformColor)("systemBackground") },
|
|
1199
1510
|
ignoreSafeArea: tree.some(
|
|
1200
1511
|
(node) => node.t === "NavigationStack" || node.t === "NavigationSplitView"
|
|
1201
1512
|
),
|
|
@@ -1234,7 +1545,10 @@ function createRoot(mountTree) {
|
|
|
1234
1545
|
};
|
|
1235
1546
|
const apply = async (options, props) => {
|
|
1236
1547
|
const carried = instance?.exportState() ?? null;
|
|
1237
|
-
const created = instantiate(
|
|
1548
|
+
const created = instantiate(
|
|
1549
|
+
await compile(options.url),
|
|
1550
|
+
decodeBundle(options.url, options.bundleFiles)
|
|
1551
|
+
);
|
|
1238
1552
|
if (carried !== null) created.importState(carried);
|
|
1239
1553
|
if (source !== options) return;
|
|
1240
1554
|
instance = created;
|
|
@@ -1275,7 +1589,7 @@ function createRoot(mountTree) {
|
|
|
1275
1589
|
return {
|
|
1276
1590
|
component,
|
|
1277
1591
|
use(options, refreshKey, props) {
|
|
1278
|
-
const changed = source === null || source.hash !== options.hash || source.url !== options.url || JSON.stringify(source.resources ?? null) !== JSON.stringify(options.resources ?? null) || refreshKey !== void 0 && refreshKey !== refresh;
|
|
1592
|
+
const changed = source === null || source.hash !== options.hash || source.url !== options.url || JSON.stringify(source.resources ?? null) !== JSON.stringify(options.resources ?? null) || JSON.stringify(source.bundleFiles ?? null) !== JSON.stringify(options.bundleFiles ?? null) || refreshKey !== void 0 && refreshKey !== refresh;
|
|
1279
1593
|
if (changed) {
|
|
1280
1594
|
source = options;
|
|
1281
1595
|
refresh = refreshKey;
|