rnxsim 0.1.525 → 0.1.526
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 +15 -0
- 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 +33 -4
- 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/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 +37 -8
- package/dist-lib/swift-submit.cjs +92 -0
- package/dist-lib/swift-submit.mjs +65 -0
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite.cjs +211 -11
- package/package.json +8 -1
- package/src/rolldown-plugin-swift.ts +240 -0
- package/src/swift-submit.ts +185 -0
- package/src/vite-plugin-one.ts +10 -3
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*! rnx v0.1.526 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/swift-submit.ts
|
|
23
|
+
var swift_submit_exports = {};
|
|
24
|
+
__export(swift_submit_exports, {
|
|
25
|
+
SWIFT_COMPILE_PATH: () => SWIFT_COMPILE_PATH,
|
|
26
|
+
compileSwiftProject: () => compileSwiftProject,
|
|
27
|
+
httpSwiftCompileSubmit: () => httpSwiftCompileSubmit
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(swift_submit_exports);
|
|
30
|
+
var SWIFT_COMPILE_PATH = "/api/swift-compile";
|
|
31
|
+
var POLL_INTERVAL_MS = 1500;
|
|
32
|
+
function httpSwiftCompileSubmit(context) {
|
|
33
|
+
const { assetReadToken, endpoint } = context;
|
|
34
|
+
if (!assetReadToken) return void 0;
|
|
35
|
+
const url = endpoint ? `${endpoint.replace(/\/+$/, "")}${SWIFT_COMPILE_PATH}` : SWIFT_COMPILE_PATH;
|
|
36
|
+
return async (work) => {
|
|
37
|
+
let response;
|
|
38
|
+
try {
|
|
39
|
+
response = await fetch(url, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { "content-type": "application/json" },
|
|
42
|
+
body: JSON.stringify({ ...work, token: assetReadToken })
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`contrast-bundler: fetch failed for ${url} while compiling ${work.entry}: ${error instanceof Error ? error.message : String(error)}`,
|
|
47
|
+
{ cause: error }
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
const detail = (await response.text()).trim();
|
|
52
|
+
throw new Error(
|
|
53
|
+
`contrast-bundler: the swift compile for ${work.entry} answered ${response.status}${detail ? `: ${detail}` : ""}`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return await response.json();
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function resolveImageUrls(urls, origin) {
|
|
60
|
+
const resolved = {};
|
|
61
|
+
for (const [name, url] of Object.entries(urls)) {
|
|
62
|
+
resolved[name] = new URL(url, origin).href;
|
|
63
|
+
}
|
|
64
|
+
return resolved;
|
|
65
|
+
}
|
|
66
|
+
async function compileSwiftProject(submit, work, origin) {
|
|
67
|
+
while (true) {
|
|
68
|
+
const outcome = await submit(work);
|
|
69
|
+
switch (outcome.status) {
|
|
70
|
+
case "published":
|
|
71
|
+
return {
|
|
72
|
+
url: new URL(outcome.artifactUrl, origin).href,
|
|
73
|
+
hash: outcome.hash,
|
|
74
|
+
...outcome.imageUrls === void 0 ? {} : { imageUrls: resolveImageUrls(outcome.imageUrls, origin) }
|
|
75
|
+
};
|
|
76
|
+
case "compiling":
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
78
|
+
continue;
|
|
79
|
+
case "refused":
|
|
80
|
+
case "failed":
|
|
81
|
+
throw new Error(
|
|
82
|
+
`contrast-bundler: the swift sources for ${work.entry} cannot be compiled: ${outcome.detail}`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
SWIFT_COMPILE_PATH,
|
|
90
|
+
compileSwiftProject,
|
|
91
|
+
httpSwiftCompileSubmit
|
|
92
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*! rnx v0.1.526 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
|
|
3
|
+
// src/swift-submit.ts
|
|
4
|
+
var SWIFT_COMPILE_PATH = "/api/swift-compile";
|
|
5
|
+
var POLL_INTERVAL_MS = 1500;
|
|
6
|
+
function httpSwiftCompileSubmit(context) {
|
|
7
|
+
const { assetReadToken, endpoint } = context;
|
|
8
|
+
if (!assetReadToken) return void 0;
|
|
9
|
+
const url = endpoint ? `${endpoint.replace(/\/+$/, "")}${SWIFT_COMPILE_PATH}` : SWIFT_COMPILE_PATH;
|
|
10
|
+
return async (work) => {
|
|
11
|
+
let response;
|
|
12
|
+
try {
|
|
13
|
+
response = await fetch(url, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: { "content-type": "application/json" },
|
|
16
|
+
body: JSON.stringify({ ...work, token: assetReadToken })
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`contrast-bundler: fetch failed for ${url} while compiling ${work.entry}: ${error instanceof Error ? error.message : String(error)}`,
|
|
21
|
+
{ cause: error }
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const detail = (await response.text()).trim();
|
|
26
|
+
throw new Error(
|
|
27
|
+
`contrast-bundler: the swift compile for ${work.entry} answered ${response.status}${detail ? `: ${detail}` : ""}`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return await response.json();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function resolveImageUrls(urls, origin) {
|
|
34
|
+
const resolved = {};
|
|
35
|
+
for (const [name, url] of Object.entries(urls)) {
|
|
36
|
+
resolved[name] = new URL(url, origin).href;
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
40
|
+
async function compileSwiftProject(submit, work, origin) {
|
|
41
|
+
while (true) {
|
|
42
|
+
const outcome = await submit(work);
|
|
43
|
+
switch (outcome.status) {
|
|
44
|
+
case "published":
|
|
45
|
+
return {
|
|
46
|
+
url: new URL(outcome.artifactUrl, origin).href,
|
|
47
|
+
hash: outcome.hash,
|
|
48
|
+
...outcome.imageUrls === void 0 ? {} : { imageUrls: resolveImageUrls(outcome.imageUrls, origin) }
|
|
49
|
+
};
|
|
50
|
+
case "compiling":
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
52
|
+
continue;
|
|
53
|
+
case "refused":
|
|
54
|
+
case "failed":
|
|
55
|
+
throw new Error(
|
|
56
|
+
`contrast-bundler: the swift sources for ${work.entry} cannot be compiled: ${outcome.detail}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
SWIFT_COMPILE_PATH,
|
|
63
|
+
compileSwiftProject,
|
|
64
|
+
httpSwiftCompileSubmit
|
|
65
|
+
};
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.526 | (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;
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.526 | (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;
|
|
@@ -35,7 +35,8 @@ __export(vite_plugin_one_exports, {
|
|
|
35
35
|
default: () => vite_plugin_one_default,
|
|
36
36
|
rnxPlugin: () => rnxPlugin,
|
|
37
37
|
sootsimPlugin: () => sootsimPlugin,
|
|
38
|
-
swiftPlugin: () => swiftPlugin
|
|
38
|
+
swiftPlugin: () => swiftPlugin,
|
|
39
|
+
swiftRemotePlugin: () => swiftRemotePlugin
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(vite_plugin_one_exports);
|
|
41
42
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
@@ -796,13 +797,13 @@ function imagesetName(contentsPath) {
|
|
|
796
797
|
if (!leaf.endsWith(".imageset")) return null;
|
|
797
798
|
return leaf.slice(0, -".imageset".length) || null;
|
|
798
799
|
}
|
|
799
|
-
function isFlatResourceImage(
|
|
800
|
-
return
|
|
800
|
+
function isFlatResourceImage(path8) {
|
|
801
|
+
return path8.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path8));
|
|
801
802
|
}
|
|
802
803
|
function enumerateBundleImages(paths, readText) {
|
|
803
804
|
const table = [];
|
|
804
805
|
const seen = /* @__PURE__ */ new Set();
|
|
805
|
-
const catalogs = paths.filter((
|
|
806
|
+
const catalogs = paths.filter((path8) => baseOf(path8) === "Contents.json");
|
|
806
807
|
for (const contentsPath of catalogs) {
|
|
807
808
|
const name = imagesetName(contentsPath);
|
|
808
809
|
if (name === null || seen.has(name)) continue;
|
|
@@ -822,12 +823,12 @@ function enumerateBundleImages(paths, readText) {
|
|
|
822
823
|
seen.add(name);
|
|
823
824
|
table.push({ name, file: `${dir}/${file}` });
|
|
824
825
|
}
|
|
825
|
-
for (const
|
|
826
|
-
if (!isFlatResourceImage(
|
|
827
|
-
const name = baseOf(
|
|
826
|
+
for (const path8 of paths) {
|
|
827
|
+
if (!isFlatResourceImage(path8)) continue;
|
|
828
|
+
const name = baseOf(path8).slice(0, -extOf(path8).length);
|
|
828
829
|
if (name === "" || seen.has(name)) continue;
|
|
829
830
|
seen.add(name);
|
|
830
|
-
table.push({ name, file:
|
|
831
|
+
table.push({ name, file: path8 });
|
|
831
832
|
}
|
|
832
833
|
return table;
|
|
833
834
|
}
|
|
@@ -835,7 +836,7 @@ function enumerateBundleJson(paths) {
|
|
|
835
836
|
const found = [];
|
|
836
837
|
const seen = /* @__PURE__ */ new Set();
|
|
837
838
|
const ordered = [...paths].filter(
|
|
838
|
-
(
|
|
839
|
+
(path8) => path8.split("/").includes("Resources") && path8.split("/").every((segment) => segment !== "" && segment !== "..") && extOf(path8) === ".json"
|
|
839
840
|
).sort((a, b) => {
|
|
840
841
|
const aDepth = a.split("/").length;
|
|
841
842
|
const bDepth = b.split("/").length;
|
|
@@ -1240,6 +1241,204 @@ function swiftPlugin(options = {}) {
|
|
|
1240
1241
|
};
|
|
1241
1242
|
}
|
|
1242
1243
|
|
|
1244
|
+
// src/rolldown-plugin-swift.ts
|
|
1245
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
1246
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
1247
|
+
|
|
1248
|
+
// src/swift-submit.ts
|
|
1249
|
+
var SWIFT_COMPILE_PATH = "/api/swift-compile";
|
|
1250
|
+
var POLL_INTERVAL_MS = 1500;
|
|
1251
|
+
function httpSwiftCompileSubmit(context) {
|
|
1252
|
+
const { assetReadToken, endpoint } = context;
|
|
1253
|
+
if (!assetReadToken) return void 0;
|
|
1254
|
+
const url = endpoint ? `${endpoint.replace(/\/+$/, "")}${SWIFT_COMPILE_PATH}` : SWIFT_COMPILE_PATH;
|
|
1255
|
+
return async (work) => {
|
|
1256
|
+
let response;
|
|
1257
|
+
try {
|
|
1258
|
+
response = await fetch(url, {
|
|
1259
|
+
method: "POST",
|
|
1260
|
+
headers: { "content-type": "application/json" },
|
|
1261
|
+
body: JSON.stringify({ ...work, token: assetReadToken })
|
|
1262
|
+
});
|
|
1263
|
+
} catch (error) {
|
|
1264
|
+
throw new Error(
|
|
1265
|
+
`contrast-bundler: fetch failed for ${url} while compiling ${work.entry}: ${error instanceof Error ? error.message : String(error)}`,
|
|
1266
|
+
{ cause: error }
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
if (!response.ok) {
|
|
1270
|
+
const detail = (await response.text()).trim();
|
|
1271
|
+
throw new Error(
|
|
1272
|
+
`contrast-bundler: the swift compile for ${work.entry} answered ${response.status}${detail ? `: ${detail}` : ""}`
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
return await response.json();
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
function resolveImageUrls(urls, origin) {
|
|
1279
|
+
const resolved = {};
|
|
1280
|
+
for (const [name, url] of Object.entries(urls)) {
|
|
1281
|
+
resolved[name] = new URL(url, origin).href;
|
|
1282
|
+
}
|
|
1283
|
+
return resolved;
|
|
1284
|
+
}
|
|
1285
|
+
async function compileSwiftProject(submit, work, origin) {
|
|
1286
|
+
while (true) {
|
|
1287
|
+
const outcome = await submit(work);
|
|
1288
|
+
switch (outcome.status) {
|
|
1289
|
+
case "published":
|
|
1290
|
+
return {
|
|
1291
|
+
url: new URL(outcome.artifactUrl, origin).href,
|
|
1292
|
+
hash: outcome.hash,
|
|
1293
|
+
...outcome.imageUrls === void 0 ? {} : { imageUrls: resolveImageUrls(outcome.imageUrls, origin) }
|
|
1294
|
+
};
|
|
1295
|
+
case "compiling":
|
|
1296
|
+
await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
|
|
1297
|
+
continue;
|
|
1298
|
+
case "refused":
|
|
1299
|
+
case "failed":
|
|
1300
|
+
throw new Error(
|
|
1301
|
+
`contrast-bundler: the swift sources for ${work.entry} cannot be compiled: ${outcome.detail}`
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
// src/rolldown-plugin-swift.ts
|
|
1308
|
+
var VIRTUAL_PREFIX2 = "\0rnx-swift-remote:";
|
|
1309
|
+
var projects2 = /* @__PURE__ */ new Map();
|
|
1310
|
+
function projectFor2(packagePath) {
|
|
1311
|
+
const existing = projects2.get(packagePath);
|
|
1312
|
+
if (existing) return existing;
|
|
1313
|
+
const created = { packagePath, address: null };
|
|
1314
|
+
projects2.set(packagePath, created);
|
|
1315
|
+
return created;
|
|
1316
|
+
}
|
|
1317
|
+
function packageFiles(root) {
|
|
1318
|
+
const found = [];
|
|
1319
|
+
const walk = (dir) => {
|
|
1320
|
+
for (const entry of import_node_fs4.default.readdirSync(dir, { withFileTypes: true })) {
|
|
1321
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === ".build")
|
|
1322
|
+
continue;
|
|
1323
|
+
const full = import_node_path5.default.join(dir, entry.name);
|
|
1324
|
+
if (entry.isDirectory()) {
|
|
1325
|
+
if (full !== root && import_node_fs4.default.existsSync(import_node_path5.default.join(full, "Package.swift"))) continue;
|
|
1326
|
+
walk(full);
|
|
1327
|
+
} else {
|
|
1328
|
+
found.push(import_node_path5.default.relative(root, full).split(import_node_path5.default.sep).join(import_node_path5.default.posix.sep));
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
walk(root);
|
|
1333
|
+
return found;
|
|
1334
|
+
}
|
|
1335
|
+
function sourceFiles2(packagePath) {
|
|
1336
|
+
const files = {};
|
|
1337
|
+
for (const relative2 of packageFiles(packagePath)) {
|
|
1338
|
+
if (!relative2.endsWith(".swift")) continue;
|
|
1339
|
+
files[relative2] = import_node_fs4.default.readFileSync(
|
|
1340
|
+
import_node_path5.default.join(packagePath, ...relative2.split("/")),
|
|
1341
|
+
"utf8"
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
return files;
|
|
1345
|
+
}
|
|
1346
|
+
function bundlePack(packagePath) {
|
|
1347
|
+
const relative2 = packageFiles(packagePath);
|
|
1348
|
+
const disk = (file) => import_node_path5.default.join(packagePath, ...file.split("/"));
|
|
1349
|
+
const resources = {};
|
|
1350
|
+
const watched = [];
|
|
1351
|
+
for (const { base, file } of enumerateBundleJson(relative2)) {
|
|
1352
|
+
resources[base] = import_node_fs4.default.readFileSync(disk(file)).toString("base64");
|
|
1353
|
+
watched.push(file);
|
|
1354
|
+
}
|
|
1355
|
+
const images = {};
|
|
1356
|
+
const byRelative = new Map(relative2.map((file) => [file, disk(file)]));
|
|
1357
|
+
for (const { name, file } of enumerateBundleImages(relative2, (candidate) => {
|
|
1358
|
+
const absolute = byRelative.get(candidate);
|
|
1359
|
+
if (!absolute || import_node_path5.default.basename(absolute) !== "Contents.json") return null;
|
|
1360
|
+
try {
|
|
1361
|
+
return import_node_fs4.default.readFileSync(absolute, "utf8");
|
|
1362
|
+
} catch {
|
|
1363
|
+
return null;
|
|
1364
|
+
}
|
|
1365
|
+
})) {
|
|
1366
|
+
const absolute = byRelative.get(file);
|
|
1367
|
+
if (!absolute) continue;
|
|
1368
|
+
images[name] = {
|
|
1369
|
+
file: import_node_path5.default.posix.basename(file),
|
|
1370
|
+
data: import_node_fs4.default.readFileSync(absolute).toString("base64")
|
|
1371
|
+
};
|
|
1372
|
+
watched.push(file);
|
|
1373
|
+
}
|
|
1374
|
+
return { resources, images, watched };
|
|
1375
|
+
}
|
|
1376
|
+
function packageFor2(file, stop) {
|
|
1377
|
+
let dir = import_node_path5.default.dirname(file);
|
|
1378
|
+
for (; ; ) {
|
|
1379
|
+
if (import_node_fs4.default.existsSync(import_node_path5.default.join(dir, "Package.swift"))) return dir;
|
|
1380
|
+
if (stop !== void 0 && dir === stop || import_node_path5.default.dirname(dir) === dir) break;
|
|
1381
|
+
dir = import_node_path5.default.dirname(dir);
|
|
1382
|
+
}
|
|
1383
|
+
throw new Error(
|
|
1384
|
+
`no Package.swift above ${file}; a .swift import needs a swiftpm package like the one in packages/sootsim-swift/example`
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1387
|
+
function swiftRemotePlugin(options) {
|
|
1388
|
+
const submit = httpSwiftCompileSubmit({
|
|
1389
|
+
assetReadToken: options.assetReadToken,
|
|
1390
|
+
endpoint: options.endpoint
|
|
1391
|
+
});
|
|
1392
|
+
if (!submit) {
|
|
1393
|
+
throw new Error(
|
|
1394
|
+
"swiftRemotePlugin needs an assetReadToken: a build without a compile credential cannot compile .swift sources"
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
return {
|
|
1398
|
+
name: "rnx-swift-remote",
|
|
1399
|
+
enforce: "pre",
|
|
1400
|
+
async resolveId(source, importer) {
|
|
1401
|
+
if (source.startsWith(VIRTUAL_PREFIX2)) return source;
|
|
1402
|
+
if (!source.endsWith(".swift")) return null;
|
|
1403
|
+
const resolved = await this.resolve(source, importer, { skipSelf: true });
|
|
1404
|
+
if (!resolved) throw new Error(`cannot resolve swift source ${source}`);
|
|
1405
|
+
return VIRTUAL_PREFIX2 + resolved.id;
|
|
1406
|
+
},
|
|
1407
|
+
async load(id) {
|
|
1408
|
+
if (!id.startsWith(VIRTUAL_PREFIX2)) return null;
|
|
1409
|
+
const file = id.slice(VIRTUAL_PREFIX2.length);
|
|
1410
|
+
if (!import_node_fs4.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
|
|
1411
|
+
const packagePath = options.packagePath ?? packageFor2(file);
|
|
1412
|
+
const project = projectFor2(packagePath);
|
|
1413
|
+
const files = sourceFiles2(packagePath);
|
|
1414
|
+
const entry = import_node_path5.default.relative(packagePath, file).split(import_node_path5.default.sep).join(import_node_path5.default.posix.sep);
|
|
1415
|
+
for (const source of Object.keys(files)) {
|
|
1416
|
+
this.addWatchFile(import_node_path5.default.join(packagePath, ...source.split("/")));
|
|
1417
|
+
}
|
|
1418
|
+
const pack = bundlePack(packagePath);
|
|
1419
|
+
for (const watched of pack.watched) {
|
|
1420
|
+
this.addWatchFile(import_node_path5.default.join(packagePath, ...watched.split("/")));
|
|
1421
|
+
}
|
|
1422
|
+
try {
|
|
1423
|
+
project.address = await compileSwiftProject(
|
|
1424
|
+
submit,
|
|
1425
|
+
{ files, resources: pack.resources, images: pack.images, entry },
|
|
1426
|
+
options.endpoint
|
|
1427
|
+
);
|
|
1428
|
+
} catch (error) {
|
|
1429
|
+
if (!project.address) throw error;
|
|
1430
|
+
this.warn(error instanceof Error ? error.message : String(error));
|
|
1431
|
+
}
|
|
1432
|
+
const address = project.address;
|
|
1433
|
+
return [
|
|
1434
|
+
`import { createSwiftEntry } from 'rnxsim/swift'`,
|
|
1435
|
+
`export default createSwiftEntry({ url: ${JSON.stringify(address.url)}, hash: ${JSON.stringify(address.hash)}, rootId: ${JSON.stringify(entryRootId(packagePath, file))}, resources: ${JSON.stringify(address.imageUrls ?? {})}, bundleFiles: ${JSON.stringify(pack.resources)} })`,
|
|
1436
|
+
""
|
|
1437
|
+
].join("\n");
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1243
1442
|
// src/vite-plugin-one.ts
|
|
1244
1443
|
function rnxPlugin(options = {}) {
|
|
1245
1444
|
const prefix = options.prefix || "/__soot";
|
|
@@ -1387,5 +1586,6 @@ var vite_plugin_one_default = rnxPlugin;
|
|
|
1387
1586
|
0 && (module.exports = {
|
|
1388
1587
|
rnxPlugin,
|
|
1389
1588
|
sootsimPlugin,
|
|
1390
|
-
swiftPlugin
|
|
1589
|
+
swiftPlugin,
|
|
1590
|
+
swiftRemotePlugin
|
|
1391
1591
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rnxsim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.526",
|
|
4
4
|
"description": "Vite and Metro plugins, testing drivers, and SDK exports for rnx.",
|
|
5
5
|
"author": "Tamagui LLC",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -39,6 +39,13 @@
|
|
|
39
39
|
"source": "./src/swift.ts",
|
|
40
40
|
"default": "./dist-lib/swift.cjs"
|
|
41
41
|
},
|
|
42
|
+
"./swift-submit": {
|
|
43
|
+
"types": "./src/swift-submit.ts",
|
|
44
|
+
"source": "./src/swift-submit.ts",
|
|
45
|
+
"bun": "./src/swift-submit.ts",
|
|
46
|
+
"import": "./dist-lib/swift-submit.mjs",
|
|
47
|
+
"default": "./dist-lib/swift-submit.cjs"
|
|
48
|
+
},
|
|
42
49
|
"./metro": {
|
|
43
50
|
"source": "./src/metro-plugin.ts",
|
|
44
51
|
"default": "./dist-lib/metro.cjs"
|