rnxsim 0.1.523 → 0.1.524
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 +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 +1 -1
- package/dist-lib/swift.cjs +27 -6
- package/dist-lib/vite.cjs +186 -6
- package/package.json +1 -1
- package/src/vite-plugin-swift.ts +165 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/beta.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/beta.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/cloud.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/cloud.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
package/dist-lib/config.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/detox/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/home-paths.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/host/fetch-proxy-overrides.ts
|
|
4
4
|
var FETCH_PROXY_BROWSER_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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/menu.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/menu.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/metro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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/profiles.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/render-mode.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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/sdk.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/sdk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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,17 @@ 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/mount.tsx
|
|
47
58
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
59
|
function isRecord(value) {
|
|
49
60
|
return typeof value === "object" && value !== null;
|
|
@@ -392,10 +403,12 @@ var SwiftResourcesContext = (0, import_react.createContext)(void 0);
|
|
|
392
403
|
function SwiftImage(props) {
|
|
393
404
|
const table = (0, import_react.useContext)(SwiftResourcesContext);
|
|
394
405
|
const { source, ...rest } = props ?? {};
|
|
395
|
-
const
|
|
406
|
+
const resolved = resolveImageSource(source, table ?? {}, (name) => {
|
|
407
|
+
console.error(`swift: no bundle asset named '${name}' in this mount's resources`);
|
|
408
|
+
});
|
|
396
409
|
return (0, import_react.createElement)(import_ui.Image, {
|
|
397
410
|
...rest,
|
|
398
|
-
...source === void 0 ? {} : { source:
|
|
411
|
+
...source === void 0 ? {} : { source: resolved }
|
|
399
412
|
});
|
|
400
413
|
}
|
|
401
414
|
var NODE_COMPONENTS = {
|
|
@@ -637,8 +650,8 @@ function nodeProps(node, deliver) {
|
|
|
637
650
|
return {
|
|
638
651
|
...typeof props.systemName === "string" ? { systemName: props.systemName } : {},
|
|
639
652
|
// a bundle asset name rides as the kit image source; the kit paints
|
|
640
|
-
//
|
|
641
|
-
//
|
|
653
|
+
// resolved { uri } sources and keeps its placeholder for names the
|
|
654
|
+
// table could not resolve.
|
|
642
655
|
...typeof props.name === "string" ? { source: props.name } : {},
|
|
643
656
|
...props.resizable === true ? { resizable: true } : {},
|
|
644
657
|
...typeof props.renderingMode === "string" ? { renderingMode: props.renderingMode } : {},
|
|
@@ -1192,10 +1205,18 @@ function SwiftTree({
|
|
|
1192
1205
|
// a navigation stack at the root lays its own bar out under the status
|
|
1193
1206
|
// bar and insets each screen itself, so the host must not also pad it
|
|
1194
1207
|
// down: that pad would move the whole stack a status bar lower
|
|
1208
|
+
// a swiftui scene is opaque: the window behind every screen is
|
|
1209
|
+
// systemBackground, and lists paint their grouped fill over it (the kit's
|
|
1210
|
+
// grouped container already does). without this a listless screen shows
|
|
1211
|
+
// whatever sits beneath the mount. RAN on the safeArea probe (iphone 17
|
|
1212
|
+
// pro): (600,1300) reads #ffffff ios against #f2f2f7 rnx, 99.92% of the
|
|
1213
|
+
// frame; dark matches on both legs (the oracle's falsifier: the two
|
|
1214
|
+
// fills coincide there). PlatformColor is this lane's spelling for a
|
|
1215
|
+
// semantic color.
|
|
1195
1216
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1196
1217
|
import_ui.Host,
|
|
1197
1218
|
{
|
|
1198
|
-
style: { flex: 1 },
|
|
1219
|
+
style: { flex: 1, backgroundColor: (0, import_react_native.PlatformColor)("systemBackground") },
|
|
1199
1220
|
ignoreSafeArea: tree.some(
|
|
1200
1221
|
(node) => node.t === "NavigationStack" || node.t === "NavigationSplitView"
|
|
1201
1222
|
),
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.524 | (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;
|
|
@@ -763,6 +763,75 @@ var import_node_os2 = __toESM(require("node:os"), 1);
|
|
|
763
763
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
764
764
|
var import_node_util = require("node:util");
|
|
765
765
|
|
|
766
|
+
// ../sootsim-swift/src/bundleAssets.ts
|
|
767
|
+
var RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
768
|
+
".avif",
|
|
769
|
+
".bmp",
|
|
770
|
+
".gif",
|
|
771
|
+
".ico",
|
|
772
|
+
".jpeg",
|
|
773
|
+
".jpg",
|
|
774
|
+
".png",
|
|
775
|
+
".webp"
|
|
776
|
+
]);
|
|
777
|
+
function extOf(file) {
|
|
778
|
+
const dot = file.lastIndexOf(".");
|
|
779
|
+
return dot < 0 ? "" : file.slice(dot).toLowerCase();
|
|
780
|
+
}
|
|
781
|
+
function baseOf(file) {
|
|
782
|
+
const slash = file.lastIndexOf("/");
|
|
783
|
+
return slash < 0 ? file : file.slice(slash + 1);
|
|
784
|
+
}
|
|
785
|
+
function pickImagesetFile(images) {
|
|
786
|
+
const rasters = images.filter(
|
|
787
|
+
(image) => typeof image.filename === "string" && RASTER_EXTENSIONS.has(extOf(image.filename))
|
|
788
|
+
);
|
|
789
|
+
if (rasters.length === 0) return null;
|
|
790
|
+
const rank = (scale) => scale === "2x" ? 0 : scale === "3x" ? 1 : scale === "1x" ? 2 : 3;
|
|
791
|
+
return [...rasters].sort((a, b) => rank(a.scale) - rank(b.scale))[0].filename;
|
|
792
|
+
}
|
|
793
|
+
function imagesetName(contentsPath) {
|
|
794
|
+
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
795
|
+
const leaf = baseOf(dir);
|
|
796
|
+
if (!leaf.endsWith(".imageset")) return null;
|
|
797
|
+
return leaf.slice(0, -".imageset".length) || null;
|
|
798
|
+
}
|
|
799
|
+
function isFlatResourceImage(path7) {
|
|
800
|
+
return path7.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path7));
|
|
801
|
+
}
|
|
802
|
+
function enumerateBundleImages(paths, readText) {
|
|
803
|
+
const table = [];
|
|
804
|
+
const seen = /* @__PURE__ */ new Set();
|
|
805
|
+
const catalogs = paths.filter((path7) => baseOf(path7) === "Contents.json");
|
|
806
|
+
for (const contentsPath of catalogs) {
|
|
807
|
+
const name = imagesetName(contentsPath);
|
|
808
|
+
if (name === null || seen.has(name)) continue;
|
|
809
|
+
let parsed;
|
|
810
|
+
try {
|
|
811
|
+
const text = readText(contentsPath);
|
|
812
|
+
if (text === null) continue;
|
|
813
|
+
parsed = JSON.parse(text);
|
|
814
|
+
} catch {
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
const images = parsed?.images;
|
|
818
|
+
if (!Array.isArray(images)) continue;
|
|
819
|
+
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
820
|
+
const file = pickImagesetFile(images);
|
|
821
|
+
if (file === null || file.includes("/") || file.includes("\\")) continue;
|
|
822
|
+
seen.add(name);
|
|
823
|
+
table.push({ name, file: `${dir}/${file}` });
|
|
824
|
+
}
|
|
825
|
+
for (const path7 of paths) {
|
|
826
|
+
if (!isFlatResourceImage(path7)) continue;
|
|
827
|
+
const name = baseOf(path7).slice(0, -extOf(path7).length);
|
|
828
|
+
if (name === "" || seen.has(name)) continue;
|
|
829
|
+
seen.add(name);
|
|
830
|
+
table.push({ name, file: path7 });
|
|
831
|
+
}
|
|
832
|
+
return table;
|
|
833
|
+
}
|
|
834
|
+
|
|
766
835
|
// ../sootsim-swift/toolchain.json
|
|
767
836
|
var toolchain_default = {
|
|
768
837
|
release: "swift-6.3-RELEASE",
|
|
@@ -778,13 +847,19 @@ var TOOLCHAIN_BIN = import_node_path4.default.join(
|
|
|
778
847
|
var WASM_SDK = `${toolchain_default.release}_wasm`;
|
|
779
848
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
780
849
|
var ARTIFACT_PATH = "/__rnx/swift/";
|
|
850
|
+
var RESOURCE_PATH = "/__rnx/swift-res/";
|
|
781
851
|
var VIRTUAL_PREFIX = "\0rnx-swift:";
|
|
782
852
|
var projects = /* @__PURE__ */ new Map();
|
|
783
853
|
var devServer;
|
|
784
854
|
function projectFor(packagePath) {
|
|
785
855
|
const existing = projects.get(packagePath);
|
|
786
856
|
if (existing) return existing;
|
|
787
|
-
const created = {
|
|
857
|
+
const created = {
|
|
858
|
+
packagePath,
|
|
859
|
+
artifact: null,
|
|
860
|
+
building: null,
|
|
861
|
+
resourceFiles: /* @__PURE__ */ new Map()
|
|
862
|
+
};
|
|
788
863
|
projects.set(packagePath, created);
|
|
789
864
|
return created;
|
|
790
865
|
}
|
|
@@ -803,6 +878,84 @@ function sourceFiles(root) {
|
|
|
803
878
|
walk(root);
|
|
804
879
|
return found;
|
|
805
880
|
}
|
|
881
|
+
function resourceCandidateFiles(root) {
|
|
882
|
+
const found = [];
|
|
883
|
+
const walk = (dir) => {
|
|
884
|
+
for (const entry of import_node_fs3.default.readdirSync(dir, { withFileTypes: true })) {
|
|
885
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === ".build")
|
|
886
|
+
continue;
|
|
887
|
+
const full = import_node_path4.default.join(dir, entry.name);
|
|
888
|
+
if (entry.isDirectory()) {
|
|
889
|
+
if (full !== root && import_node_fs3.default.existsSync(import_node_path4.default.join(full, "Package.swift"))) continue;
|
|
890
|
+
walk(full);
|
|
891
|
+
} else {
|
|
892
|
+
found.push(full);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
walk(root);
|
|
897
|
+
return found;
|
|
898
|
+
}
|
|
899
|
+
var RESOURCE_CONTENT_TYPES = {
|
|
900
|
+
".avif": "image/avif",
|
|
901
|
+
".bmp": "image/bmp",
|
|
902
|
+
".gif": "image/gif",
|
|
903
|
+
".ico": "image/x-icon",
|
|
904
|
+
".jpeg": "image/jpeg",
|
|
905
|
+
".jpg": "image/jpeg",
|
|
906
|
+
".png": "image/png",
|
|
907
|
+
".webp": "image/webp"
|
|
908
|
+
};
|
|
909
|
+
function buildSwiftResourceTable(project, baseUrl) {
|
|
910
|
+
const absolute = resourceCandidateFiles(project.packagePath);
|
|
911
|
+
const relative2 = absolute.map(
|
|
912
|
+
(file) => import_node_path4.default.relative(project.packagePath, file).split(import_node_path4.default.sep).join(import_node_path4.default.posix.sep)
|
|
913
|
+
);
|
|
914
|
+
const byRelative = new Map(absolute.map((file, index) => [relative2[index], file]));
|
|
915
|
+
const found = enumerateBundleImages(relative2, (candidate) => {
|
|
916
|
+
const file = byRelative.get(candidate);
|
|
917
|
+
if (!file || import_node_path4.default.basename(file) !== "Contents.json") return null;
|
|
918
|
+
try {
|
|
919
|
+
return import_node_fs3.default.readFileSync(file, "utf8");
|
|
920
|
+
} catch {
|
|
921
|
+
return null;
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
const table = {};
|
|
925
|
+
const watched = [];
|
|
926
|
+
const registered = /* @__PURE__ */ new Map();
|
|
927
|
+
for (const { name, file } of found) {
|
|
928
|
+
const disk = byRelative.get(file);
|
|
929
|
+
if (!disk) continue;
|
|
930
|
+
let bytes;
|
|
931
|
+
try {
|
|
932
|
+
bytes = import_node_fs3.default.readFileSync(disk);
|
|
933
|
+
} catch {
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
const hash = (0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
937
|
+
const ext = import_node_path4.default.posix.extname(file).toLowerCase();
|
|
938
|
+
table[name] = `${baseUrl}${RESOURCE_PATH}${hash}${ext}`;
|
|
939
|
+
watched.push(file);
|
|
940
|
+
const contents = file.replace(/\/[^/]+$/, "/Contents.json");
|
|
941
|
+
if (byRelative.has(contents)) watched.push(contents);
|
|
942
|
+
registered.set(`${hash}${ext}`, disk);
|
|
943
|
+
}
|
|
944
|
+
project.resourceFiles = registered;
|
|
945
|
+
return { table, watched };
|
|
946
|
+
}
|
|
947
|
+
function serveSwiftResource(project, key) {
|
|
948
|
+
const disk = project.resourceFiles.get(key);
|
|
949
|
+
if (!disk) return null;
|
|
950
|
+
try {
|
|
951
|
+
return {
|
|
952
|
+
bytes: import_node_fs3.default.readFileSync(disk),
|
|
953
|
+
contentType: RESOURCE_CONTENT_TYPES[import_node_path4.default.extname(disk).toLowerCase()] ?? "application/octet-stream"
|
|
954
|
+
};
|
|
955
|
+
} catch {
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
806
959
|
function linkedModuleRoots(packagePath) {
|
|
807
960
|
let manifest;
|
|
808
961
|
try {
|
|
@@ -833,11 +986,14 @@ function entryRootId(packagePath, file) {
|
|
|
833
986
|
const relative2 = import_node_path4.default.relative(packagePath, file).split(import_node_path4.default.sep).join(import_node_path4.default.posix.sep);
|
|
834
987
|
return `${import_node_path4.default.basename(packagePath)}${import_node_path4.default.posix.sep}${relative2}`;
|
|
835
988
|
}
|
|
836
|
-
function
|
|
989
|
+
function serverOrigin() {
|
|
837
990
|
const address = devServer?.httpServer?.address();
|
|
838
991
|
const port = address && typeof address === "object" ? address.port : devServer?.config.server.port;
|
|
839
|
-
if (!port) throw new Error("the swift
|
|
840
|
-
return `http://localhost:${port}
|
|
992
|
+
if (!port) throw new Error("the swift urls need the dev server port");
|
|
993
|
+
return `http://localhost:${port}`;
|
|
994
|
+
}
|
|
995
|
+
function artifactUrl(project, artifact) {
|
|
996
|
+
return `${serverOrigin()}${ARTIFACT_PATH}${artifact.hash}.wasm`;
|
|
841
997
|
}
|
|
842
998
|
function builtArtifact(packagePath) {
|
|
843
999
|
const binDir = import_node_path4.default.join(packagePath, ".build", WASM_TRIPLE, "release");
|
|
@@ -961,9 +1117,19 @@ function swiftPlugin(options = {}) {
|
|
|
961
1117
|
this.warn(error instanceof Error ? error.message : String(error));
|
|
962
1118
|
artifact = project.artifact;
|
|
963
1119
|
}
|
|
1120
|
+
let resources = {};
|
|
1121
|
+
try {
|
|
1122
|
+
const built = buildSwiftResourceTable(project, serverOrigin());
|
|
1123
|
+
resources = built.table;
|
|
1124
|
+
for (const watched of built.watched) this.addWatchFile(watched);
|
|
1125
|
+
} catch (error) {
|
|
1126
|
+
this.warn(
|
|
1127
|
+
`swift resources for ${packagePath}: ${error instanceof Error ? error.message : String(error)}`
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
964
1130
|
return [
|
|
965
1131
|
`import { createSwiftEntry } from 'rnxsim/swift'`,
|
|
966
|
-
`export default createSwiftEntry({ url: ${JSON.stringify(artifactUrl(project, artifact))}, hash: ${JSON.stringify(artifact.hash)}, rootId: ${JSON.stringify(entryRootId(packagePath, file))} })`,
|
|
1132
|
+
`export default createSwiftEntry({ url: ${JSON.stringify(artifactUrl(project, artifact))}, hash: ${JSON.stringify(artifact.hash)}, rootId: ${JSON.stringify(entryRootId(packagePath, file))}, resources: ${JSON.stringify(resources)} })`,
|
|
967
1133
|
""
|
|
968
1134
|
].join("\n");
|
|
969
1135
|
},
|
|
@@ -971,6 +1137,20 @@ function swiftPlugin(options = {}) {
|
|
|
971
1137
|
devServer = server;
|
|
972
1138
|
server.middlewares.use((req, res, next) => {
|
|
973
1139
|
const url = (req.url ?? "").split("?")[0];
|
|
1140
|
+
if (url.startsWith(RESOURCE_PATH)) {
|
|
1141
|
+
for (const project of projects.values()) {
|
|
1142
|
+
const served = serveSwiftResource(project, url.slice(RESOURCE_PATH.length));
|
|
1143
|
+
if (served) {
|
|
1144
|
+
res.setHeader("access-control-allow-origin", "*");
|
|
1145
|
+
res.setHeader("content-type", served.contentType);
|
|
1146
|
+
res.end(served.bytes);
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
res.statusCode = 404;
|
|
1151
|
+
res.end("swift resource is stale");
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
974
1154
|
if (!url.startsWith(ARTIFACT_PATH)) {
|
|
975
1155
|
next();
|
|
976
1156
|
return;
|
package/package.json
CHANGED
package/src/vite-plugin-swift.ts
CHANGED
|
@@ -16,6 +16,7 @@ import fs from 'node:fs'
|
|
|
16
16
|
import os from 'node:os'
|
|
17
17
|
import path from 'node:path'
|
|
18
18
|
import { promisify } from 'node:util'
|
|
19
|
+
import { enumerateBundleImages } from '../../sootsim-swift/src/bundleAssets'
|
|
19
20
|
import toolchain from '../../sootsim-swift/toolchain.json'
|
|
20
21
|
import type { Plugin, ViteDevServer } from 'vite'
|
|
21
22
|
|
|
@@ -33,6 +34,7 @@ const WASM_SDK = `${toolchain.release}_wasm`
|
|
|
33
34
|
const WASM_TRIPLE = 'wasm32-unknown-wasip1'
|
|
34
35
|
|
|
35
36
|
const ARTIFACT_PATH = '/__rnx/swift/'
|
|
37
|
+
const RESOURCE_PATH = '/__rnx/swift-res/'
|
|
36
38
|
const VIRTUAL_PREFIX = '\0rnx-swift:'
|
|
37
39
|
|
|
38
40
|
interface SwiftArtifact {
|
|
@@ -49,6 +51,9 @@ interface SwiftProject {
|
|
|
49
51
|
artifact: SwiftArtifact | null
|
|
50
52
|
// the build in flight and the sources it was started from
|
|
51
53
|
building: { stamp: string; promise: Promise<SwiftArtifact> } | null
|
|
54
|
+
// content hash to absolute path for this load's bundle images: the served
|
|
55
|
+
// urls name a hash, never a path, so there is nothing to traverse.
|
|
56
|
+
resourceFiles: Map<string, string>
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
// a project is its swiftpm package: the build, the artifact, and the dev
|
|
@@ -59,7 +64,12 @@ let devServer: ViteDevServer | undefined
|
|
|
59
64
|
function projectFor(packagePath: string): SwiftProject {
|
|
60
65
|
const existing = projects.get(packagePath)
|
|
61
66
|
if (existing) return existing
|
|
62
|
-
const created: SwiftProject = {
|
|
67
|
+
const created: SwiftProject = {
|
|
68
|
+
packagePath,
|
|
69
|
+
artifact: null,
|
|
70
|
+
building: null,
|
|
71
|
+
resourceFiles: new Map(),
|
|
72
|
+
}
|
|
63
73
|
projects.set(packagePath, created)
|
|
64
74
|
return created
|
|
65
75
|
}
|
|
@@ -86,6 +96,119 @@ function sourceFiles(root: string): string[] {
|
|
|
86
96
|
return found
|
|
87
97
|
}
|
|
88
98
|
|
|
99
|
+
// every file that can carry bundle content: catalogs and flat Resources
|
|
100
|
+
// rasters anywhere under the package. `.build` is skipped where sourceFiles
|
|
101
|
+
// does not need to: a release tree holds tens of thousands of files and no
|
|
102
|
+
// bundle content, and walking it per import would tax every hot reload.
|
|
103
|
+
function resourceCandidateFiles(root: string): string[] {
|
|
104
|
+
const found: string[] = []
|
|
105
|
+
const walk = (dir: string): void => {
|
|
106
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
107
|
+
if (
|
|
108
|
+
entry.name.startsWith('.') ||
|
|
109
|
+
entry.name === 'node_modules' ||
|
|
110
|
+
entry.name === '.build'
|
|
111
|
+
)
|
|
112
|
+
continue
|
|
113
|
+
const full = path.join(dir, entry.name)
|
|
114
|
+
if (entry.isDirectory()) {
|
|
115
|
+
if (full !== root && fs.existsSync(path.join(full, 'Package.swift'))) continue
|
|
116
|
+
walk(full)
|
|
117
|
+
} else {
|
|
118
|
+
found.push(full)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
walk(root)
|
|
123
|
+
return found
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const RESOURCE_CONTENT_TYPES: Record<string, string> = {
|
|
127
|
+
'.avif': 'image/avif',
|
|
128
|
+
'.bmp': 'image/bmp',
|
|
129
|
+
'.gif': 'image/gif',
|
|
130
|
+
'.ico': 'image/x-icon',
|
|
131
|
+
'.jpeg': 'image/jpeg',
|
|
132
|
+
'.jpg': 'image/jpeg',
|
|
133
|
+
'.png': 'image/png',
|
|
134
|
+
'.webp': 'image/webp',
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface SwiftResourceTable {
|
|
138
|
+
/** bundle asset name to absolute serving url. */
|
|
139
|
+
table: Record<string, string>
|
|
140
|
+
/** project-relative image files this load's table covers (for watching). */
|
|
141
|
+
watched: string[]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// the producer for the local vehicle: enumerate the package's bundle images
|
|
145
|
+
// through the shared rule both hosts use, hash each raster's bytes into its
|
|
146
|
+
// url (an edited photo moves its url, so no stale paint survives a reload),
|
|
147
|
+
// and register hash to path for the serving middleware below.
|
|
148
|
+
export function buildSwiftResourceTable(
|
|
149
|
+
project: SwiftProject,
|
|
150
|
+
baseUrl: string,
|
|
151
|
+
): SwiftResourceTable {
|
|
152
|
+
const absolute = resourceCandidateFiles(project.packagePath)
|
|
153
|
+
const relative = absolute.map((file) =>
|
|
154
|
+
path.relative(project.packagePath, file).split(path.sep).join(path.posix.sep),
|
|
155
|
+
)
|
|
156
|
+
const byRelative = new Map(absolute.map((file, index) => [relative[index], file]))
|
|
157
|
+
const found = enumerateBundleImages(relative, (candidate) => {
|
|
158
|
+
const file = byRelative.get(candidate)
|
|
159
|
+
if (!file || path.basename(file) !== 'Contents.json') return null
|
|
160
|
+
try {
|
|
161
|
+
return fs.readFileSync(file, 'utf8')
|
|
162
|
+
} catch {
|
|
163
|
+
return null
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
const table: Record<string, string> = {}
|
|
167
|
+
const watched: string[] = []
|
|
168
|
+
const registered = new Map<string, string>()
|
|
169
|
+
for (const { name, file } of found) {
|
|
170
|
+
const disk = byRelative.get(file)
|
|
171
|
+
if (!disk) continue
|
|
172
|
+
let bytes: Buffer
|
|
173
|
+
try {
|
|
174
|
+
bytes = fs.readFileSync(disk)
|
|
175
|
+
} catch {
|
|
176
|
+
continue
|
|
177
|
+
}
|
|
178
|
+
const hash = createHash('sha256').update(bytes).digest('hex').slice(0, 16)
|
|
179
|
+
const ext = path.posix.extname(file).toLowerCase()
|
|
180
|
+
table[name] = `${baseUrl}${RESOURCE_PATH}${hash}${ext}`
|
|
181
|
+
watched.push(file)
|
|
182
|
+
// a Contents.json edit (scale swap, file rename) re-resolves the same
|
|
183
|
+
// way a raster edit does, so the catalog rides the watcher too.
|
|
184
|
+
const contents = file.replace(/\/[^/]+$/, '/Contents.json')
|
|
185
|
+
if (byRelative.has(contents)) watched.push(contents)
|
|
186
|
+
registered.set(`${hash}${ext}`, disk)
|
|
187
|
+
}
|
|
188
|
+
project.resourceFiles = registered
|
|
189
|
+
return { table, watched }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// the middleware's lookup, exported for the producer's own proof: a hit is
|
|
193
|
+
// known bytes for a known hash, anything else is null, never a file.
|
|
194
|
+
export function serveSwiftResource(
|
|
195
|
+
project: SwiftProject,
|
|
196
|
+
key: string,
|
|
197
|
+
): { bytes: Buffer; contentType: string } | null {
|
|
198
|
+
const disk = project.resourceFiles.get(key)
|
|
199
|
+
if (!disk) return null
|
|
200
|
+
try {
|
|
201
|
+
return {
|
|
202
|
+
bytes: fs.readFileSync(disk),
|
|
203
|
+
contentType:
|
|
204
|
+
RESOURCE_CONTENT_TYPES[path.extname(disk).toLowerCase()] ??
|
|
205
|
+
'application/octet-stream',
|
|
206
|
+
}
|
|
207
|
+
} catch {
|
|
208
|
+
return null
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
89
212
|
// the SwiftUI module the project links: its manifest names it as a path
|
|
90
213
|
// dependency, and `swift build` compiles it with the project, so an edit
|
|
91
214
|
// there changes the artifact without moving any of the project's own mtimes.
|
|
@@ -137,14 +260,18 @@ export function entryRootId(packagePath: string, file: string): string {
|
|
|
137
260
|
return `${path.basename(packagePath)}${path.posix.sep}${relative}`
|
|
138
261
|
}
|
|
139
262
|
|
|
140
|
-
// the app fetches
|
|
141
|
-
//
|
|
142
|
-
function
|
|
263
|
+
// the app fetches from a worker whose origin is the shell, so urls have to
|
|
264
|
+
// name this dev server rather than resolve relative to the shell.
|
|
265
|
+
function serverOrigin(): string {
|
|
143
266
|
const address = devServer?.httpServer?.address()
|
|
144
267
|
const port =
|
|
145
268
|
address && typeof address === 'object' ? address.port : devServer?.config.server.port
|
|
146
|
-
if (!port) throw new Error('the swift
|
|
147
|
-
return `http://localhost:${port}
|
|
269
|
+
if (!port) throw new Error('the swift urls need the dev server port')
|
|
270
|
+
return `http://localhost:${port}`
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function artifactUrl(project: SwiftProject, artifact: SwiftArtifact): string {
|
|
274
|
+
return `${serverOrigin()}${ARTIFACT_PATH}${artifact.hash}.wasm`
|
|
148
275
|
}
|
|
149
276
|
|
|
150
277
|
// one executable is the app. a package with several is ambiguous: the host
|
|
@@ -332,13 +459,26 @@ export function swiftPlugin(options: SwiftPluginOptions = {}): Plugin {
|
|
|
332
459
|
this.warn(error instanceof Error ? error.message : String(error))
|
|
333
460
|
artifact = project.artifact
|
|
334
461
|
}
|
|
462
|
+
// the bundle image table rides the same module: a photo edit moves
|
|
463
|
+
// its urls without rebuilding the artifact, and the watched files
|
|
464
|
+
// re-run this load so the mount sees the new table on hot reload.
|
|
465
|
+
let resources: Record<string, string> = {}
|
|
466
|
+
try {
|
|
467
|
+
const built = buildSwiftResourceTable(project, serverOrigin())
|
|
468
|
+
resources = built.table
|
|
469
|
+
for (const watched of built.watched) this.addWatchFile(watched)
|
|
470
|
+
} catch (error) {
|
|
471
|
+
this.warn(
|
|
472
|
+
`swift resources for ${packagePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
473
|
+
)
|
|
474
|
+
}
|
|
335
475
|
// every import mounts through the one entry: the artifact answers
|
|
336
476
|
// whether it is a view or an app root at runtime, so the transform
|
|
337
477
|
// never re-derives the conformance from source. the entry is rooted by
|
|
338
478
|
// its package and source path so a hot reload finds the same instance.
|
|
339
479
|
return [
|
|
340
480
|
`import { createSwiftEntry } from 'rnxsim/swift'`,
|
|
341
|
-
`export default createSwiftEntry({ url: ${JSON.stringify(artifactUrl(project, artifact))}, hash: ${JSON.stringify(artifact.hash)}, rootId: ${JSON.stringify(entryRootId(packagePath, file))} })`,
|
|
481
|
+
`export default createSwiftEntry({ url: ${JSON.stringify(artifactUrl(project, artifact))}, hash: ${JSON.stringify(artifact.hash)}, rootId: ${JSON.stringify(entryRootId(packagePath, file))}, resources: ${JSON.stringify(resources)} })`,
|
|
342
482
|
'',
|
|
343
483
|
].join('\n')
|
|
344
484
|
},
|
|
@@ -348,6 +488,24 @@ export function swiftPlugin(options: SwiftPluginOptions = {}): Plugin {
|
|
|
348
488
|
|
|
349
489
|
server.middlewares.use((req, res, next) => {
|
|
350
490
|
const url = (req.url ?? '').split('?')[0]
|
|
491
|
+
if (url.startsWith(RESOURCE_PATH)) {
|
|
492
|
+
// hash-addressed: the table this load emitted names these hashes,
|
|
493
|
+
// so a hit serves known bytes and anything else is a 404, never a
|
|
494
|
+
// neighboring file. the tenant worker is cross-origin like the
|
|
495
|
+
// artifact fetch, hence the same cors header.
|
|
496
|
+
for (const project of projects.values()) {
|
|
497
|
+
const served = serveSwiftResource(project, url.slice(RESOURCE_PATH.length))
|
|
498
|
+
if (served) {
|
|
499
|
+
res.setHeader('access-control-allow-origin', '*')
|
|
500
|
+
res.setHeader('content-type', served.contentType)
|
|
501
|
+
res.end(served.bytes)
|
|
502
|
+
return
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
res.statusCode = 404
|
|
506
|
+
res.end('swift resource is stale')
|
|
507
|
+
return
|
|
508
|
+
}
|
|
351
509
|
if (!url.startsWith(ARTIFACT_PATH)) {
|
|
352
510
|
next()
|
|
353
511
|
return
|