peachsim 0.1.795 → 0.1.797
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/cloud-test-tunnel.ts +1 -1
- package/cli/outbound-endpoints.ts +6 -1
- 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/bundle-channel.cjs +383 -355
- 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-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +357 -336
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +680 -575
- 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 +401 -178
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/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 +85 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +976 -851
- package/dist-lib/swift-compile.cjs +18 -4
- package/dist-lib/swift-compile.mjs +18 -4
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +416 -368
- package/dist-lib/vite.cjs +240 -15
- package/package.json +1 -1
- package/scripts/dev-server-scanner.ts +16 -5
- package/src/expo-swift-host.ts +8 -4
- package/src/one-widget-discovery.ts +17 -0
- package/src/one-widget-metadata.ts +208 -0
- package/src/one-widget-package.ts +11 -165
- package/src/oneWidgetContract.ts +122 -0
- package/src/swift-compile.ts +21 -3
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-host.ts +2 -48
- package/src/swift-source-file.ts +48 -0
- package/src/vite-plugin-one.ts +18 -1
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.797 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1682,9 +1682,9 @@ var init_version = __esm({
|
|
|
1682
1682
|
// cli/app-project.ts
|
|
1683
1683
|
function firstNamedFile(dir, names) {
|
|
1684
1684
|
for (const name2 of names) {
|
|
1685
|
-
const candidate =
|
|
1685
|
+
const candidate = import_node_path8.default.join(dir, name2);
|
|
1686
1686
|
try {
|
|
1687
|
-
if (
|
|
1687
|
+
if (import_node_fs8.default.statSync(candidate).isFile()) return candidate;
|
|
1688
1688
|
} catch {
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
@@ -1697,24 +1697,24 @@ function findRNXAppConfig(dir) {
|
|
|
1697
1697
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
1698
1698
|
}
|
|
1699
1699
|
function resolveAppProject(projectRoot) {
|
|
1700
|
-
const appDir =
|
|
1700
|
+
const appDir = import_node_path8.default.resolve(projectRoot);
|
|
1701
1701
|
try {
|
|
1702
|
-
if (!
|
|
1702
|
+
if (!import_node_fs8.default.statSync(appDir).isDirectory()) return null;
|
|
1703
1703
|
} catch {
|
|
1704
1704
|
return null;
|
|
1705
1705
|
}
|
|
1706
1706
|
const configPath = findRNXAppConfig(appDir);
|
|
1707
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
1707
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs8.default.existsSync(import_node_path8.default.join(appDir, "package.json"))) {
|
|
1708
1708
|
return null;
|
|
1709
1709
|
}
|
|
1710
1710
|
return { appDir, configPath };
|
|
1711
1711
|
}
|
|
1712
|
-
var
|
|
1712
|
+
var import_node_fs8, import_node_path8, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
1713
1713
|
var init_app_project = __esm({
|
|
1714
1714
|
"cli/app-project.ts"() {
|
|
1715
1715
|
"use strict";
|
|
1716
|
-
|
|
1717
|
-
|
|
1716
|
+
import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
1717
|
+
import_node_path8 = __toESM(require("node:path"), 1);
|
|
1718
1718
|
EXPO_APP_CONFIG_NAMES = [
|
|
1719
1719
|
"app.config.js",
|
|
1720
1720
|
"app.config.ts",
|
|
@@ -2124,12 +2124,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
2124
2124
|
return Object.fromEntries(
|
|
2125
2125
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
2126
2126
|
name2,
|
|
2127
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
2127
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path12.default.resolve(configDir, resolution.file) } : resolution
|
|
2128
2128
|
])
|
|
2129
2129
|
);
|
|
2130
2130
|
}
|
|
2131
2131
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
2132
|
-
const configDir =
|
|
2132
|
+
const configDir = import_node_path12.default.dirname(configPath);
|
|
2133
2133
|
return {
|
|
2134
2134
|
...config,
|
|
2135
2135
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -2164,11 +2164,11 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
2164
2164
|
const project = resolveAppProject(startDir);
|
|
2165
2165
|
return { project, config: await loadRNXAppConfig(project) };
|
|
2166
2166
|
}
|
|
2167
|
-
var
|
|
2167
|
+
var import_node_path12, import_jiti;
|
|
2168
2168
|
var init_app_config = __esm({
|
|
2169
2169
|
"cli/app-config.ts"() {
|
|
2170
2170
|
"use strict";
|
|
2171
|
-
|
|
2171
|
+
import_node_path12 = __toESM(require("node:path"), 1);
|
|
2172
2172
|
import_jiti = require("jiti");
|
|
2173
2173
|
init_config();
|
|
2174
2174
|
init_config();
|
|
@@ -2198,14 +2198,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
2198
2198
|
const neededPackages = /* @__PURE__ */ new Set();
|
|
2199
2199
|
const factories = [];
|
|
2200
2200
|
const visit3 = (filePath) => {
|
|
2201
|
-
const real =
|
|
2201
|
+
const real = import_node_fs11.default.realpathSync(filePath);
|
|
2202
2202
|
const previous = files.get(real);
|
|
2203
2203
|
if (previous !== void 0) return previous;
|
|
2204
2204
|
const id = "peach-config-file:" + files.size;
|
|
2205
2205
|
files.set(real, id);
|
|
2206
2206
|
const compiled = compileReplacementModule({
|
|
2207
2207
|
filePath: real,
|
|
2208
|
-
source:
|
|
2208
|
+
source: import_node_fs11.default.readFileSync(real, "utf8"),
|
|
2209
2209
|
runtimePackages,
|
|
2210
2210
|
localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
|
|
2211
2211
|
});
|
|
@@ -2221,7 +2221,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
2221
2221
|
if (!entries || typeof entries !== "object") continue;
|
|
2222
2222
|
for (const resolution of Object.values(entries)) {
|
|
2223
2223
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
2224
|
-
resolution.file = visit3(
|
|
2224
|
+
resolution.file = visit3(import_node_path13.default.resolve(resolution.file));
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
2227
|
}
|
|
@@ -2245,12 +2245,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
2245
2245
|
const identityStart = source.lastIndexOf("\nglobalThis.__sootsimModulePaths=");
|
|
2246
2246
|
return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
2247
2247
|
}
|
|
2248
|
-
var
|
|
2248
|
+
var import_node_fs11, import_node_path13, import_sucrase, import_terser;
|
|
2249
2249
|
var init_configured_bundle_producer = __esm({
|
|
2250
2250
|
"src/configured-bundle-producer.ts"() {
|
|
2251
2251
|
"use strict";
|
|
2252
|
-
|
|
2253
|
-
|
|
2252
|
+
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
2253
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
2254
2254
|
import_sucrase = require("sucrase");
|
|
2255
2255
|
import_terser = require("terser");
|
|
2256
2256
|
init_replacementModule();
|
|
@@ -2711,17 +2711,17 @@ function visit(node, visitor) {
|
|
|
2711
2711
|
visit.BREAK = BREAK;
|
|
2712
2712
|
visit.SKIP = SKIP;
|
|
2713
2713
|
visit.REMOVE = REMOVE;
|
|
2714
|
-
function visit_(key, node, visitor,
|
|
2715
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2714
|
+
function visit_(key, node, visitor, path16) {
|
|
2715
|
+
const ctrl = callVisitor(key, node, visitor, path16);
|
|
2716
2716
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
2717
|
-
replaceNode(key,
|
|
2718
|
-
return visit_(key, ctrl, visitor,
|
|
2717
|
+
replaceNode(key, path16, ctrl);
|
|
2718
|
+
return visit_(key, ctrl, visitor, path16);
|
|
2719
2719
|
}
|
|
2720
2720
|
if (typeof ctrl !== "symbol") {
|
|
2721
2721
|
if (isCollection(node)) {
|
|
2722
|
-
|
|
2722
|
+
path16 = Object.freeze(path16.concat(node));
|
|
2723
2723
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2724
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
2724
|
+
const ci = visit_(i, node.items[i], visitor, path16);
|
|
2725
2725
|
if (typeof ci === "number")
|
|
2726
2726
|
i = ci - 1;
|
|
2727
2727
|
else if (ci === BREAK)
|
|
@@ -2732,13 +2732,13 @@ function visit_(key, node, visitor, path14) {
|
|
|
2732
2732
|
}
|
|
2733
2733
|
}
|
|
2734
2734
|
} else if (isPair(node)) {
|
|
2735
|
-
|
|
2736
|
-
const ck = visit_("key", node.key, visitor,
|
|
2735
|
+
path16 = Object.freeze(path16.concat(node));
|
|
2736
|
+
const ck = visit_("key", node.key, visitor, path16);
|
|
2737
2737
|
if (ck === BREAK)
|
|
2738
2738
|
return BREAK;
|
|
2739
2739
|
else if (ck === REMOVE)
|
|
2740
2740
|
node.key = null;
|
|
2741
|
-
const cv = visit_("value", node.value, visitor,
|
|
2741
|
+
const cv = visit_("value", node.value, visitor, path16);
|
|
2742
2742
|
if (cv === BREAK)
|
|
2743
2743
|
return BREAK;
|
|
2744
2744
|
else if (cv === REMOVE)
|
|
@@ -2759,17 +2759,17 @@ async function visitAsync(node, visitor) {
|
|
|
2759
2759
|
visitAsync.BREAK = BREAK;
|
|
2760
2760
|
visitAsync.SKIP = SKIP;
|
|
2761
2761
|
visitAsync.REMOVE = REMOVE;
|
|
2762
|
-
async function visitAsync_(key, node, visitor,
|
|
2763
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
2762
|
+
async function visitAsync_(key, node, visitor, path16) {
|
|
2763
|
+
const ctrl = await callVisitor(key, node, visitor, path16);
|
|
2764
2764
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
2765
|
-
replaceNode(key,
|
|
2766
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2765
|
+
replaceNode(key, path16, ctrl);
|
|
2766
|
+
return visitAsync_(key, ctrl, visitor, path16);
|
|
2767
2767
|
}
|
|
2768
2768
|
if (typeof ctrl !== "symbol") {
|
|
2769
2769
|
if (isCollection(node)) {
|
|
2770
|
-
|
|
2770
|
+
path16 = Object.freeze(path16.concat(node));
|
|
2771
2771
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2772
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
2772
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path16);
|
|
2773
2773
|
if (typeof ci === "number")
|
|
2774
2774
|
i = ci - 1;
|
|
2775
2775
|
else if (ci === BREAK)
|
|
@@ -2780,13 +2780,13 @@ async function visitAsync_(key, node, visitor, path14) {
|
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
2782
2782
|
} else if (isPair(node)) {
|
|
2783
|
-
|
|
2784
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
2783
|
+
path16 = Object.freeze(path16.concat(node));
|
|
2784
|
+
const ck = await visitAsync_("key", node.key, visitor, path16);
|
|
2785
2785
|
if (ck === BREAK)
|
|
2786
2786
|
return BREAK;
|
|
2787
2787
|
else if (ck === REMOVE)
|
|
2788
2788
|
node.key = null;
|
|
2789
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
2789
|
+
const cv = await visitAsync_("value", node.value, visitor, path16);
|
|
2790
2790
|
if (cv === BREAK)
|
|
2791
2791
|
return BREAK;
|
|
2792
2792
|
else if (cv === REMOVE)
|
|
@@ -2813,23 +2813,23 @@ function initVisitor(visitor) {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
return visitor;
|
|
2815
2815
|
}
|
|
2816
|
-
function callVisitor(key, node, visitor,
|
|
2816
|
+
function callVisitor(key, node, visitor, path16) {
|
|
2817
2817
|
if (typeof visitor === "function")
|
|
2818
|
-
return visitor(key, node,
|
|
2818
|
+
return visitor(key, node, path16);
|
|
2819
2819
|
if (isMap(node))
|
|
2820
|
-
return visitor.Map?.(key, node,
|
|
2820
|
+
return visitor.Map?.(key, node, path16);
|
|
2821
2821
|
if (isSeq(node))
|
|
2822
|
-
return visitor.Seq?.(key, node,
|
|
2822
|
+
return visitor.Seq?.(key, node, path16);
|
|
2823
2823
|
if (isPair(node))
|
|
2824
|
-
return visitor.Pair?.(key, node,
|
|
2824
|
+
return visitor.Pair?.(key, node, path16);
|
|
2825
2825
|
if (isScalar(node))
|
|
2826
|
-
return visitor.Scalar?.(key, node,
|
|
2826
|
+
return visitor.Scalar?.(key, node, path16);
|
|
2827
2827
|
if (isAlias(node))
|
|
2828
|
-
return visitor.Alias?.(key, node,
|
|
2828
|
+
return visitor.Alias?.(key, node, path16);
|
|
2829
2829
|
return void 0;
|
|
2830
2830
|
}
|
|
2831
|
-
function replaceNode(key,
|
|
2832
|
-
const parent =
|
|
2831
|
+
function replaceNode(key, path16, node) {
|
|
2832
|
+
const parent = path16[path16.length - 1];
|
|
2833
2833
|
if (isCollection(parent)) {
|
|
2834
2834
|
parent.items[key] = node;
|
|
2835
2835
|
} else if (isPair(parent)) {
|
|
@@ -3309,10 +3309,10 @@ function createNode(value, tagName, ctx) {
|
|
|
3309
3309
|
}
|
|
3310
3310
|
|
|
3311
3311
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
3312
|
-
function collectionFromPath(schema4,
|
|
3312
|
+
function collectionFromPath(schema4, path16, value) {
|
|
3313
3313
|
let v = value;
|
|
3314
|
-
for (let i =
|
|
3315
|
-
const k =
|
|
3314
|
+
for (let i = path16.length - 1; i >= 0; --i) {
|
|
3315
|
+
const k = path16[i];
|
|
3316
3316
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
3317
3317
|
const a = [];
|
|
3318
3318
|
a[k] = v;
|
|
@@ -3331,7 +3331,7 @@ function collectionFromPath(schema4, path14, value) {
|
|
|
3331
3331
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
3332
3332
|
});
|
|
3333
3333
|
}
|
|
3334
|
-
var isEmptyPath = (
|
|
3334
|
+
var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
|
|
3335
3335
|
var Collection = class extends NodeBase {
|
|
3336
3336
|
constructor(type, schema4) {
|
|
3337
3337
|
super(type);
|
|
@@ -3361,11 +3361,11 @@ var Collection = class extends NodeBase {
|
|
|
3361
3361
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3362
3362
|
* that already exists in the map.
|
|
3363
3363
|
*/
|
|
3364
|
-
addIn(
|
|
3365
|
-
if (isEmptyPath(
|
|
3364
|
+
addIn(path16, value) {
|
|
3365
|
+
if (isEmptyPath(path16))
|
|
3366
3366
|
this.add(value);
|
|
3367
3367
|
else {
|
|
3368
|
-
const [key, ...rest] =
|
|
3368
|
+
const [key, ...rest] = path16;
|
|
3369
3369
|
const node = this.get(key, true);
|
|
3370
3370
|
if (isCollection(node))
|
|
3371
3371
|
node.addIn(rest, value);
|
|
@@ -3379,8 +3379,8 @@ var Collection = class extends NodeBase {
|
|
|
3379
3379
|
* Removes a value from the collection.
|
|
3380
3380
|
* @returns `true` if the item was found and removed.
|
|
3381
3381
|
*/
|
|
3382
|
-
deleteIn(
|
|
3383
|
-
const [key, ...rest] =
|
|
3382
|
+
deleteIn(path16) {
|
|
3383
|
+
const [key, ...rest] = path16;
|
|
3384
3384
|
if (rest.length === 0)
|
|
3385
3385
|
return this.delete(key);
|
|
3386
3386
|
const node = this.get(key, true);
|
|
@@ -3394,8 +3394,8 @@ var Collection = class extends NodeBase {
|
|
|
3394
3394
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3395
3395
|
* `true` (collections are always returned intact).
|
|
3396
3396
|
*/
|
|
3397
|
-
getIn(
|
|
3398
|
-
const [key, ...rest] =
|
|
3397
|
+
getIn(path16, keepScalar) {
|
|
3398
|
+
const [key, ...rest] = path16;
|
|
3399
3399
|
const node = this.get(key, true);
|
|
3400
3400
|
if (rest.length === 0)
|
|
3401
3401
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -3413,8 +3413,8 @@ var Collection = class extends NodeBase {
|
|
|
3413
3413
|
/**
|
|
3414
3414
|
* Checks if the collection includes a value with the key `key`.
|
|
3415
3415
|
*/
|
|
3416
|
-
hasIn(
|
|
3417
|
-
const [key, ...rest] =
|
|
3416
|
+
hasIn(path16) {
|
|
3417
|
+
const [key, ...rest] = path16;
|
|
3418
3418
|
if (rest.length === 0)
|
|
3419
3419
|
return this.has(key);
|
|
3420
3420
|
const node = this.get(key, true);
|
|
@@ -3424,8 +3424,8 @@ var Collection = class extends NodeBase {
|
|
|
3424
3424
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3425
3425
|
* boolean to add/remove the item from the set.
|
|
3426
3426
|
*/
|
|
3427
|
-
setIn(
|
|
3428
|
-
const [key, ...rest] =
|
|
3427
|
+
setIn(path16, value) {
|
|
3428
|
+
const [key, ...rest] = path16;
|
|
3429
3429
|
if (rest.length === 0) {
|
|
3430
3430
|
this.set(key, value);
|
|
3431
3431
|
} else {
|
|
@@ -4874,9 +4874,9 @@ function visit2(cst, visitor) {
|
|
|
4874
4874
|
visit2.BREAK = BREAK2;
|
|
4875
4875
|
visit2.SKIP = SKIP2;
|
|
4876
4876
|
visit2.REMOVE = REMOVE2;
|
|
4877
|
-
visit2.itemAtPath = (cst,
|
|
4877
|
+
visit2.itemAtPath = (cst, path16) => {
|
|
4878
4878
|
let item = cst;
|
|
4879
|
-
for (const [field, index] of
|
|
4879
|
+
for (const [field, index] of path16) {
|
|
4880
4880
|
const tok = item?.[field];
|
|
4881
4881
|
if (tok && "items" in tok) {
|
|
4882
4882
|
item = tok.items[index];
|
|
@@ -4885,23 +4885,23 @@ visit2.itemAtPath = (cst, path14) => {
|
|
|
4885
4885
|
}
|
|
4886
4886
|
return item;
|
|
4887
4887
|
};
|
|
4888
|
-
visit2.parentCollection = (cst,
|
|
4889
|
-
const parent = visit2.itemAtPath(cst,
|
|
4890
|
-
const field =
|
|
4888
|
+
visit2.parentCollection = (cst, path16) => {
|
|
4889
|
+
const parent = visit2.itemAtPath(cst, path16.slice(0, -1));
|
|
4890
|
+
const field = path16[path16.length - 1][0];
|
|
4891
4891
|
const coll = parent?.[field];
|
|
4892
4892
|
if (coll && "items" in coll)
|
|
4893
4893
|
return coll;
|
|
4894
4894
|
throw new Error("Parent collection not found");
|
|
4895
4895
|
};
|
|
4896
|
-
function _visit(
|
|
4897
|
-
let ctrl = visitor(item,
|
|
4896
|
+
function _visit(path16, item, visitor) {
|
|
4897
|
+
let ctrl = visitor(item, path16);
|
|
4898
4898
|
if (typeof ctrl === "symbol")
|
|
4899
4899
|
return ctrl;
|
|
4900
4900
|
for (const field of ["key", "value"]) {
|
|
4901
4901
|
const token = item[field];
|
|
4902
4902
|
if (token && "items" in token) {
|
|
4903
4903
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4904
|
-
const ci = _visit(Object.freeze(
|
|
4904
|
+
const ci = _visit(Object.freeze(path16.concat([[field, i]])), token.items[i], visitor);
|
|
4905
4905
|
if (typeof ci === "number")
|
|
4906
4906
|
i = ci - 1;
|
|
4907
4907
|
else if (ci === BREAK2)
|
|
@@ -4912,10 +4912,10 @@ function _visit(path14, item, visitor) {
|
|
|
4912
4912
|
}
|
|
4913
4913
|
}
|
|
4914
4914
|
if (typeof ctrl === "function" && field === "key")
|
|
4915
|
-
ctrl = ctrl(item,
|
|
4915
|
+
ctrl = ctrl(item, path16);
|
|
4916
4916
|
}
|
|
4917
4917
|
}
|
|
4918
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4918
|
+
return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
|
|
4919
4919
|
}
|
|
4920
4920
|
|
|
4921
4921
|
// ../../node_modules/yaml/browser/dist/parse/lexer.js
|
|
@@ -8145,8 +8145,8 @@ function isRnxCaptureRegionAtlas(value) {
|
|
|
8145
8145
|
|
|
8146
8146
|
// src/vite-plugin-one.ts
|
|
8147
8147
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
8148
|
-
var
|
|
8149
|
-
var
|
|
8148
|
+
var import_node_crypto5 = require("node:crypto");
|
|
8149
|
+
var import_node_module2 = require("node:module");
|
|
8150
8150
|
var import_path3 = __toESM(require("path"), 1);
|
|
8151
8151
|
var import_ws2 = require("ws");
|
|
8152
8152
|
|
|
@@ -8223,6 +8223,222 @@ function launchRnxDesktop(bundleUrl, appName) {
|
|
|
8223
8223
|
// src/vite-plugin-one.ts
|
|
8224
8224
|
init_replacement_module_handler();
|
|
8225
8225
|
|
|
8226
|
+
// src/one-widget-metadata.ts
|
|
8227
|
+
var import_node_child_process2 = require("node:child_process");
|
|
8228
|
+
var import_node_crypto4 = require("node:crypto");
|
|
8229
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
8230
|
+
var import_node_module = require("node:module");
|
|
8231
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
8232
|
+
var import_node_util = require("node:util");
|
|
8233
|
+
|
|
8234
|
+
// cli/internal-child.ts
|
|
8235
|
+
var RNX_FORKED_SCRIPT_ENV = "PEACH_RUNS_FORKED_SCRIPTS";
|
|
8236
|
+
|
|
8237
|
+
// src/one-widget-metadata.ts
|
|
8238
|
+
init_is_record();
|
|
8239
|
+
|
|
8240
|
+
// src/swift-source-file.ts
|
|
8241
|
+
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
8242
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
8243
|
+
function readPackageFile(root, file, maxBytes) {
|
|
8244
|
+
const canonicalRoot = import_node_fs6.default.realpathSync(root);
|
|
8245
|
+
const relative2 = import_node_path6.default.relative(canonicalRoot, import_node_fs6.default.realpathSync(file));
|
|
8246
|
+
if (relative2 === ".." || relative2.startsWith(`..${import_node_path6.default.sep}`) || import_node_path6.default.isAbsolute(relative2)) {
|
|
8247
|
+
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
8248
|
+
}
|
|
8249
|
+
let ancestor = import_node_path6.default.resolve(file);
|
|
8250
|
+
while (ancestor !== canonicalRoot) {
|
|
8251
|
+
if (import_node_fs6.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
8252
|
+
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
8253
|
+
}
|
|
8254
|
+
const parent = import_node_path6.default.dirname(ancestor);
|
|
8255
|
+
if (parent === ancestor)
|
|
8256
|
+
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
8257
|
+
ancestor = parent;
|
|
8258
|
+
}
|
|
8259
|
+
const expected = import_node_fs6.default.statSync(file);
|
|
8260
|
+
const fd = import_node_fs6.default.openSync(file, import_node_fs6.default.constants.O_RDONLY | import_node_fs6.default.constants.O_NOFOLLOW);
|
|
8261
|
+
try {
|
|
8262
|
+
const stat = import_node_fs6.default.fstatSync(fd);
|
|
8263
|
+
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
8264
|
+
throw new Error(`swift input changed while opening: ${file}`);
|
|
8265
|
+
}
|
|
8266
|
+
if (!stat.isFile() || stat.size > maxBytes) {
|
|
8267
|
+
throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
|
|
8268
|
+
}
|
|
8269
|
+
const bytes = Buffer.alloc(stat.size + 1);
|
|
8270
|
+
let offset = 0;
|
|
8271
|
+
while (offset < bytes.length) {
|
|
8272
|
+
const count = import_node_fs6.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
8273
|
+
if (count === 0) break;
|
|
8274
|
+
offset += count;
|
|
8275
|
+
}
|
|
8276
|
+
if (offset !== stat.size || import_node_fs6.default.fstatSync(fd).size !== stat.size) {
|
|
8277
|
+
throw new Error(`swift input changed while reading: ${file}`);
|
|
8278
|
+
}
|
|
8279
|
+
return bytes.subarray(0, offset);
|
|
8280
|
+
} finally {
|
|
8281
|
+
import_node_fs6.default.closeSync(fd);
|
|
8282
|
+
}
|
|
8283
|
+
}
|
|
8284
|
+
|
|
8285
|
+
// src/swift-submit.ts
|
|
8286
|
+
var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
8287
|
+
var SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
8288
|
+
var MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
8289
|
+
var MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
8290
|
+
var MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
8291
|
+
var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
8292
|
+
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
8293
|
+
|
|
8294
|
+
// src/one-widget-metadata.ts
|
|
8295
|
+
var run = (0, import_node_util.promisify)(import_node_child_process2.execFile);
|
|
8296
|
+
var configs = /* @__PURE__ */ new Map();
|
|
8297
|
+
var reads = /* @__PURE__ */ new Map();
|
|
8298
|
+
var CONFIG_CHILD = `
|
|
8299
|
+
import fs from 'node:fs';
|
|
8300
|
+
import { loadUserOneOptions } from 'one/vite';
|
|
8301
|
+
const { config, oneOptions } = await loadUserOneOptions('serve', true);
|
|
8302
|
+
const app = oneOptions.native?.app;
|
|
8303
|
+
const widgets = app?.ios?.widgets;
|
|
8304
|
+
fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
8305
|
+
widget: widgets ? { appName: app.name, bundleId: app.ios.bundleId,
|
|
8306
|
+
suite: widgets.appGroup, kind: widgets.kind, displayName: widgets.displayName,
|
|
8307
|
+
description: widgets.description } : null,
|
|
8308
|
+
urlSchemes: app?.scheme === undefined ? [] : Array.isArray(app.scheme) ? app.scheme : [app.scheme],
|
|
8309
|
+
watched: [config.path, ...config.dependencies]
|
|
8310
|
+
}));
|
|
8311
|
+
`;
|
|
8312
|
+
function configStamp(files) {
|
|
8313
|
+
return JSON.stringify(
|
|
8314
|
+
files.map((file) => {
|
|
8315
|
+
if (!import_node_fs7.default.existsSync(file)) return [file, null];
|
|
8316
|
+
const stat = import_node_fs7.default.statSync(file);
|
|
8317
|
+
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
8318
|
+
})
|
|
8319
|
+
);
|
|
8320
|
+
}
|
|
8321
|
+
async function readConfig(root) {
|
|
8322
|
+
const cached2 = configs.get(root);
|
|
8323
|
+
if (cached2 && cached2.stamp === configStamp(cached2.watched)) return cached2;
|
|
8324
|
+
const reading = reads.get(root);
|
|
8325
|
+
if (reading) return reading;
|
|
8326
|
+
const promise = (async () => {
|
|
8327
|
+
(0, import_node_module.createRequire)(import_node_path7.default.join(root, "package.json")).resolve("one/vite");
|
|
8328
|
+
const cache = import_node_path7.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
8329
|
+
import_node_fs7.default.mkdirSync(cache, { recursive: true });
|
|
8330
|
+
const directory = import_node_fs7.default.mkdtempSync(import_node_path7.default.join(cache, "read-"));
|
|
8331
|
+
const script = import_node_path7.default.join(directory, "read.mjs");
|
|
8332
|
+
const result = import_node_path7.default.join(directory, "result.json");
|
|
8333
|
+
import_node_fs7.default.writeFileSync(script, CONFIG_CHILD);
|
|
8334
|
+
try {
|
|
8335
|
+
await run(process.execPath, [script, result], {
|
|
8336
|
+
cwd: root,
|
|
8337
|
+
env: { ...process.env, [RNX_FORKED_SCRIPT_ENV]: "1" },
|
|
8338
|
+
timeout: 3e4,
|
|
8339
|
+
maxBuffer: 1024 * 1024
|
|
8340
|
+
});
|
|
8341
|
+
const value = JSON.parse(import_node_fs7.default.readFileSync(result, "utf8"));
|
|
8342
|
+
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
8343
|
+
throw new Error("One config loader returned invalid dependencies");
|
|
8344
|
+
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
8345
|
+
(scheme) => typeof scheme === "string" && /^[A-Za-z][A-Za-z0-9+.-]*$/.test(scheme)
|
|
8346
|
+
))
|
|
8347
|
+
throw new Error("One config loader returned invalid native.app.scheme");
|
|
8348
|
+
let widget = null;
|
|
8349
|
+
if (value.widget !== null) {
|
|
8350
|
+
const entry = value.widget;
|
|
8351
|
+
if (!isRecord(entry) || typeof entry.appName !== "string" || !/^[A-Za-z][A-Za-z0-9_]*$/.test(entry.appName) || typeof entry.bundleId !== "string" || !entry.bundleId || typeof entry.suite !== "string" || !entry.suite || typeof entry.kind !== "string" || !entry.kind || typeof entry.displayName !== "string" || !entry.displayName || typeof entry.description !== "string" || !entry.description)
|
|
8352
|
+
throw new Error("One config loader returned invalid native.app.ios.widgets");
|
|
8353
|
+
widget = {
|
|
8354
|
+
appName: entry.appName,
|
|
8355
|
+
bundleId: entry.bundleId,
|
|
8356
|
+
suite: entry.suite,
|
|
8357
|
+
kind: entry.kind,
|
|
8358
|
+
displayName: entry.displayName,
|
|
8359
|
+
description: entry.description
|
|
8360
|
+
};
|
|
8361
|
+
}
|
|
8362
|
+
const watched = [
|
|
8363
|
+
.../* @__PURE__ */ new Set([
|
|
8364
|
+
import_node_path7.default.join(root, "package.json"),
|
|
8365
|
+
...value.watched.map((file) => import_node_path7.default.resolve(root, file))
|
|
8366
|
+
])
|
|
8367
|
+
];
|
|
8368
|
+
const loaded2 = {
|
|
8369
|
+
widget,
|
|
8370
|
+
urlSchemes: value.urlSchemes,
|
|
8371
|
+
watched,
|
|
8372
|
+
stamp: configStamp(watched)
|
|
8373
|
+
};
|
|
8374
|
+
configs.set(root, loaded2);
|
|
8375
|
+
return loaded2;
|
|
8376
|
+
} finally {
|
|
8377
|
+
import_node_fs7.default.rmSync(directory, { recursive: true, force: true });
|
|
8378
|
+
}
|
|
8379
|
+
})();
|
|
8380
|
+
reads.set(root, promise);
|
|
8381
|
+
try {
|
|
8382
|
+
return await promise;
|
|
8383
|
+
} finally {
|
|
8384
|
+
reads.delete(root);
|
|
8385
|
+
}
|
|
8386
|
+
}
|
|
8387
|
+
async function readOneWidgetSources(appRoot) {
|
|
8388
|
+
const root = import_node_fs7.default.realpathSync(appRoot);
|
|
8389
|
+
const config = await readConfig(root);
|
|
8390
|
+
if (!config.widget) return null;
|
|
8391
|
+
const widget = config.widget;
|
|
8392
|
+
const sourceFiles = {
|
|
8393
|
+
"OneWidget.swift": import_node_path7.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
8394
|
+
"OneWidgetContract.swift": import_node_path7.default.join(
|
|
8395
|
+
root,
|
|
8396
|
+
"ios",
|
|
8397
|
+
widget.appName,
|
|
8398
|
+
"OneWidgetContract.swift"
|
|
8399
|
+
)
|
|
8400
|
+
};
|
|
8401
|
+
const files = /* @__PURE__ */ new Map();
|
|
8402
|
+
const sources = {};
|
|
8403
|
+
for (const [name2, file] of Object.entries(sourceFiles)) {
|
|
8404
|
+
if (!import_node_fs7.default.existsSync(file))
|
|
8405
|
+
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
8406
|
+
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
8407
|
+
const text2 = bytes.toString("utf8");
|
|
8408
|
+
if (!Buffer.from(text2).equals(bytes))
|
|
8409
|
+
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
8410
|
+
files.set(name2, text2);
|
|
8411
|
+
sources[import_node_path7.default.relative(root, file).split(import_node_path7.default.sep).join("/")] = (0, import_node_crypto4.createHash)("sha256").update(bytes).digest("hex");
|
|
8412
|
+
}
|
|
8413
|
+
const contract = files.get("OneWidgetContract.swift") ?? "";
|
|
8414
|
+
const source = files.get("OneWidget.swift") ?? "";
|
|
8415
|
+
if (!contract.includes(`static let appGroup = ${JSON.stringify(widget.suite)}`) || !contract.includes(`static let kind = ${JSON.stringify(widget.kind)}`) || !source.includes(
|
|
8416
|
+
`.configurationDisplayName(${JSON.stringify(widget.displayName)})`
|
|
8417
|
+
) || !source.includes(`.description(${JSON.stringify(widget.description)})`))
|
|
8418
|
+
throw new Error(
|
|
8419
|
+
"One widget prebuild sources disagree with native.app.ios.widgets; run one prebuild"
|
|
8420
|
+
);
|
|
8421
|
+
return {
|
|
8422
|
+
root,
|
|
8423
|
+
files,
|
|
8424
|
+
watched: [...config.watched, ...Object.values(sourceFiles)],
|
|
8425
|
+
widget: { ...widget, sources },
|
|
8426
|
+
urlSchemes: config.urlSchemes
|
|
8427
|
+
};
|
|
8428
|
+
}
|
|
8429
|
+
async function configuredOneWidget(appRoot, bundleUrl) {
|
|
8430
|
+
const source = await readOneWidgetSources(appRoot);
|
|
8431
|
+
if (!source) return null;
|
|
8432
|
+
return {
|
|
8433
|
+
metadata: source.widget,
|
|
8434
|
+
projectRoot: source.root,
|
|
8435
|
+
appIdentity: (0, import_node_crypto4.createHash)("sha256").update(JSON.stringify([source.root, source.widget.bundleId])).digest("hex"),
|
|
8436
|
+
bundleUrl,
|
|
8437
|
+
packageUrl: new URL(`${SWIFT_PACKAGE_PATH}OneWidgets`, bundleUrl).href,
|
|
8438
|
+
urlSchemes: source.urlSchemes
|
|
8439
|
+
};
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8226
8442
|
// src/runtime-assets.ts
|
|
8227
8443
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
8228
8444
|
var import_path2 = __toESM(require("path"), 1);
|
|
@@ -8415,15 +8631,6 @@ function streamFile(res, stream) {
|
|
|
8415
8631
|
stream.pipe(res);
|
|
8416
8632
|
}
|
|
8417
8633
|
|
|
8418
|
-
// src/swift-submit.ts
|
|
8419
|
-
var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
8420
|
-
var SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
8421
|
-
var MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
8422
|
-
var MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
8423
|
-
var MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
8424
|
-
var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
8425
|
-
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
8426
|
-
|
|
8427
8634
|
// src/vite-plugin-one.ts
|
|
8428
8635
|
var SWIFT_ROUTE_PREFIX = "/__peach/swift";
|
|
8429
8636
|
var swiftHost;
|
|
@@ -8453,7 +8660,7 @@ function rnxPlugin(options = {}) {
|
|
|
8453
8660
|
let swiftModuleRoot;
|
|
8454
8661
|
const moduleRootFor = () => {
|
|
8455
8662
|
if (swiftModuleRoot === void 0) {
|
|
8456
|
-
const peachsimPackage = (0,
|
|
8663
|
+
const peachsimPackage = (0, import_node_module2.createRequire)(
|
|
8457
8664
|
import_path3.default.join(server.config.root, "package.json")
|
|
8458
8665
|
).resolve("peachsim/package.json");
|
|
8459
8666
|
const moduleRoot = import_path3.default.resolve(
|
|
@@ -8634,7 +8841,7 @@ function rnxPlugin(options = {}) {
|
|
|
8634
8841
|
});
|
|
8635
8842
|
const bundleUrl = options.bundleUrl || "/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false";
|
|
8636
8843
|
const appName = resolveRnxDesktopAppName(options.open, server.config.root);
|
|
8637
|
-
const replacementToken = (0,
|
|
8844
|
+
const replacementToken = (0, import_node_crypto5.randomUUID)();
|
|
8638
8845
|
const bundleForPort = (port2) => {
|
|
8639
8846
|
const fullBundleUrl = bundleUrl.startsWith("http") ? bundleUrl : `http://localhost:${port2}${bundleUrl.startsWith("/") ? "" : "/"}${bundleUrl}`;
|
|
8640
8847
|
return tagRnxBundleForPlugin(
|
|
@@ -8668,18 +8875,34 @@ function rnxPlugin(options = {}) {
|
|
|
8668
8875
|
};
|
|
8669
8876
|
next();
|
|
8670
8877
|
});
|
|
8671
|
-
server.middlewares.use((req, res, next) => {
|
|
8878
|
+
server.middlewares.use(async (req, res, next) => {
|
|
8672
8879
|
if ((req.url || "").split("?")[0] !== "/__server-scan") return next();
|
|
8673
8880
|
const scanPort = listeningPort();
|
|
8674
8881
|
const pluginBundleUrl = bundleForPort(scanPort);
|
|
8675
8882
|
const absoluteBundleUrl = pluginBundleUrl.startsWith("http") ? pluginBundleUrl : `http://localhost:${scanPort}${pluginBundleUrl}`;
|
|
8676
8883
|
res.setHeader("content-type", "application/json");
|
|
8884
|
+
res.setHeader("access-control-allow-origin", "*");
|
|
8885
|
+
res.setHeader("cache-control", "no-store");
|
|
8886
|
+
let widget = null;
|
|
8887
|
+
let widgetError;
|
|
8888
|
+
try {
|
|
8889
|
+
widget = await configuredOneWidget(server.config.root, absoluteBundleUrl);
|
|
8890
|
+
if (widget && packageMap().has("OneWidgets"))
|
|
8891
|
+
throw new Error(
|
|
8892
|
+
"swift package OneWidgets conflicts with One's generated widget extension"
|
|
8893
|
+
);
|
|
8894
|
+
} catch (error) {
|
|
8895
|
+
widget = null;
|
|
8896
|
+
widgetError = String(error);
|
|
8897
|
+
}
|
|
8677
8898
|
res.end(
|
|
8678
8899
|
JSON.stringify([
|
|
8679
8900
|
{
|
|
8680
8901
|
port: scanPort,
|
|
8681
8902
|
framework: "one",
|
|
8682
8903
|
bundleUrl: absoluteBundleUrl,
|
|
8904
|
+
widget,
|
|
8905
|
+
...widgetError ? { widgetError } : {},
|
|
8683
8906
|
...appName ? { projectName: appName } : {},
|
|
8684
8907
|
lastSeen: Date.now()
|
|
8685
8908
|
}
|
|
@@ -8757,7 +8980,7 @@ function rnxPlugin(options = {}) {
|
|
|
8757
8980
|
// src/metro-plugin.ts
|
|
8758
8981
|
var import_fs5 = __toESM(require("fs"), 1);
|
|
8759
8982
|
var import_module2 = require("module");
|
|
8760
|
-
var
|
|
8983
|
+
var import_node_crypto6 = require("node:crypto");
|
|
8761
8984
|
var import_path4 = __toESM(require("path"), 1);
|
|
8762
8985
|
init_app_project();
|
|
8763
8986
|
init_replacement_module_handler();
|
|
@@ -8875,7 +9098,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
8875
9098
|
}
|
|
8876
9099
|
function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
8877
9100
|
const pbxprojPath = Object.keys(files).find(
|
|
8878
|
-
(
|
|
9101
|
+
(path16) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path16)
|
|
8879
9102
|
);
|
|
8880
9103
|
if (!pbxprojPath) return null;
|
|
8881
9104
|
const pbxproj = files[pbxprojPath];
|
|
@@ -8887,7 +9110,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
8887
9110
|
].map((match) => match[1])
|
|
8888
9111
|
);
|
|
8889
9112
|
const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
8890
|
-
const targetName = Object.keys(files).filter((
|
|
9113
|
+
const targetName = Object.keys(files).filter((path16) => !path16.includes("/Pods/")).map((path16) => path16.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
|
|
8891
9114
|
if (!targetName) return null;
|
|
8892
9115
|
const plist3 = files[`ios/${targetName}/Info.plist`];
|
|
8893
9116
|
if (!plist3) return null;
|
|
@@ -8962,9 +9185,9 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
|
|
|
8962
9185
|
}
|
|
8963
9186
|
|
|
8964
9187
|
// src/native-firebase-config.ts
|
|
8965
|
-
var
|
|
8966
|
-
var
|
|
8967
|
-
var
|
|
9188
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
9189
|
+
var import_node_module3 = require("node:module");
|
|
9190
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
8968
9191
|
init_is_record();
|
|
8969
9192
|
|
|
8970
9193
|
// src/plist.ts
|
|
@@ -8974,12 +9197,12 @@ function parsePlistSource(source) {
|
|
|
8974
9197
|
}
|
|
8975
9198
|
|
|
8976
9199
|
// src/xcode-project.ts
|
|
8977
|
-
var
|
|
8978
|
-
var
|
|
9200
|
+
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
9201
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
8979
9202
|
var import_plist2 = __toESM(require_plist(), 1);
|
|
8980
9203
|
|
|
8981
9204
|
// src/xcode-json-project.ts
|
|
8982
|
-
var
|
|
9205
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
8983
9206
|
var import_json52 = __toESM(require_lib(), 1);
|
|
8984
9207
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8985
9208
|
var text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -8995,7 +9218,7 @@ var PHASE_ISA = {
|
|
|
8995
9218
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
8996
9219
|
const json = import_json52.default.parse(source);
|
|
8997
9220
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
8998
|
-
const projectDir =
|
|
9221
|
+
const projectDir = import_node_path9.default.dirname(xcodeproj);
|
|
8999
9222
|
const objects = {};
|
|
9000
9223
|
let next = 0;
|
|
9001
9224
|
const add = (entry, id) => {
|
|
@@ -9008,7 +9231,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9008
9231
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
|
|
9009
9232
|
if (base) {
|
|
9010
9233
|
if (base[1] === "PROJECT")
|
|
9011
|
-
return { sourceTree: "<absolute>", path:
|
|
9234
|
+
return { sourceTree: "<absolute>", path: import_node_path9.default.join(projectDir, base[2]) };
|
|
9012
9235
|
if (base[1] === "PRODUCTS")
|
|
9013
9236
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
9014
9237
|
return null;
|
|
@@ -9016,7 +9239,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9016
9239
|
const unescaped = raw.replaceAll("\\<", "<");
|
|
9017
9240
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
9018
9241
|
if (unescaped.startsWith("~")) return null;
|
|
9019
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
9242
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path9.default.join(groupDir, unescaped) };
|
|
9020
9243
|
};
|
|
9021
9244
|
const memberships = [];
|
|
9022
9245
|
const folders = [];
|
|
@@ -9027,7 +9250,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9027
9250
|
const kind = text(entry.kind) ?? "file-reference";
|
|
9028
9251
|
const raw = text(entry.path) ?? "";
|
|
9029
9252
|
const located = raw === "" ? null : locate(raw, parent.dir);
|
|
9030
|
-
const name2 = text(entry.name) ??
|
|
9253
|
+
const name2 = text(entry.name) ?? import_node_path9.default.basename(raw);
|
|
9031
9254
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
9032
9255
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
9033
9256
|
node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -9142,7 +9365,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
9142
9365
|
if (!isObject(entry)) continue;
|
|
9143
9366
|
const repository = text(entry.repository);
|
|
9144
9367
|
const local = text(entry.path);
|
|
9145
|
-
const name2 = local !== void 0 ?
|
|
9368
|
+
const name2 = local !== void 0 ? import_node_path9.default.basename(import_node_path9.default.resolve(import_node_path9.default.dirname(xcodeproj), local)) : import_node_path9.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
9146
9369
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
9147
9370
|
packageIds.set(name2.toLowerCase(), id);
|
|
9148
9371
|
}
|
|
@@ -9419,28 +9642,28 @@ var CONDITIONS = {
|
|
|
9419
9642
|
variant: "normal"
|
|
9420
9643
|
};
|
|
9421
9644
|
function walkFiles(dir) {
|
|
9422
|
-
if (!
|
|
9645
|
+
if (!import_node_fs9.default.existsSync(dir)) return [];
|
|
9423
9646
|
const out = [];
|
|
9424
|
-
for (const entry of
|
|
9647
|
+
for (const entry of import_node_fs9.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
9425
9648
|
if (entry.name.startsWith(".")) continue;
|
|
9426
|
-
const full =
|
|
9649
|
+
const full = import_node_path10.default.join(dir, entry.name);
|
|
9427
9650
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
9428
9651
|
else if (entry.isFile()) out.push(full);
|
|
9429
9652
|
}
|
|
9430
9653
|
return out;
|
|
9431
9654
|
}
|
|
9432
|
-
var isDirectory = (dir) =>
|
|
9655
|
+
var isDirectory = (dir) => import_node_fs9.default.existsSync(dir) && import_node_fs9.default.statSync(dir).isDirectory();
|
|
9433
9656
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
9434
|
-
if (seen.has(file) || !
|
|
9657
|
+
if (seen.has(file) || !import_node_fs9.default.existsSync(file)) return {};
|
|
9435
9658
|
seen.add(file);
|
|
9436
9659
|
const settings = {};
|
|
9437
|
-
for (const raw of
|
|
9660
|
+
for (const raw of import_node_fs9.default.readFileSync(file, "utf8").split("\n")) {
|
|
9438
9661
|
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
9439
9662
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
9440
9663
|
if (include) {
|
|
9441
9664
|
Object.assign(
|
|
9442
9665
|
settings,
|
|
9443
|
-
readXcconfig(
|
|
9666
|
+
readXcconfig(import_node_path10.default.resolve(import_node_path10.default.dirname(file), include[1]), seen)
|
|
9444
9667
|
);
|
|
9445
9668
|
continue;
|
|
9446
9669
|
}
|
|
@@ -9490,22 +9713,22 @@ function decodeXml(text2) {
|
|
|
9490
9713
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
9491
9714
|
}
|
|
9492
9715
|
function workspaceReferences(workspace) {
|
|
9493
|
-
const data =
|
|
9494
|
-
if (!
|
|
9716
|
+
const data = import_node_path10.default.join(workspace, "contents.xcworkspacedata");
|
|
9717
|
+
if (!import_node_fs9.default.existsSync(data))
|
|
9495
9718
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
9496
|
-
const container =
|
|
9719
|
+
const container = import_node_path10.default.dirname(workspace);
|
|
9497
9720
|
const locate = (location, base) => {
|
|
9498
9721
|
const colon = location.indexOf(":");
|
|
9499
9722
|
const kind = location.slice(0, colon);
|
|
9500
9723
|
const rest = location.slice(colon + 1);
|
|
9501
|
-
if (kind === "group") return
|
|
9502
|
-
if (kind === "container" || kind === "self") return
|
|
9503
|
-
if (kind === "absolute") return
|
|
9504
|
-
throw new Error(`${
|
|
9724
|
+
if (kind === "group") return import_node_path10.default.resolve(base, rest);
|
|
9725
|
+
if (kind === "container" || kind === "self") return import_node_path10.default.resolve(container, rest);
|
|
9726
|
+
if (kind === "absolute") return import_node_path10.default.resolve(rest);
|
|
9727
|
+
throw new Error(`${import_node_path10.default.basename(workspace)} has an unsupported location ${location}`);
|
|
9505
9728
|
};
|
|
9506
9729
|
const groups = [container];
|
|
9507
9730
|
const references = [];
|
|
9508
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
9731
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs9.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
9509
9732
|
if (closing) {
|
|
9510
9733
|
if (tag === "Group") groups.pop();
|
|
9511
9734
|
continue;
|
|
@@ -9521,8 +9744,8 @@ function workspaceReferences(workspace) {
|
|
|
9521
9744
|
var loaded = /* @__PURE__ */ new Map();
|
|
9522
9745
|
function xcodeProjectFile(xcodeproj) {
|
|
9523
9746
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
9524
|
-
const file =
|
|
9525
|
-
if (
|
|
9747
|
+
const file = import_node_path10.default.join(xcodeproj, name2);
|
|
9748
|
+
if (import_node_fs9.default.existsSync(file)) return file;
|
|
9526
9749
|
}
|
|
9527
9750
|
return null;
|
|
9528
9751
|
}
|
|
@@ -9530,10 +9753,10 @@ function loadProject(xcodeproj) {
|
|
|
9530
9753
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
9531
9754
|
if (!projectFile)
|
|
9532
9755
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
9533
|
-
const mtimeMs =
|
|
9756
|
+
const mtimeMs = import_node_fs9.default.statSync(projectFile).mtimeMs;
|
|
9534
9757
|
const cached2 = loaded.get(projectFile);
|
|
9535
9758
|
if (cached2?.mtimeMs === mtimeMs) return cached2.project;
|
|
9536
|
-
const source =
|
|
9759
|
+
const source = import_node_fs9.default.readFileSync(projectFile, "utf8");
|
|
9537
9760
|
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
9538
9761
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
9539
9762
|
throw new Error(`${projectFile} has no objects table`);
|
|
@@ -9547,8 +9770,8 @@ function loadProject(xcodeproj) {
|
|
|
9547
9770
|
if (!project || project.isa !== "PBXProject") {
|
|
9548
9771
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
9549
9772
|
}
|
|
9550
|
-
const projectDir =
|
|
9551
|
-
|
|
9773
|
+
const projectDir = import_node_fs9.default.realpathSync(
|
|
9774
|
+
import_node_path10.default.resolve(import_node_path10.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
9552
9775
|
);
|
|
9553
9776
|
const parent = /* @__PURE__ */ new Map();
|
|
9554
9777
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -9566,11 +9789,11 @@ function loadProject(xcodeproj) {
|
|
|
9566
9789
|
const own = str(entry.path) ?? "";
|
|
9567
9790
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
9568
9791
|
if (tree === "<absolute>") result2 = own;
|
|
9569
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
9792
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path10.default.join(projectDir, own);
|
|
9570
9793
|
else if (tree === "<group>") {
|
|
9571
9794
|
const up = parent.get(id);
|
|
9572
9795
|
const base = up ? resolvePath(up) : projectDir;
|
|
9573
|
-
result2 = base === null ? null :
|
|
9796
|
+
result2 = base === null ? null : import_node_path10.default.join(base, own);
|
|
9574
9797
|
}
|
|
9575
9798
|
}
|
|
9576
9799
|
resolvedPaths.set(id, result2);
|
|
@@ -9591,8 +9814,8 @@ function loadProject(xcodeproj) {
|
|
|
9591
9814
|
function targetSettings(ref, builtins) {
|
|
9592
9815
|
const { project, target } = ref;
|
|
9593
9816
|
const level = (listId) => {
|
|
9594
|
-
const
|
|
9595
|
-
const config =
|
|
9817
|
+
const configs2 = list(project.object(listId)?.buildConfigurations).map(project.object);
|
|
9818
|
+
const config = configs2.find((entry) => entry?.name === "Debug") ?? configs2.find(Boolean);
|
|
9596
9819
|
if (!config) return [];
|
|
9597
9820
|
const name2 = str(config.name) ?? "Debug";
|
|
9598
9821
|
const base = str(config.baseConfigurationReference);
|
|
@@ -9670,7 +9893,7 @@ function targetMembers(ref) {
|
|
|
9670
9893
|
const addResource = (file) => {
|
|
9671
9894
|
if (isDirectory(file)) {
|
|
9672
9895
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
9673
|
-
} else if (
|
|
9896
|
+
} else if (import_node_fs9.default.existsSync(file)) resources.add(file);
|
|
9674
9897
|
};
|
|
9675
9898
|
const fileRefPaths = (refId) => {
|
|
9676
9899
|
const entry = project.object(refId);
|
|
@@ -9691,7 +9914,7 @@ function targetMembers(ref) {
|
|
|
9691
9914
|
for (const buildFileId of list(phase.files)) {
|
|
9692
9915
|
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
9693
9916
|
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
9694
|
-
if (!
|
|
9917
|
+
if (!import_node_fs9.default.existsSync(file)) continue;
|
|
9695
9918
|
allSources.add(file);
|
|
9696
9919
|
if (file.endsWith(".swift")) sources.add(file);
|
|
9697
9920
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
@@ -9699,7 +9922,7 @@ function targetMembers(ref) {
|
|
|
9699
9922
|
}
|
|
9700
9923
|
}
|
|
9701
9924
|
const addSynchronized = (folder, relative2) => {
|
|
9702
|
-
const file =
|
|
9925
|
+
const file = import_node_path10.default.join(folder, relative2);
|
|
9703
9926
|
if (NEVER_MEMBER.test(relative2)) return;
|
|
9704
9927
|
if (file.endsWith(".swift")) {
|
|
9705
9928
|
if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -9724,7 +9947,7 @@ function targetMembers(ref) {
|
|
|
9724
9947
|
}
|
|
9725
9948
|
if (owned.has(groupId)) {
|
|
9726
9949
|
for (const file of walkFiles(folder)) {
|
|
9727
|
-
const relative2 =
|
|
9950
|
+
const relative2 = import_node_path10.default.relative(folder, file).split(import_node_path10.default.sep).join("/");
|
|
9728
9951
|
if ([...exceptions].some(
|
|
9729
9952
|
(exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
|
|
9730
9953
|
))
|
|
@@ -9733,14 +9956,14 @@ function targetMembers(ref) {
|
|
|
9733
9956
|
}
|
|
9734
9957
|
} else {
|
|
9735
9958
|
for (const relative2 of exceptions) {
|
|
9736
|
-
const file =
|
|
9959
|
+
const file = import_node_path10.default.join(folder, relative2);
|
|
9737
9960
|
if (isDirectory(file)) {
|
|
9738
9961
|
for (const inner of walkFiles(file))
|
|
9739
9962
|
addSynchronized(
|
|
9740
9963
|
folder,
|
|
9741
|
-
|
|
9964
|
+
import_node_path10.default.relative(folder, inner).split(import_node_path10.default.sep).join("/")
|
|
9742
9965
|
);
|
|
9743
|
-
} else if (
|
|
9966
|
+
} else if (import_node_fs9.default.existsSync(file)) addSynchronized(folder, relative2);
|
|
9744
9967
|
}
|
|
9745
9968
|
}
|
|
9746
9969
|
}
|
|
@@ -9753,8 +9976,8 @@ function targetMembers(ref) {
|
|
|
9753
9976
|
function commonAncestor(dirs) {
|
|
9754
9977
|
let common = dirs[0];
|
|
9755
9978
|
for (const dir of dirs) {
|
|
9756
|
-
while (common !==
|
|
9757
|
-
common =
|
|
9979
|
+
while (common !== import_node_path10.default.dirname(common) && import_node_path10.default.relative(common, dir).startsWith(".."))
|
|
9980
|
+
common = import_node_path10.default.dirname(common);
|
|
9758
9981
|
}
|
|
9759
9982
|
return common;
|
|
9760
9983
|
}
|
|
@@ -9763,8 +9986,8 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
9763
9986
|
const projects = [];
|
|
9764
9987
|
const projectAt = /* @__PURE__ */ new Map();
|
|
9765
9988
|
const addProject = (xcodeproj) => {
|
|
9766
|
-
const key =
|
|
9767
|
-
if (projectAt.has(key) || key.split(
|
|
9989
|
+
const key = import_node_path10.default.resolve(xcodeproj);
|
|
9990
|
+
if (projectAt.has(key) || key.split(import_node_path10.default.sep).includes("Pods")) return;
|
|
9768
9991
|
if (!xcodeProjectFile(key)) return;
|
|
9769
9992
|
const project = loadProject(key);
|
|
9770
9993
|
projectAt.set(key, project);
|
|
@@ -9781,7 +10004,7 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
9781
10004
|
for (const reference of listed)
|
|
9782
10005
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
9783
10006
|
if (projects.length === 0) {
|
|
9784
|
-
throw new Error(`${
|
|
10007
|
+
throw new Error(`${import_node_path10.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
9785
10008
|
}
|
|
9786
10009
|
return { listed, projects, projectAt };
|
|
9787
10010
|
}
|
|
@@ -9806,7 +10029,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9806
10029
|
const allTargets = projects.flatMap(nativeTargets);
|
|
9807
10030
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
9808
10031
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
9809
|
-
const container =
|
|
10032
|
+
const container = import_node_path10.default.basename(xcodeprojOrWorkspace);
|
|
9810
10033
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
9811
10034
|
if (named.length !== 1) {
|
|
9812
10035
|
throw new Error(
|
|
@@ -9818,14 +10041,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9818
10041
|
for (const ref of allTargets) {
|
|
9819
10042
|
const product = ref.project.object(str(ref.target.productReference));
|
|
9820
10043
|
const file = str(product?.path);
|
|
9821
|
-
if (file && !byProduct.has(
|
|
9822
|
-
byProduct.set(
|
|
10044
|
+
if (file && !byProduct.has(import_node_path10.default.basename(file)))
|
|
10045
|
+
byProduct.set(import_node_path10.default.basename(file), ref);
|
|
9823
10046
|
}
|
|
9824
10047
|
const proxied = (project, proxyId) => {
|
|
9825
10048
|
const proxy = project.object(proxyId);
|
|
9826
10049
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
9827
10050
|
const portal = str(proxy.containerPortal);
|
|
9828
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
10051
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path10.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
9829
10052
|
const remote = str(proxy.remoteGlobalIDString);
|
|
9830
10053
|
if (!owner || !remote) return void 0;
|
|
9831
10054
|
return nativeTargets(owner).find(
|
|
@@ -9846,7 +10069,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9846
10069
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
9847
10070
|
for (const buildFileId of list(phase.files)) {
|
|
9848
10071
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
9849
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
10072
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path10.default.basename(str(file.path) ?? "")) : void 0;
|
|
9850
10073
|
if (resolved) found.push(resolved);
|
|
9851
10074
|
}
|
|
9852
10075
|
}
|
|
@@ -9867,7 +10090,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9867
10090
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
9868
10091
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
9869
10092
|
TARGET_NAME: name2,
|
|
9870
|
-
PROJECT_NAME:
|
|
10093
|
+
PROJECT_NAME: import_node_path10.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
9871
10094
|
SRCROOT: ref.project.projectDir,
|
|
9872
10095
|
SOURCE_ROOT: ref.project.projectDir,
|
|
9873
10096
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -9898,8 +10121,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9898
10121
|
}
|
|
9899
10122
|
return value;
|
|
9900
10123
|
};
|
|
9901
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
9902
|
-
const sourceInfo = infoPlistFile ? import_plist2.default.parse(
|
|
10124
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path10.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
10125
|
+
const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs9.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
9903
10126
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
9904
10127
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
9905
10128
|
}
|
|
@@ -9917,12 +10140,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9917
10140
|
};
|
|
9918
10141
|
}
|
|
9919
10142
|
const localPackageDirs = [
|
|
9920
|
-
...listed.filter((reference) =>
|
|
10143
|
+
...listed.filter((reference) => import_node_fs9.default.existsSync(import_node_path10.default.join(reference, "Package.swift"))),
|
|
9921
10144
|
...projects.flatMap(
|
|
9922
10145
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
9923
10146
|
if (!isDict(entry)) return [];
|
|
9924
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
9925
|
-
return candidate &&
|
|
10147
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path10.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
10148
|
+
return candidate && import_node_fs9.default.existsSync(import_node_path10.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
9926
10149
|
})
|
|
9927
10150
|
)
|
|
9928
10151
|
];
|
|
@@ -9946,7 +10169,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9946
10169
|
product,
|
|
9947
10170
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
9948
10171
|
kind: "local",
|
|
9949
|
-
dir:
|
|
10172
|
+
dir: import_node_path10.default.resolve(
|
|
9950
10173
|
project.projectDir,
|
|
9951
10174
|
str(reference.relativePath) ?? ""
|
|
9952
10175
|
)
|
|
@@ -9968,8 +10191,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9968
10191
|
}
|
|
9969
10192
|
}
|
|
9970
10193
|
}
|
|
9971
|
-
const resolvedFile =
|
|
9972
|
-
workspace ??
|
|
10194
|
+
const resolvedFile = import_node_path10.default.join(
|
|
10195
|
+
workspace ?? import_node_path10.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
9973
10196
|
"xcshareddata",
|
|
9974
10197
|
"swiftpm",
|
|
9975
10198
|
"Package.resolved"
|
|
@@ -9979,13 +10202,13 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9979
10202
|
...module2,
|
|
9980
10203
|
rootDir: commonAncestor(
|
|
9981
10204
|
[
|
|
9982
|
-
workspace ?
|
|
10205
|
+
workspace ? import_node_path10.default.dirname(workspace) : app.project.projectDir,
|
|
9983
10206
|
...used.map((project) => project.projectDir),
|
|
9984
10207
|
...localPackageDirs,
|
|
9985
10208
|
...linkedProducts.flatMap(
|
|
9986
|
-
({ source }) => source.kind === "local" &&
|
|
10209
|
+
({ source }) => source.kind === "local" && import_node_fs9.default.existsSync(source.dir) ? [source.dir] : []
|
|
9987
10210
|
)
|
|
9988
|
-
].map((dir) =>
|
|
10211
|
+
].map((dir) => import_node_fs9.default.realpathSync(dir))
|
|
9989
10212
|
),
|
|
9990
10213
|
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
9991
10214
|
infoPlist: import_plist2.default.build(info),
|
|
@@ -9993,10 +10216,10 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
9993
10216
|
frameworks,
|
|
9994
10217
|
linkedProducts,
|
|
9995
10218
|
localPackageDirs: [
|
|
9996
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
10219
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs9.default.realpathSync(dir)))
|
|
9997
10220
|
].sort(),
|
|
9998
10221
|
binaryFrameworks: [...binaryFrameworks].sort(),
|
|
9999
|
-
packageResolved:
|
|
10222
|
+
packageResolved: import_node_fs9.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
10000
10223
|
appTargets: appTargetNames
|
|
10001
10224
|
};
|
|
10002
10225
|
}
|
|
@@ -10005,8 +10228,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
10005
10228
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
10006
10229
|
const result = {};
|
|
10007
10230
|
let config = {};
|
|
10008
|
-
const appJsonPath =
|
|
10009
|
-
const appJson =
|
|
10231
|
+
const appJsonPath = import_node_path11.default.join(projectRoot, "app.json");
|
|
10232
|
+
const appJson = import_node_fs10.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs10.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
10010
10233
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
10011
10234
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
10012
10235
|
));
|
|
@@ -10015,9 +10238,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
10015
10238
|
"app.config.ts",
|
|
10016
10239
|
"app.config.cjs",
|
|
10017
10240
|
"app.config.mjs"
|
|
10018
|
-
].some((name2) =>
|
|
10241
|
+
].some((name2) => import_node_fs10.default.existsSync(import_node_path11.default.join(projectRoot, name2)));
|
|
10019
10242
|
if (staticExpo || dynamicExpo) {
|
|
10020
|
-
const require2 = (0,
|
|
10243
|
+
const require2 = (0, import_node_module3.createRequire)(import_node_path11.default.join(projectRoot, "package.json"));
|
|
10021
10244
|
const configModule = require2("@expo/config");
|
|
10022
10245
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
10023
10246
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -10029,23 +10252,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
10029
10252
|
}
|
|
10030
10253
|
const ios = config.ios;
|
|
10031
10254
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
10032
|
-
const iosRoot =
|
|
10033
|
-
if (
|
|
10034
|
-
const projects =
|
|
10255
|
+
const iosRoot = import_node_path11.default.join(projectRoot, "ios");
|
|
10256
|
+
if (import_node_fs10.default.existsSync(iosRoot)) {
|
|
10257
|
+
const projects = import_node_fs10.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
10035
10258
|
if (projects.length > 1)
|
|
10036
10259
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
10037
10260
|
if (projects.length === 1) {
|
|
10038
|
-
const xcodeproj =
|
|
10261
|
+
const xcodeproj = import_node_path11.default.join(iosRoot, projects[0].name);
|
|
10039
10262
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
10040
10263
|
if (appTargets.length > 1)
|
|
10041
10264
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
10042
10265
|
if (appTargets.length === 1) {
|
|
10043
10266
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
10044
10267
|
const delegates = app.allSources.filter(
|
|
10045
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
10268
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path11.default.basename(file))
|
|
10046
10269
|
);
|
|
10047
10270
|
const defaultConfigured = delegates.some((file) => {
|
|
10048
|
-
const source =
|
|
10271
|
+
const source = import_node_fs10.default.readFileSync(file, "utf8").replace(
|
|
10049
10272
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
10050
10273
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
10051
10274
|
);
|
|
@@ -10073,15 +10296,15 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
10073
10296
|
});
|
|
10074
10297
|
if (defaultConfigured) {
|
|
10075
10298
|
const resources = app.resources.filter(
|
|
10076
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
10299
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path11.default.basename(file))
|
|
10077
10300
|
);
|
|
10078
10301
|
if (resources.length !== 1)
|
|
10079
10302
|
throw new Error(
|
|
10080
10303
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
10081
10304
|
);
|
|
10082
10305
|
config.ios = {
|
|
10083
|
-
googleServicesFile:
|
|
10084
|
-
|
|
10306
|
+
googleServicesFile: import_node_path11.default.relative(
|
|
10307
|
+
import_node_fs10.default.realpathSync(projectRoot),
|
|
10085
10308
|
resources[0]
|
|
10086
10309
|
)
|
|
10087
10310
|
};
|
|
@@ -10094,8 +10317,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
10094
10317
|
const native = config[platform];
|
|
10095
10318
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
10096
10319
|
try {
|
|
10097
|
-
const source =
|
|
10098
|
-
|
|
10320
|
+
const source = import_node_fs10.default.readFileSync(
|
|
10321
|
+
import_node_path11.default.resolve(projectRoot, native.googleServicesFile),
|
|
10099
10322
|
"utf8"
|
|
10100
10323
|
);
|
|
10101
10324
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -10300,7 +10523,7 @@ function withRNX(config) {
|
|
|
10300
10523
|
const configuredBundleUrl = "/index.bundle?platform=ios&dev=true&hot=true&minify=false";
|
|
10301
10524
|
const cfgServer = config.server;
|
|
10302
10525
|
const port = resolveMetroPort(cfgServer);
|
|
10303
|
-
const metroServerId = (0,
|
|
10526
|
+
const metroServerId = (0, import_node_crypto6.randomUUID)();
|
|
10304
10527
|
const bundleUrl = tagRnxBundleForPlugin(
|
|
10305
10528
|
configuredBundleUrl,
|
|
10306
10529
|
`http://localhost:${port}`,
|
|
@@ -10498,13 +10721,13 @@ function resolveMetroPort(server) {
|
|
|
10498
10721
|
var metro_plugin_default = withRNX;
|
|
10499
10722
|
|
|
10500
10723
|
// src/jump-to-source-babel.ts
|
|
10501
|
-
function normalizeSourcePath(
|
|
10502
|
-
const queryStart =
|
|
10503
|
-
const clean = queryStart >= 0 ?
|
|
10724
|
+
function normalizeSourcePath(path16) {
|
|
10725
|
+
const queryStart = path16.indexOf("?");
|
|
10726
|
+
const clean = queryStart >= 0 ? path16.slice(0, queryStart) : path16;
|
|
10504
10727
|
return clean.replace(/\\/g, "/");
|
|
10505
10728
|
}
|
|
10506
|
-
function matchesPath(
|
|
10507
|
-
return typeof matcher === "string" ?
|
|
10729
|
+
function matchesPath(path16, matcher) {
|
|
10730
|
+
return typeof matcher === "string" ? path16.includes(matcher) : matcher.test(path16);
|
|
10508
10731
|
}
|
|
10509
10732
|
function shouldStampFile(filename, options) {
|
|
10510
10733
|
const normalized = normalizeSourcePath(filename);
|
|
@@ -10537,11 +10760,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
10537
10760
|
return {
|
|
10538
10761
|
name: "sootsim-jump-to-source",
|
|
10539
10762
|
visitor: {
|
|
10540
|
-
JSXOpeningElement(
|
|
10763
|
+
JSXOpeningElement(path16, state) {
|
|
10541
10764
|
if (options.enabled === false) return;
|
|
10542
10765
|
const filename = state.file?.opts?.filename;
|
|
10543
10766
|
if (!filename || !shouldStampFile(filename, options)) return;
|
|
10544
|
-
const node =
|
|
10767
|
+
const node = path16.node;
|
|
10545
10768
|
const tagName = getJSXName(node.name);
|
|
10546
10769
|
if (!tagName || tagName === "Fragment" || tagName.endsWith(".Fragment")) return;
|
|
10547
10770
|
if (hasAttribute(node, attrName)) return;
|