peachsim 0.1.672 → 0.1.674
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/commands/kotlin.ts +1 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-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/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +257 -236
- 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/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 +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +445 -410
- package/dist-lib/swift-compile.cjs +21 -7
- package/dist-lib/swift-compile.mjs +21 -7
- 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.cjs +1 -1
- package/dist-lib/vite-swift.cjs +109 -88
- package/dist-lib/vite.cjs +1 -1
- package/kotlin/fixtures/kotlin-app-variants/Icons.kt +59 -0
- package/kotlin/toolchain.json +9 -2
- package/package.json +1 -1
- package/src/kotlin-app.ts +5 -1
- package/src/swift-compile.ts +31 -10
- package/src/swift-host.ts +2 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.674 | (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;
|
|
@@ -519,14 +519,14 @@ function sharedDesktopAuthAccounts(user) {
|
|
|
519
519
|
function getBaseDir() {
|
|
520
520
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
521
521
|
if (explicit?.trim()) {
|
|
522
|
-
return (0,
|
|
522
|
+
return (0, import_node_path7.dirname)((0, import_node_path7.resolve)(explicit));
|
|
523
523
|
}
|
|
524
524
|
return electronUserDataDir();
|
|
525
525
|
}
|
|
526
526
|
function getSharedDesktopAuthFilePath() {
|
|
527
527
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
528
|
-
if (explicit?.trim()) return (0,
|
|
529
|
-
return (0,
|
|
528
|
+
if (explicit?.trim()) return (0, import_node_path7.resolve)(explicit);
|
|
529
|
+
return (0, import_node_path7.join)(getBaseDir(), "desktop-auth.json");
|
|
530
530
|
}
|
|
531
531
|
function normalizeUser(input) {
|
|
532
532
|
if (!input || typeof input !== "object") return null;
|
|
@@ -590,12 +590,12 @@ function readSharedDesktopAuthSession() {
|
|
|
590
590
|
return null;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
var import_node_fs6,
|
|
593
|
+
var import_node_fs6, import_node_path7, SESSION_VERSION, SESSION_FILE_ENV, DEFAULT_ORIGIN;
|
|
594
594
|
var init_shared_session = __esm({
|
|
595
595
|
"src/auth/shared-session.ts"() {
|
|
596
596
|
"use strict";
|
|
597
597
|
import_node_fs6 = require("node:fs");
|
|
598
|
-
|
|
598
|
+
import_node_path7 = require("node:path");
|
|
599
599
|
init_home_paths();
|
|
600
600
|
SESSION_VERSION = 1;
|
|
601
601
|
SESSION_FILE_ENV = "SOOTSIM_SHARED_AUTH_FILE";
|
|
@@ -2400,8 +2400,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
const out = [];
|
|
2402
2402
|
for (const dir of dirs) {
|
|
2403
|
-
const
|
|
2404
|
-
if (!out.includes(
|
|
2403
|
+
const path17 = `${dir}/${filename}`;
|
|
2404
|
+
if (!out.includes(path17)) out.push(path17);
|
|
2405
2405
|
}
|
|
2406
2406
|
if (!out.includes(filename)) out.push(filename);
|
|
2407
2407
|
return out;
|
|
@@ -3353,13 +3353,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
3353
3353
|
return literals;
|
|
3354
3354
|
}
|
|
3355
3355
|
function normalizeFingerprintLiteral(literal) {
|
|
3356
|
-
const
|
|
3356
|
+
const path17 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
3357
3357
|
const nodeModulesMarker = "/node_modules/";
|
|
3358
|
-
const nodeModulesIndex =
|
|
3358
|
+
const nodeModulesIndex = path17.lastIndexOf(nodeModulesMarker);
|
|
3359
3359
|
if (nodeModulesIndex >= 0) {
|
|
3360
|
-
return `node_modules/${
|
|
3360
|
+
return `node_modules/${path17.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
3361
3361
|
}
|
|
3362
|
-
if ((
|
|
3362
|
+
if ((path17.startsWith("/") || /^[A-Za-z]:\//.test(path17) || path17.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path17)) {
|
|
3363
3363
|
return null;
|
|
3364
3364
|
}
|
|
3365
3365
|
return literal;
|
|
@@ -3597,10 +3597,10 @@ function templateAssignment(template, embeddings) {
|
|
|
3597
3597
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
3598
3598
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
3599
3599
|
const node = template.nodes[nodeIndex];
|
|
3600
|
-
const
|
|
3600
|
+
const path17 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
3601
3601
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
3602
|
-
if (existingPath !== void 0 && existingPath !==
|
|
3603
|
-
pathsByModuleId.set(moduleId,
|
|
3602
|
+
if (existingPath !== void 0 && existingPath !== path17) return null;
|
|
3603
|
+
pathsByModuleId.set(moduleId, path17);
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
return {
|
|
@@ -3762,14 +3762,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
3762
3762
|
const packageClaims = claimsByPackage.values().next().value;
|
|
3763
3763
|
if (!packageClaims) continue;
|
|
3764
3764
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
3765
|
-
const
|
|
3766
|
-
return
|
|
3765
|
+
const path17 = assignment2.pathsByModuleId.get(moduleId);
|
|
3766
|
+
return path17 !== void 0 && !path17.includes("/__rnx_inferred__/");
|
|
3767
3767
|
});
|
|
3768
3768
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
3769
3769
|
const routes = new Set(
|
|
3770
3770
|
preferredClaims.flatMap((assignment2) => {
|
|
3771
|
-
const
|
|
3772
|
-
return
|
|
3771
|
+
const path17 = assignment2.pathsByModuleId.get(moduleId);
|
|
3772
|
+
return path17 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path17)] : [];
|
|
3773
3773
|
})
|
|
3774
3774
|
);
|
|
3775
3775
|
if (routes.size !== 1) continue;
|
|
@@ -3968,7 +3968,7 @@ function detectFramework(deps) {
|
|
|
3968
3968
|
return "unknown";
|
|
3969
3969
|
}
|
|
3970
3970
|
function detectProject(dir) {
|
|
3971
|
-
const pkgPath = (0,
|
|
3971
|
+
const pkgPath = (0, import_node_path21.join)(dir, "package.json");
|
|
3972
3972
|
if (!(0, import_node_fs20.existsSync)(pkgPath)) return null;
|
|
3973
3973
|
const pkg = readProjectManifest(dir);
|
|
3974
3974
|
if (!pkg) return null;
|
|
@@ -3981,25 +3981,25 @@ function detectProject(dir) {
|
|
|
3981
3981
|
if (framework === "unknown") return null;
|
|
3982
3982
|
return {
|
|
3983
3983
|
dir,
|
|
3984
|
-
name: pkg.name || (0,
|
|
3984
|
+
name: pkg.name || (0, import_node_path21.basename)(dir),
|
|
3985
3985
|
framework,
|
|
3986
3986
|
// a config file is a config file whatever module system it declares. real
|
|
3987
3987
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
3988
3988
|
// has no bundler config" and sends the user to create a second one.
|
|
3989
3989
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
3990
|
-
(ext) => (0, import_node_fs20.existsSync)((0,
|
|
3990
|
+
(ext) => (0, import_node_fs20.existsSync)((0, import_node_path21.join)(dir, `vite.config.${ext}`))
|
|
3991
3991
|
),
|
|
3992
3992
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
3993
|
-
(ext) => (0, import_node_fs20.existsSync)((0,
|
|
3993
|
+
(ext) => (0, import_node_fs20.existsSync)((0, import_node_path21.join)(dir, `metro.config.${ext}`))
|
|
3994
3994
|
),
|
|
3995
3995
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
3996
3996
|
};
|
|
3997
3997
|
}
|
|
3998
|
-
function readProjectMetadata(
|
|
3998
|
+
function readProjectMetadata(path17) {
|
|
3999
3999
|
try {
|
|
4000
|
-
const info = (0, import_node_fs20.lstatSync)(
|
|
4000
|
+
const info = (0, import_node_fs20.lstatSync)(path17);
|
|
4001
4001
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
4002
|
-
return (0, import_node_fs20.readFileSync)(
|
|
4002
|
+
return (0, import_node_fs20.readFileSync)(path17, "utf8");
|
|
4003
4003
|
} catch {
|
|
4004
4004
|
return null;
|
|
4005
4005
|
}
|
|
@@ -4008,8 +4008,8 @@ function metadataValue(value, key) {
|
|
|
4008
4008
|
if (!value || typeof value !== "object") return void 0;
|
|
4009
4009
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
4010
4010
|
}
|
|
4011
|
-
function readProjectJson(
|
|
4012
|
-
const text = readProjectMetadata(
|
|
4011
|
+
function readProjectJson(path17) {
|
|
4012
|
+
const text = readProjectMetadata(path17);
|
|
4013
4013
|
if (text === null) return null;
|
|
4014
4014
|
try {
|
|
4015
4015
|
const value = JSON.parse(text);
|
|
@@ -4019,7 +4019,7 @@ function readProjectJson(path16) {
|
|
|
4019
4019
|
}
|
|
4020
4020
|
}
|
|
4021
4021
|
function readProjectManifest(dir) {
|
|
4022
|
-
const parsed = readProjectJson((0,
|
|
4022
|
+
const parsed = readProjectJson((0, import_node_path21.join)(dir, "package.json"));
|
|
4023
4023
|
if (!parsed || typeof parsed !== "object") return null;
|
|
4024
4024
|
const record = (value) => {
|
|
4025
4025
|
if (!value || typeof value !== "object") return {};
|
|
@@ -4036,12 +4036,12 @@ function readProjectManifest(dir) {
|
|
|
4036
4036
|
devDependencies: record(metadataValue(parsed, "devDependencies"))
|
|
4037
4037
|
};
|
|
4038
4038
|
}
|
|
4039
|
-
var import_node_fs20,
|
|
4039
|
+
var import_node_fs20, import_node_path21, import_json5, import_yaml, CONFIG_EXTENSIONS;
|
|
4040
4040
|
var init_detect = __esm({
|
|
4041
4041
|
"cli/commands/detect.ts"() {
|
|
4042
4042
|
"use strict";
|
|
4043
4043
|
import_node_fs20 = require("node:fs");
|
|
4044
|
-
|
|
4044
|
+
import_node_path21 = require("node:path");
|
|
4045
4045
|
import_json5 = __toESM(require("json5"), 1);
|
|
4046
4046
|
import_yaml = require("yaml");
|
|
4047
4047
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -4078,8 +4078,8 @@ function resolveCloudOrigin(value) {
|
|
|
4078
4078
|
return normalizeCloudOrigin(source);
|
|
4079
4079
|
}
|
|
4080
4080
|
function readImmutableBundleSource(bundlePath) {
|
|
4081
|
-
const filepath = (0,
|
|
4082
|
-
if ((0,
|
|
4081
|
+
const filepath = (0, import_node_path22.resolve)(bundlePath);
|
|
4082
|
+
if ((0, import_node_path22.extname)(filepath) !== ".js") {
|
|
4083
4083
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
4084
4084
|
}
|
|
4085
4085
|
const descriptor = (0, import_node_fs21.openSync)(filepath, "r");
|
|
@@ -4154,9 +4154,9 @@ async function loadBundleSource(bundleInput) {
|
|
|
4154
4154
|
return readImmutableBundleSource(bundleInput);
|
|
4155
4155
|
}
|
|
4156
4156
|
function listMetroAssetDest(assetsPath) {
|
|
4157
|
-
const directory = (0,
|
|
4157
|
+
const directory = (0, import_node_path22.resolve)(assetsPath);
|
|
4158
4158
|
if (!(0, import_node_fs21.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
4159
|
-
const skipNested = (0, import_node_fs21.existsSync)((0,
|
|
4159
|
+
const skipNested = (0, import_node_fs21.existsSync)((0, import_node_path22.join)(directory, "package.json"));
|
|
4160
4160
|
const files = [];
|
|
4161
4161
|
let truncated = false;
|
|
4162
4162
|
const walk = (dir, prefix) => {
|
|
@@ -4174,7 +4174,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
4174
4174
|
if (entry.isDirectory()) {
|
|
4175
4175
|
if (entry.name === ".git") continue;
|
|
4176
4176
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
4177
|
-
walk((0,
|
|
4177
|
+
walk((0, import_node_path22.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
4178
4178
|
} else if (entry.isFile()) {
|
|
4179
4179
|
files.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
4180
4180
|
}
|
|
@@ -4209,7 +4209,7 @@ function distinctByContent(directory, options) {
|
|
|
4209
4209
|
for (const relative2 of options) {
|
|
4210
4210
|
let bytes;
|
|
4211
4211
|
try {
|
|
4212
|
-
bytes = (0, import_node_fs21.readFileSync)((0,
|
|
4212
|
+
bytes = (0, import_node_fs21.readFileSync)((0, import_node_path22.join)(directory, relative2));
|
|
4213
4213
|
} catch {
|
|
4214
4214
|
continue;
|
|
4215
4215
|
}
|
|
@@ -4241,7 +4241,7 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
4241
4241
|
let bytes;
|
|
4242
4242
|
try {
|
|
4243
4243
|
bytes = combination.map(
|
|
4244
|
-
(relative2) => (0, import_node_fs21.readFileSync)((0,
|
|
4244
|
+
(relative2) => (0, import_node_fs21.readFileSync)((0, import_node_path22.join)(listing.directory, relative2))
|
|
4245
4245
|
);
|
|
4246
4246
|
} catch {
|
|
4247
4247
|
continue;
|
|
@@ -4267,26 +4267,26 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
4267
4267
|
}
|
|
4268
4268
|
function unverifiedFileKey(dest) {
|
|
4269
4269
|
return dest.placements.filter((placement) => !placement.verified).flatMap(
|
|
4270
|
-
(placement) => [...placement.files.values()].map((relative2) => (0,
|
|
4270
|
+
(placement) => [...placement.files.values()].map((relative2) => (0, import_node_path22.join)(dest.directory, relative2))
|
|
4271
4271
|
).sort().join("\n");
|
|
4272
4272
|
}
|
|
4273
4273
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
4274
|
-
const bundleDirectory = (0,
|
|
4274
|
+
const bundleDirectory = (0, import_node_path22.dirname)((0, import_node_path22.resolve)(bundlePath));
|
|
4275
4275
|
const candidates = [
|
|
4276
|
-
(0,
|
|
4276
|
+
(0, import_node_path22.join)(bundleDirectory, "assets"),
|
|
4277
4277
|
bundleDirectory,
|
|
4278
|
-
(0,
|
|
4278
|
+
(0, import_node_path22.resolve)(bundleDirectory, "..", "assets")
|
|
4279
4279
|
];
|
|
4280
4280
|
const cwd = process.cwd();
|
|
4281
4281
|
let projectDirectory = null;
|
|
4282
4282
|
for (const start of [bundleDirectory, cwd]) {
|
|
4283
|
-
let directory = (0,
|
|
4283
|
+
let directory = (0, import_node_path22.resolve)(start);
|
|
4284
4284
|
while (true) {
|
|
4285
4285
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
4286
4286
|
projectDirectory = directory;
|
|
4287
4287
|
break;
|
|
4288
4288
|
}
|
|
4289
|
-
const parent = (0,
|
|
4289
|
+
const parent = (0, import_node_path22.dirname)(directory);
|
|
4290
4290
|
if (parent === directory) break;
|
|
4291
4291
|
directory = parent;
|
|
4292
4292
|
}
|
|
@@ -4294,11 +4294,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
4294
4294
|
}
|
|
4295
4295
|
if (projectDirectory) {
|
|
4296
4296
|
candidates.push(
|
|
4297
|
-
(0,
|
|
4298
|
-
(0,
|
|
4299
|
-
(0,
|
|
4300
|
-
(0,
|
|
4301
|
-
(0,
|
|
4297
|
+
(0, import_node_path22.join)(projectDirectory, "assets"),
|
|
4298
|
+
(0, import_node_path22.join)(projectDirectory, "dist"),
|
|
4299
|
+
(0, import_node_path22.join)(projectDirectory, "dist", "assets"),
|
|
4300
|
+
(0, import_node_path22.join)(projectDirectory, "build"),
|
|
4301
|
+
(0, import_node_path22.join)(projectDirectory, "build", "assets")
|
|
4302
4302
|
);
|
|
4303
4303
|
}
|
|
4304
4304
|
const searched = [];
|
|
@@ -4306,7 +4306,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
4306
4306
|
const stale = [];
|
|
4307
4307
|
let truncated = false;
|
|
4308
4308
|
for (const candidate of candidates) {
|
|
4309
|
-
const directory = (0,
|
|
4309
|
+
const directory = (0, import_node_path22.resolve)(candidate);
|
|
4310
4310
|
if (searched.includes(directory)) continue;
|
|
4311
4311
|
searched.push(directory);
|
|
4312
4312
|
const listing = listMetroAssetDest(directory);
|
|
@@ -4412,7 +4412,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
4412
4412
|
);
|
|
4413
4413
|
}
|
|
4414
4414
|
const relative2 = placement?.files.get(variant.scale);
|
|
4415
|
-
if (relative2 && dest) return (0, import_node_fs21.readFileSync)((0,
|
|
4415
|
+
if (relative2 && dest) return (0, import_node_fs21.readFileSync)((0, import_node_path22.join)(dest.directory, relative2));
|
|
4416
4416
|
if (placement && placement.files.size > 0) return null;
|
|
4417
4417
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
4418
4418
|
throw new Error(
|
|
@@ -4441,7 +4441,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
4441
4441
|
);
|
|
4442
4442
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
4443
4443
|
throw new Error(
|
|
4444
|
-
`${command} could not read ${(0,
|
|
4444
|
+
`${command} could not read ${(0, import_node_path22.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
4445
4445
|
);
|
|
4446
4446
|
});
|
|
4447
4447
|
return {
|
|
@@ -4587,13 +4587,13 @@ async function createCloudBox(options) {
|
|
|
4587
4587
|
warnings: artifact.warnings
|
|
4588
4588
|
};
|
|
4589
4589
|
}
|
|
4590
|
-
var import_node_crypto10, import_node_fs21,
|
|
4590
|
+
var import_node_crypto10, import_node_fs21, import_node_path22, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
|
|
4591
4591
|
var init_cloud_client = __esm({
|
|
4592
4592
|
"cli/cloud-client.ts"() {
|
|
4593
4593
|
"use strict";
|
|
4594
4594
|
import_node_crypto10 = require("node:crypto");
|
|
4595
4595
|
import_node_fs21 = require("node:fs");
|
|
4596
|
-
|
|
4596
|
+
import_node_path22 = require("node:path");
|
|
4597
4597
|
init_metroAssetArtifact();
|
|
4598
4598
|
init_metroCloudArtifact();
|
|
4599
4599
|
init_metro_fingerprint_registry_client();
|
|
@@ -5037,9 +5037,9 @@ function safeChildPlistName(value) {
|
|
|
5037
5037
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
5038
5038
|
};
|
|
5039
5039
|
}
|
|
5040
|
-
async function readableSettingsBundle(
|
|
5040
|
+
async function readableSettingsBundle(path17) {
|
|
5041
5041
|
try {
|
|
5042
|
-
const root = await (0, import_promises.stat)((0, import_node_path.join)(
|
|
5042
|
+
const root = await (0, import_promises.stat)((0, import_node_path.join)(path17, "Root.plist"));
|
|
5043
5043
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
5044
5044
|
} catch {
|
|
5045
5045
|
return false;
|
|
@@ -5084,11 +5084,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
5084
5084
|
return null;
|
|
5085
5085
|
}
|
|
5086
5086
|
}
|
|
5087
|
-
async function parsePlistRecord(
|
|
5087
|
+
async function parsePlistRecord(path17) {
|
|
5088
5088
|
try {
|
|
5089
|
-
const metadata = await (0, import_promises.stat)(
|
|
5089
|
+
const metadata = await (0, import_promises.stat)(path17);
|
|
5090
5090
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
5091
|
-
const source = await (0, import_promises.readFile)(
|
|
5091
|
+
const source = await (0, import_promises.readFile)(path17, "utf8");
|
|
5092
5092
|
const parsed = parsePlistSource(source);
|
|
5093
5093
|
return isRecord2(parsed) ? parsed : null;
|
|
5094
5094
|
} catch {
|
|
@@ -5350,7 +5350,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
5350
5350
|
return null;
|
|
5351
5351
|
}
|
|
5352
5352
|
}
|
|
5353
|
-
function httpGet(hostname, port,
|
|
5353
|
+
function httpGet(hostname, port, path17, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
5354
5354
|
return new Promise((resolve5) => {
|
|
5355
5355
|
let settled = false;
|
|
5356
5356
|
let killing = false;
|
|
@@ -5359,7 +5359,7 @@ function httpGet(hostname, port, path16, method = "GET", timeout = TIMEOUT_MS, h
|
|
|
5359
5359
|
settled = true;
|
|
5360
5360
|
resolve5(value);
|
|
5361
5361
|
};
|
|
5362
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
5362
|
+
const req = import_http.default.request({ hostname, port, path: path17, method, headers }, (res) => {
|
|
5363
5363
|
let body = "";
|
|
5364
5364
|
res.on("data", (c) => body += c.toString());
|
|
5365
5365
|
const contentType = (() => {
|
|
@@ -6040,8 +6040,8 @@ var import_node_child_process4 = require("node:child_process");
|
|
|
6040
6040
|
var import_node_crypto5 = require("node:crypto");
|
|
6041
6041
|
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
6042
6042
|
var import_node_module = require("node:module");
|
|
6043
|
-
var
|
|
6044
|
-
var
|
|
6043
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
6044
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
6045
6045
|
var import_node_util3 = require("node:util");
|
|
6046
6046
|
|
|
6047
6047
|
// cli/internal-child.ts
|
|
@@ -6053,8 +6053,18 @@ init_backend_origin();
|
|
|
6053
6053
|
// src/swift-host.ts
|
|
6054
6054
|
var import_node_crypto4 = require("node:crypto");
|
|
6055
6055
|
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
6056
|
-
var
|
|
6057
|
-
var
|
|
6056
|
+
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
6057
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
6058
|
+
|
|
6059
|
+
// ../../src/compile/swiftToolchain.ts
|
|
6060
|
+
var import_node_os2 = __toESM(require("node:os"), 1);
|
|
6061
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
6062
|
+
function swiftToolchainBin(release) {
|
|
6063
|
+
return process.platform === "darwin" ? import_node_path6.default.join(
|
|
6064
|
+
import_node_os2.default.homedir(),
|
|
6065
|
+
`Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`
|
|
6066
|
+
) : import_node_path6.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS ?? "/opt/swift", release, "usr/bin");
|
|
6067
|
+
}
|
|
6058
6068
|
|
|
6059
6069
|
// ../sootsim-swift/src/bundleAssets.ts
|
|
6060
6070
|
var import_svgpath = __toESM(require("svgpath"), 1);
|
|
@@ -6088,8 +6098,8 @@ function pickImagesetFile(images) {
|
|
|
6088
6098
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
6089
6099
|
};
|
|
6090
6100
|
}
|
|
6091
|
-
function flatScale(
|
|
6092
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
6101
|
+
function flatScale(path17) {
|
|
6102
|
+
const match = /@([23])x\.[^./]+$/.exec(path17);
|
|
6093
6103
|
return match ? Number(match[1]) : 1;
|
|
6094
6104
|
}
|
|
6095
6105
|
function providesNamespace(text) {
|
|
@@ -6116,13 +6126,13 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
6116
6126
|
}
|
|
6117
6127
|
return segments.join("/");
|
|
6118
6128
|
}
|
|
6119
|
-
function isFlatResourceImage(
|
|
6120
|
-
return
|
|
6129
|
+
function isFlatResourceImage(path17) {
|
|
6130
|
+
return path17.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path17));
|
|
6121
6131
|
}
|
|
6122
6132
|
function enumerateBundleImages(paths, readText) {
|
|
6123
6133
|
const table = [];
|
|
6124
6134
|
const seen = /* @__PURE__ */ new Set();
|
|
6125
|
-
const catalogs = paths.filter((
|
|
6135
|
+
const catalogs = paths.filter((path17) => baseOf(path17) === "Contents.json");
|
|
6126
6136
|
for (const contentsPath of catalogs) {
|
|
6127
6137
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
6128
6138
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -6143,12 +6153,12 @@ function enumerateBundleImages(paths, readText) {
|
|
|
6143
6153
|
seen.add(name2);
|
|
6144
6154
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
6145
6155
|
}
|
|
6146
|
-
for (const
|
|
6147
|
-
if (!isFlatResourceImage(
|
|
6148
|
-
const name2 = baseOf(
|
|
6156
|
+
for (const path17 of paths) {
|
|
6157
|
+
if (!isFlatResourceImage(path17)) continue;
|
|
6158
|
+
const name2 = baseOf(path17).slice(0, -extOf(path17).length);
|
|
6149
6159
|
if (name2 === "" || seen.has(name2)) continue;
|
|
6150
6160
|
seen.add(name2);
|
|
6151
|
-
table.push({ name: name2, file:
|
|
6161
|
+
table.push({ name: name2, file: path17, scale: flatScale(path17) });
|
|
6152
6162
|
}
|
|
6153
6163
|
return table;
|
|
6154
6164
|
}
|
|
@@ -6177,7 +6187,7 @@ function colorsetValue(color) {
|
|
|
6177
6187
|
}
|
|
6178
6188
|
function enumerateBundleColors(paths, readText) {
|
|
6179
6189
|
const table = {};
|
|
6180
|
-
for (const contentsPath of paths.filter((
|
|
6190
|
+
for (const contentsPath of paths.filter((path17) => baseOf(path17) === "Contents.json")) {
|
|
6181
6191
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
6182
6192
|
if (name2 === null || name2 in table) continue;
|
|
6183
6193
|
let colors;
|
|
@@ -6242,8 +6252,8 @@ function axisExtremes(points) {
|
|
|
6242
6252
|
function pathBounds(d) {
|
|
6243
6253
|
const xs = [];
|
|
6244
6254
|
const ys = [];
|
|
6245
|
-
for (const
|
|
6246
|
-
(0, import_svgpath.default)(
|
|
6255
|
+
for (const path17 of d)
|
|
6256
|
+
(0, import_svgpath.default)(path17).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
6247
6257
|
const [command, ...args] = segment;
|
|
6248
6258
|
if (command === "M" || command === "L") {
|
|
6249
6259
|
xs.push(Number(args[0]));
|
|
@@ -6270,7 +6280,7 @@ function guide(svg, id, axis) {
|
|
|
6270
6280
|
}
|
|
6271
6281
|
function enumerateBundleSymbols(paths, readText) {
|
|
6272
6282
|
const table = {};
|
|
6273
|
-
for (const contentsPath of paths.filter((
|
|
6283
|
+
for (const contentsPath of paths.filter((path17) => baseOf(path17) === "Contents.json")) {
|
|
6274
6284
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
6275
6285
|
if (name2 === null || name2 in table) continue;
|
|
6276
6286
|
let symbols;
|
|
@@ -6303,8 +6313,8 @@ function enumerateBundleSymbols(paths, readText) {
|
|
|
6303
6313
|
viewBox: "0 0 24 24",
|
|
6304
6314
|
advance,
|
|
6305
6315
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
6306
|
-
layers: d.map((
|
|
6307
|
-
d: (0, import_svgpath.default)(
|
|
6316
|
+
layers: d.map((path17) => ({
|
|
6317
|
+
d: (0, import_svgpath.default)(path17).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
6308
6318
|
}))
|
|
6309
6319
|
};
|
|
6310
6320
|
}
|
|
@@ -6314,7 +6324,7 @@ function enumerateBundleJson(paths) {
|
|
|
6314
6324
|
const found = [];
|
|
6315
6325
|
const seen = /* @__PURE__ */ new Set();
|
|
6316
6326
|
const ordered = [...paths].filter(
|
|
6317
|
-
(
|
|
6327
|
+
(path17) => path17.split("/").includes("Resources") && path17.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path17) === ".json" || extOf(path17) === ".xcstrings")
|
|
6318
6328
|
).sort((a, b) => {
|
|
6319
6329
|
const aDepth = a.split("/").length;
|
|
6320
6330
|
const bDepth = b.split("/").length;
|
|
@@ -6337,15 +6347,15 @@ init_backend_origin();
|
|
|
6337
6347
|
var import_node_child_process3 = require("node:child_process");
|
|
6338
6348
|
var import_node_crypto3 = require("node:crypto");
|
|
6339
6349
|
var import_node_fs8 = require("node:fs");
|
|
6340
|
-
var
|
|
6341
|
-
var
|
|
6350
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
6351
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
6342
6352
|
var import_node_util2 = require("node:util");
|
|
6343
6353
|
|
|
6344
6354
|
// src/swift-icu.ts
|
|
6345
6355
|
var import_node_child_process2 = require("node:child_process");
|
|
6346
6356
|
var import_node_crypto2 = require("node:crypto");
|
|
6347
6357
|
var import_node_fs7 = require("node:fs");
|
|
6348
|
-
var
|
|
6358
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
6349
6359
|
var import_node_util = require("node:util");
|
|
6350
6360
|
var import_node_zlib = require("node:zlib");
|
|
6351
6361
|
var run = (0, import_node_util.promisify)(import_node_child_process2.execFile);
|
|
@@ -6373,7 +6383,7 @@ function swiftIcuAsset(toolchainBin, release) {
|
|
|
6373
6383
|
});
|
|
6374
6384
|
}
|
|
6375
6385
|
async function load(toolchainBin, release) {
|
|
6376
|
-
const { stdout } = await run(
|
|
6386
|
+
const { stdout } = await run(import_node_path8.default.join(toolchainBin, "swift"), [
|
|
6377
6387
|
"sdk",
|
|
6378
6388
|
"configure",
|
|
6379
6389
|
"--show-configuration",
|
|
@@ -6383,7 +6393,7 @@ async function load(toolchainBin, release) {
|
|
|
6383
6393
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
6384
6394
|
if (!resources) throw new Error(`swift-icu: ${release}_wasm names no static resources`);
|
|
6385
6395
|
return Buffer.from(
|
|
6386
|
-
icuSegment(archiveMember((0, import_node_fs7.readFileSync)(
|
|
6396
|
+
icuSegment(archiveMember((0, import_node_fs7.readFileSync)(import_node_path8.default.join(resources, ARCHIVE)), MEMBER))
|
|
6387
6397
|
);
|
|
6388
6398
|
}
|
|
6389
6399
|
function archiveMember(archive, name2) {
|
|
@@ -6502,7 +6512,7 @@ function swiftPackagePartition(manifest) {
|
|
|
6502
6512
|
// src/swift-compile.ts
|
|
6503
6513
|
var run2 = (0, import_node_util2.promisify)(import_node_child_process3.execFile);
|
|
6504
6514
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
6505
|
-
var cores =
|
|
6515
|
+
var cores = import_node_os3.default.availableParallelism();
|
|
6506
6516
|
var BUILD_ENV = { ...process.env, BINARYEN_CORES: String(Math.min(4, cores)) };
|
|
6507
6517
|
var BUILD_JOBS = String(Math.max(1, Math.floor(cores / 2)));
|
|
6508
6518
|
function swiftModuleInputFiles(root) {
|
|
@@ -6512,7 +6522,7 @@ function swiftModuleInputFiles(root) {
|
|
|
6512
6522
|
"toolchain.json"
|
|
6513
6523
|
];
|
|
6514
6524
|
const walk = (dir) => {
|
|
6515
|
-
for (const entry of (0, import_node_fs8.readdirSync)(
|
|
6525
|
+
for (const entry of (0, import_node_fs8.readdirSync)(import_node_path9.default.join(root, dir), { withFileTypes: true })) {
|
|
6516
6526
|
const relative2 = `${dir}/${entry.name}`;
|
|
6517
6527
|
if (entry.isDirectory()) walk(relative2);
|
|
6518
6528
|
else if (/\.(swift|c|h)$/.test(entry.name)) files.push(relative2);
|
|
@@ -6522,16 +6532,16 @@ function swiftModuleInputFiles(root) {
|
|
|
6522
6532
|
return files.sort();
|
|
6523
6533
|
}
|
|
6524
6534
|
async function ensureMacroPlugins(moduleRoot, toolchainBin) {
|
|
6525
|
-
const dir =
|
|
6535
|
+
const dir = import_node_path9.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
6526
6536
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
6527
6537
|
const plugins = [
|
|
6528
6538
|
{
|
|
6529
|
-
library:
|
|
6530
|
-
source:
|
|
6539
|
+
library: import_node_path9.default.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
6540
|
+
source: import_node_path9.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")
|
|
6531
6541
|
},
|
|
6532
6542
|
{
|
|
6533
|
-
library:
|
|
6534
|
-
source:
|
|
6543
|
+
library: import_node_path9.default.join(dir, `libFoundationMacros.${ext}`),
|
|
6544
|
+
source: import_node_path9.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift")
|
|
6535
6545
|
}
|
|
6536
6546
|
];
|
|
6537
6547
|
const stale = plugins.some(
|
|
@@ -6539,7 +6549,7 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin) {
|
|
|
6539
6549
|
);
|
|
6540
6550
|
if (stale) {
|
|
6541
6551
|
await run2("sh", [
|
|
6542
|
-
|
|
6552
|
+
import_node_path9.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
6543
6553
|
toolchainBin,
|
|
6544
6554
|
plugins[0].library
|
|
6545
6555
|
]);
|
|
@@ -6551,7 +6561,7 @@ function linkedModuleDigest(root) {
|
|
|
6551
6561
|
const files = swiftModuleInputFiles(root);
|
|
6552
6562
|
const stampHash = (0, import_node_crypto3.createHash)("sha256");
|
|
6553
6563
|
for (const file of files) {
|
|
6554
|
-
const stat2 = (0, import_node_fs8.statSync)(
|
|
6564
|
+
const stat2 = (0, import_node_fs8.statSync)(import_node_path9.default.join(root, file), { bigint: true });
|
|
6555
6565
|
stampHash.update(file);
|
|
6556
6566
|
stampHash.update(
|
|
6557
6567
|
`${stat2.dev}:${stat2.ino}:${stat2.size}:${stat2.mtimeNs}:${stat2.ctimeNs}
|
|
@@ -6565,7 +6575,7 @@ function linkedModuleDigest(root) {
|
|
|
6565
6575
|
for (const file of files) {
|
|
6566
6576
|
hash.update((0, import_node_crypto3.createHash)("sha256").update(file).digest());
|
|
6567
6577
|
hash.update(
|
|
6568
|
-
(0, import_node_crypto3.createHash)("sha256").update((0, import_node_fs8.readFileSync)(
|
|
6578
|
+
(0, import_node_crypto3.createHash)("sha256").update((0, import_node_fs8.readFileSync)(import_node_path9.default.join(root, file))).digest()
|
|
6569
6579
|
);
|
|
6570
6580
|
}
|
|
6571
6581
|
const digest = hash.digest();
|
|
@@ -6586,7 +6596,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
6586
6596
|
...input,
|
|
6587
6597
|
files: {
|
|
6588
6598
|
...input.files,
|
|
6589
|
-
[
|
|
6599
|
+
[import_node_path9.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
6590
6600
|
},
|
|
6591
6601
|
oneModule: true
|
|
6592
6602
|
};
|
|
@@ -6615,7 +6625,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
|
|
|
6615
6625
|
var MULTI_MANIFEST_VERSION = 6;
|
|
6616
6626
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
6617
6627
|
const hash = (0, import_node_crypto3.createHash)("sha256");
|
|
6618
|
-
hash.update(`swift-compile/
|
|
6628
|
+
hash.update(`swift-compile/v7
|
|
6619
6629
|
${release}
|
|
6620
6630
|
`);
|
|
6621
6631
|
if (input.oneModule) hash.update("one-module\n");
|
|
@@ -6702,7 +6712,7 @@ function syncSwiftTree(base, files) {
|
|
|
6702
6712
|
(0, import_node_fs8.mkdirSync)(base, { recursive: true });
|
|
6703
6713
|
const walk = (dir) => {
|
|
6704
6714
|
for (const entry of (0, import_node_fs8.readdirSync)(dir, { withFileTypes: true })) {
|
|
6705
|
-
const full =
|
|
6715
|
+
const full = import_node_path9.default.join(dir, entry.name);
|
|
6706
6716
|
if (dir === base && entry.name === ".build") continue;
|
|
6707
6717
|
if (entry.isDirectory()) walk(full);
|
|
6708
6718
|
else if (!files.has(full)) (0, import_node_fs8.rmSync)(full, { force: true });
|
|
@@ -6711,7 +6721,7 @@ function syncSwiftTree(base, files) {
|
|
|
6711
6721
|
walk(base);
|
|
6712
6722
|
for (const [full, contents] of files) {
|
|
6713
6723
|
if ((0, import_node_fs8.existsSync)(full) && (0, import_node_fs8.readFileSync)(full, "utf8") === contents) continue;
|
|
6714
|
-
(0, import_node_fs8.mkdirSync)(
|
|
6724
|
+
(0, import_node_fs8.mkdirSync)(import_node_path9.default.dirname(full), { recursive: true });
|
|
6715
6725
|
(0, import_node_fs8.writeFileSync)(full, contents, "utf8");
|
|
6716
6726
|
}
|
|
6717
6727
|
}
|
|
@@ -6733,6 +6743,17 @@ function swiftSourceAsIOS(source) {
|
|
|
6733
6743
|
let copied = 0;
|
|
6734
6744
|
for (const at of tokens) {
|
|
6735
6745
|
const rest = conditioned.slice(at, at + 400);
|
|
6746
|
+
const imported = /^import\s+CoreImage\.CIFilterBuiltins\b/.exec(rest);
|
|
6747
|
+
if (imported) {
|
|
6748
|
+
out += conditioned.slice(copied, at) + "import CoreImage".padEnd(imported[0].length);
|
|
6749
|
+
copied = at + imported[0].length;
|
|
6750
|
+
continue;
|
|
6751
|
+
}
|
|
6752
|
+
if (/^NSClassFromString\b/.test(rest)) {
|
|
6753
|
+
out += conditioned.slice(copied, at) + "_peachClassFromString";
|
|
6754
|
+
copied = at + "NSClassFromString".length;
|
|
6755
|
+
continue;
|
|
6756
|
+
}
|
|
6736
6757
|
if (rest.startsWith("class")) {
|
|
6737
6758
|
const modifiers = conditioned.slice(conditioned.lastIndexOf("\n", at - 1) + 1, at);
|
|
6738
6759
|
if (DELEGATE_CLASS.test(rest) && !/\b(?:final|open)\b/.test(modifiers)) {
|
|
@@ -6833,12 +6854,15 @@ function swiftCodeScan(source) {
|
|
|
6833
6854
|
if (top.parens === 0 && stack.length > 1) stack.pop();
|
|
6834
6855
|
else top.parens--;
|
|
6835
6856
|
i++;
|
|
6836
|
-
} else if (source.startsWith("class", i) && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + 5] ?? "")) {
|
|
6837
|
-
tokens.push(i);
|
|
6838
|
-
i += 5;
|
|
6839
6857
|
} else {
|
|
6840
|
-
|
|
6841
|
-
i
|
|
6858
|
+
const keyword = source.startsWith("class", i) ? "class" : source.startsWith("import", i) ? "import" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : null;
|
|
6859
|
+
if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
|
|
6860
|
+
tokens.push(i);
|
|
6861
|
+
i += keyword.length;
|
|
6862
|
+
} else {
|
|
6863
|
+
if (char === "@") tokens.push(i);
|
|
6864
|
+
i++;
|
|
6865
|
+
}
|
|
6842
6866
|
}
|
|
6843
6867
|
}
|
|
6844
6868
|
return { lineStarts: starts, tokens };
|
|
@@ -6853,10 +6877,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
6853
6877
|
if (targets.length === 0) {
|
|
6854
6878
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
6855
6879
|
if (file === "Package.swift") continue;
|
|
6856
|
-
files.set(
|
|
6880
|
+
files.set(import_node_path9.default.join(layout.sources, file), compiledSource(file, contents));
|
|
6857
6881
|
}
|
|
6858
6882
|
let manifest = (0, import_node_fs8.readFileSync)(
|
|
6859
|
-
|
|
6883
|
+
import_node_path9.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
6860
6884
|
"utf8"
|
|
6861
6885
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
6862
6886
|
if (input.oneModule) {
|
|
@@ -6870,16 +6894,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
6870
6894
|
manifest = manifest.replace(product, `${product}
|
|
6871
6895
|
${ONE_PRODUCT},`).replace(flags, `${flags}${ONE_IMPLICIT_FLAGS}`);
|
|
6872
6896
|
}
|
|
6873
|
-
files.set(
|
|
6897
|
+
files.set(import_node_path9.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
6874
6898
|
} else {
|
|
6875
6899
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
6876
6900
|
if (file === "Package.swift") continue;
|
|
6877
|
-
files.set(
|
|
6901
|
+
files.set(import_node_path9.default.join(layout.root, file), compiledSource(file, contents));
|
|
6878
6902
|
}
|
|
6879
6903
|
for (const target of targets) {
|
|
6880
6904
|
if (!target.resources) continue;
|
|
6881
6905
|
files.set(
|
|
6882
|
-
|
|
6906
|
+
import_node_path9.default.join(layout.root, target.path, "ResourceBundleAccessor.generated.swift"),
|
|
6883
6907
|
[
|
|
6884
6908
|
"import Foundation",
|
|
6885
6909
|
"",
|
|
@@ -6891,7 +6915,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
6891
6915
|
);
|
|
6892
6916
|
}
|
|
6893
6917
|
files.set(
|
|
6894
|
-
|
|
6918
|
+
import_node_path9.default.join(layout.root, "Package.swift"),
|
|
6895
6919
|
emitSwiftPackageManifest({
|
|
6896
6920
|
targets,
|
|
6897
6921
|
siblings: swiftSiblingDependencies(input.files, targets),
|
|
@@ -6918,13 +6942,13 @@ function outputOf(error) {
|
|
|
6918
6942
|
return error instanceof Error ? error.message : String(error);
|
|
6919
6943
|
}
|
|
6920
6944
|
function builtArtifact(layout) {
|
|
6921
|
-
const binDir =
|
|
6922
|
-
const manifest = (0, import_node_fs8.readFileSync)(
|
|
6945
|
+
const binDir = import_node_path9.default.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
6946
|
+
const manifest = (0, import_node_fs8.readFileSync)(import_node_path9.default.join(layout.root, "Package.swift"), "utf8");
|
|
6923
6947
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
6924
6948
|
if (executable === void 0) {
|
|
6925
6949
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
6926
6950
|
}
|
|
6927
|
-
const file =
|
|
6951
|
+
const file = import_node_path9.default.join(binDir, `${executable.name}.wasm`);
|
|
6928
6952
|
if (!(0, import_node_fs8.existsSync)(file)) {
|
|
6929
6953
|
const found = (0, import_node_fs8.existsSync)(binDir) ? (0, import_node_fs8.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
6930
6954
|
throw new Error(
|
|
@@ -6935,7 +6959,7 @@ function builtArtifact(layout) {
|
|
|
6935
6959
|
}
|
|
6936
6960
|
function projectDiagnostic(output, layout) {
|
|
6937
6961
|
const base = layout.multi ? layout.root : layout.sources;
|
|
6938
|
-
const prefix = `${base}${
|
|
6962
|
+
const prefix = `${base}${import_node_path9.default.sep}`;
|
|
6939
6963
|
return output.split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
|
|
6940
6964
|
}
|
|
6941
6965
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -6954,16 +6978,16 @@ function serialize(root, work) {
|
|
|
6954
6978
|
function compileSwiftProjectUnit(input, options) {
|
|
6955
6979
|
(0, import_node_fs8.mkdirSync)(options.buildRoot, { recursive: true });
|
|
6956
6980
|
const root = (0, import_node_fs8.realpathSync)(options.buildRoot);
|
|
6957
|
-
const moduleRoot =
|
|
6981
|
+
const moduleRoot = import_node_path9.default.resolve(options.moduleRoot);
|
|
6958
6982
|
const layout = {
|
|
6959
6983
|
root,
|
|
6960
|
-
sources:
|
|
6984
|
+
sources: import_node_path9.default.join(root, "Sources", "App"),
|
|
6961
6985
|
multi: compileTargets(input).length > 0
|
|
6962
6986
|
};
|
|
6963
6987
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
6964
6988
|
return serialize(root, async () => {
|
|
6965
6989
|
writeSwiftProject(layout, input, moduleRoot);
|
|
6966
|
-
const swift =
|
|
6990
|
+
const swift = import_node_path9.default.join(options.toolchainBin, "swift");
|
|
6967
6991
|
if (!(0, import_node_fs8.existsSync)(swift)) {
|
|
6968
6992
|
throw new Error(
|
|
6969
6993
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
@@ -7147,17 +7171,17 @@ var SKIP_SOURCE_DIRS = /* @__PURE__ */ new Set([
|
|
|
7147
7171
|
var NATIVE_DESCRIPTOR = ".one-native-source.json";
|
|
7148
7172
|
var NATIVE_GLUE = ".one-native-source.swift.txt";
|
|
7149
7173
|
function swiftPackageId(packagePath) {
|
|
7150
|
-
return
|
|
7174
|
+
return import_node_path10.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
7151
7175
|
}
|
|
7152
7176
|
function nativeSourceDescriptor(packagePath) {
|
|
7153
7177
|
packagePath = import_node_fs9.default.realpathSync(packagePath);
|
|
7154
|
-
const file =
|
|
7178
|
+
const file = import_node_path10.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
7155
7179
|
if (!import_node_fs9.default.existsSync(file)) return null;
|
|
7156
7180
|
const value = JSON.parse(
|
|
7157
7181
|
readPackageFile(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
7158
7182
|
);
|
|
7159
7183
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
7160
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs9.default.existsSync(
|
|
7184
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs9.default.existsSync(import_node_path10.default.join(packagePath, NATIVE_GLUE))) {
|
|
7161
7185
|
throw invalid();
|
|
7162
7186
|
}
|
|
7163
7187
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -7194,15 +7218,15 @@ function packageFiles(root) {
|
|
|
7194
7218
|
for (const entry of import_node_fs9.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
7195
7219
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
7196
7220
|
continue;
|
|
7197
|
-
const full =
|
|
7221
|
+
const full = import_node_path10.default.join(dir, entry.name);
|
|
7198
7222
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
7199
7223
|
const real = import_node_fs9.default.realpathSync(full);
|
|
7200
|
-
const relative2 =
|
|
7201
|
-
if (relative2.startsWith(`..${
|
|
7224
|
+
const relative2 = import_node_path10.default.relative(canonicalRoot, real);
|
|
7225
|
+
if (relative2.startsWith(`..${import_node_path10.default.sep}`) || relative2 === ".." || import_node_path10.default.isAbsolute(relative2)) {
|
|
7202
7226
|
throw new Error(`swift input escapes the selected package: ${full}`);
|
|
7203
7227
|
}
|
|
7204
7228
|
if (entry.isDirectory()) {
|
|
7205
|
-
if (import_node_fs9.default.existsSync(
|
|
7229
|
+
if (import_node_fs9.default.existsSync(import_node_path10.default.join(full, "Package.swift"))) continue;
|
|
7206
7230
|
walk(full);
|
|
7207
7231
|
} else if (entry.isFile()) {
|
|
7208
7232
|
found.push(full);
|
|
@@ -7215,16 +7239,16 @@ function packageFiles(root) {
|
|
|
7215
7239
|
}
|
|
7216
7240
|
function readPackageFile(root, file, maxBytes) {
|
|
7217
7241
|
const canonicalRoot = import_node_fs9.default.realpathSync(root);
|
|
7218
|
-
const relative2 =
|
|
7219
|
-
if (relative2 === ".." || relative2.startsWith(`..${
|
|
7242
|
+
const relative2 = import_node_path10.default.relative(canonicalRoot, import_node_fs9.default.realpathSync(file));
|
|
7243
|
+
if (relative2 === ".." || relative2.startsWith(`..${import_node_path10.default.sep}`) || import_node_path10.default.isAbsolute(relative2)) {
|
|
7220
7244
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
7221
7245
|
}
|
|
7222
|
-
let ancestor =
|
|
7246
|
+
let ancestor = import_node_path10.default.resolve(file);
|
|
7223
7247
|
while (ancestor !== canonicalRoot) {
|
|
7224
7248
|
if (import_node_fs9.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
7225
7249
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
7226
7250
|
}
|
|
7227
|
-
const parent =
|
|
7251
|
+
const parent = import_node_path10.default.dirname(ancestor);
|
|
7228
7252
|
if (parent === ancestor)
|
|
7229
7253
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
7230
7254
|
ancestor = parent;
|
|
@@ -7277,7 +7301,7 @@ var RESOURCE_CONTENT_TYPES = {
|
|
|
7277
7301
|
function buildSwiftResourceTable(project, baseUrl) {
|
|
7278
7302
|
const absolute = resourceCandidateFiles(project.packagePath);
|
|
7279
7303
|
const relative2 = absolute.map(
|
|
7280
|
-
(file) =>
|
|
7304
|
+
(file) => import_node_path10.default.relative(project.packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
|
|
7281
7305
|
);
|
|
7282
7306
|
const byRelative = new Map(absolute.map((file, index) => [relative2[index], file]));
|
|
7283
7307
|
const readContents = (candidate) => {
|
|
@@ -7311,10 +7335,10 @@ function buildSwiftResourceTable(project, baseUrl) {
|
|
|
7311
7335
|
);
|
|
7312
7336
|
imageBytes += bytes.length;
|
|
7313
7337
|
const hash = (0, import_node_crypto4.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
7314
|
-
const ext =
|
|
7338
|
+
const ext = import_node_path10.default.posix.extname(file).toLowerCase();
|
|
7315
7339
|
table[name2] = { uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale };
|
|
7316
7340
|
images[name2] = {
|
|
7317
|
-
file:
|
|
7341
|
+
file: import_node_path10.default.posix.basename(file),
|
|
7318
7342
|
data: bytes.toString("base64")
|
|
7319
7343
|
};
|
|
7320
7344
|
watched.push(file);
|
|
@@ -7343,14 +7367,14 @@ var BUNDLE_MAX_TOTAL_BYTES = MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES;
|
|
|
7343
7367
|
function buildSwiftBundleFiles(packagePath) {
|
|
7344
7368
|
packagePath = import_node_fs9.default.realpathSync(packagePath);
|
|
7345
7369
|
const relative2 = resourceCandidateFiles(packagePath).map(
|
|
7346
|
-
(file) =>
|
|
7370
|
+
(file) => import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
|
|
7347
7371
|
);
|
|
7348
7372
|
const files = {};
|
|
7349
7373
|
const watched = [];
|
|
7350
7374
|
let total = 0;
|
|
7351
7375
|
for (const { base, file } of enumerateBundleJson(relative2)) {
|
|
7352
7376
|
watched.push(file);
|
|
7353
|
-
const disk =
|
|
7377
|
+
const disk = import_node_path10.default.join(packagePath, ...file.split("/"));
|
|
7354
7378
|
if (Object.keys(files).length >= BUNDLE_MAX_FILES || total + import_node_fs9.default.statSync(disk).size > BUNDLE_MAX_TOTAL_BYTES) {
|
|
7355
7379
|
throw new Error(
|
|
7356
7380
|
`swift bundle pack exceeds ${BUNDLE_MAX_FILES} files / ${BUNDLE_MAX_TOTAL_BYTES} bytes`
|
|
@@ -7371,7 +7395,7 @@ function linkedModuleRoots(packagePath) {
|
|
|
7371
7395
|
try {
|
|
7372
7396
|
manifest = readPackageFile(
|
|
7373
7397
|
packagePath,
|
|
7374
|
-
|
|
7398
|
+
import_node_path10.default.join(packagePath, "Package.swift"),
|
|
7375
7399
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
7376
7400
|
).toString("utf8");
|
|
7377
7401
|
} catch {
|
|
@@ -7380,8 +7404,8 @@ function linkedModuleRoots(packagePath) {
|
|
|
7380
7404
|
const roots = /* @__PURE__ */ new Set();
|
|
7381
7405
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
7382
7406
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
7383
|
-
const root =
|
|
7384
|
-
if (import_node_fs9.default.existsSync(
|
|
7407
|
+
const root = import_node_path10.default.resolve(packagePath, match[1]);
|
|
7408
|
+
if (import_node_fs9.default.existsSync(import_node_path10.default.join(root, "Package.swift"))) roots.add(root);
|
|
7385
7409
|
}
|
|
7386
7410
|
return [...roots].sort();
|
|
7387
7411
|
}
|
|
@@ -7390,18 +7414,18 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
7390
7414
|
hash.update(packagePath);
|
|
7391
7415
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
7392
7416
|
for (const file of [...projectInputs].sort()) {
|
|
7393
|
-
hash.update(
|
|
7417
|
+
hash.update(import_node_path10.default.relative(packagePath, file));
|
|
7394
7418
|
const stat2 = import_node_fs9.default.statSync(file);
|
|
7395
7419
|
hash.update(`${stat2.mtimeMs}/${stat2.ctimeMs}/${stat2.size}`);
|
|
7396
7420
|
}
|
|
7397
7421
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
7398
|
-
(root) => import_node_fs9.default.existsSync(
|
|
7422
|
+
(root) => import_node_fs9.default.existsSync(import_node_path10.default.join(root, "toolchain.json"))
|
|
7399
7423
|
);
|
|
7400
7424
|
if (moduleRoot) {
|
|
7401
7425
|
hash.update(moduleRoot);
|
|
7402
7426
|
for (const relative2 of swiftModuleInputFiles(moduleRoot)) {
|
|
7403
7427
|
hash.update(relative2);
|
|
7404
|
-
hash.update(String(import_node_fs9.default.statSync(
|
|
7428
|
+
hash.update(String(import_node_fs9.default.statSync(import_node_path10.default.join(moduleRoot, relative2)).mtimeMs));
|
|
7405
7429
|
}
|
|
7406
7430
|
}
|
|
7407
7431
|
return hash.digest("hex").slice(0, 16);
|
|
@@ -7419,7 +7443,7 @@ function packageSources(packagePath) {
|
|
|
7419
7443
|
throw new Error("swift source byte cap exceeded");
|
|
7420
7444
|
const files = {};
|
|
7421
7445
|
for (const file of sources) {
|
|
7422
|
-
const relative2 =
|
|
7446
|
+
const relative2 = import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
|
|
7423
7447
|
files[relative2] = readPackageFile(
|
|
7424
7448
|
packagePath,
|
|
7425
7449
|
file,
|
|
@@ -7439,7 +7463,7 @@ function packageSnapshot(project) {
|
|
|
7439
7463
|
...native ? {
|
|
7440
7464
|
glue: readPackageFile(
|
|
7441
7465
|
project.packagePath,
|
|
7442
|
-
|
|
7466
|
+
import_node_path10.default.join(project.packagePath, NATIVE_GLUE),
|
|
7443
7467
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
7444
7468
|
).toString("utf8")
|
|
7445
7469
|
} : {}
|
|
@@ -7474,7 +7498,7 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
7474
7498
|
package: content
|
|
7475
7499
|
};
|
|
7476
7500
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
7477
|
-
(root) => import_node_fs9.default.existsSync(
|
|
7501
|
+
(root) => import_node_fs9.default.existsSync(import_node_path10.default.join(root, "toolchain.json"))
|
|
7478
7502
|
);
|
|
7479
7503
|
if (!moduleRoot)
|
|
7480
7504
|
return {
|
|
@@ -7493,10 +7517,10 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
7493
7517
|
// server and a capture, or two checkouts) build each other's sources. so
|
|
7494
7518
|
// each app and module checkout gets its own root, which keeps the same
|
|
7495
7519
|
// app's incremental build across restarts.
|
|
7496
|
-
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ??
|
|
7497
|
-
|
|
7520
|
+
buildRoot: process.env.CONTRAST_SWIFT_BUILD_ROOT ?? import_node_path10.default.join(
|
|
7521
|
+
import_node_os4.default.tmpdir(),
|
|
7498
7522
|
"contrast-swift-build",
|
|
7499
|
-
(0, import_node_crypto4.createHash)("sha256").update(`${moduleRoot}\0${
|
|
7523
|
+
(0, import_node_crypto4.createHash)("sha256").update(`${moduleRoot}\0${import_node_path10.default.resolve(packagePath)}`).digest("hex").slice(0, 16)
|
|
7500
7524
|
),
|
|
7501
7525
|
moduleRoot,
|
|
7502
7526
|
...toolchain
|
|
@@ -7504,24 +7528,21 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
|
|
|
7504
7528
|
return { ...artifact, stamp, package: content };
|
|
7505
7529
|
}
|
|
7506
7530
|
function localSwiftToolchain(moduleRoot) {
|
|
7507
|
-
const manifest =
|
|
7531
|
+
const manifest = import_node_path10.default.join(moduleRoot, "toolchain.json");
|
|
7508
7532
|
if (!import_node_fs9.default.existsSync(manifest)) return null;
|
|
7509
7533
|
const toolchain = JSON.parse(import_node_fs9.default.readFileSync(manifest, "utf8"));
|
|
7510
7534
|
const release = toolchain && typeof toolchain === "object" ? Reflect.get(toolchain, "release") : void 0;
|
|
7511
7535
|
if (typeof release !== "string") {
|
|
7512
7536
|
throw new Error(`swift toolchain manifest at ${moduleRoot} has no release`);
|
|
7513
7537
|
}
|
|
7514
|
-
const toolchainBin =
|
|
7515
|
-
|
|
7516
|
-
`Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`
|
|
7517
|
-
);
|
|
7518
|
-
return import_node_fs9.default.existsSync(import_node_path9.default.join(toolchainBin, "swift")) ? { release, toolchainBin } : null;
|
|
7538
|
+
const toolchainBin = swiftToolchainBin(release);
|
|
7539
|
+
return import_node_fs9.default.existsSync(import_node_path10.default.join(toolchainBin, "swift")) ? { release, toolchainBin } : null;
|
|
7519
7540
|
}
|
|
7520
7541
|
async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
7521
7542
|
const auth = hosted ? null : resolveCliAuth();
|
|
7522
7543
|
if (!hosted && (!auth || auth.kind === "github")) {
|
|
7523
7544
|
throw new Error(
|
|
7524
|
-
`compiling ${
|
|
7545
|
+
`compiling ${import_node_path10.default.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`
|
|
7525
7546
|
);
|
|
7526
7547
|
}
|
|
7527
7548
|
const origin = hosted?.origin ?? resolveContrastBackendOrigin(auth?.kind === "session" ? auth.origin : null);
|
|
@@ -7551,7 +7572,7 @@ async function compileRemote(packagePath, entry, snapshot, hosted) {
|
|
|
7551
7572
|
);
|
|
7552
7573
|
if (descriptor && address.native?.hash !== descriptor.hash) {
|
|
7553
7574
|
throw new Error(
|
|
7554
|
-
`${
|
|
7575
|
+
`${import_node_path10.default.basename(packagePath)}: Contrast compiled native contract ${address.native?.hash ?? "none"} but one typegen wrote ${descriptor.hash}; the app's One and the compile host's differ, or the compile host is older than this peachsim`
|
|
7555
7576
|
);
|
|
7556
7577
|
}
|
|
7557
7578
|
const response = await fetch(address.url, { signal });
|
|
@@ -7677,7 +7698,7 @@ var EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
|
|
|
7677
7698
|
var EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
|
|
7678
7699
|
async function collectExpoSwiftSources(appRoot) {
|
|
7679
7700
|
appRoot = import_node_fs10.default.realpathSync(appRoot);
|
|
7680
|
-
const appRequire = (0, import_node_module.createRequire)(
|
|
7701
|
+
const appRequire = (0, import_node_module.createRequire)(import_node_path11.default.join(appRoot, "package.json"));
|
|
7681
7702
|
let autolinker;
|
|
7682
7703
|
try {
|
|
7683
7704
|
autolinker = appRequire.resolve("expo-modules-autolinking/package.json");
|
|
@@ -7689,7 +7710,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
7689
7710
|
const { stdout } = await run3(
|
|
7690
7711
|
process.execPath,
|
|
7691
7712
|
[
|
|
7692
|
-
|
|
7713
|
+
import_node_path11.default.join(import_node_path11.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
7693
7714
|
"search",
|
|
7694
7715
|
"--platform",
|
|
7695
7716
|
"apple",
|
|
@@ -7705,7 +7726,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
7705
7726
|
const { stdout: resolvedText } = await run3(
|
|
7706
7727
|
process.execPath,
|
|
7707
7728
|
[
|
|
7708
|
-
|
|
7729
|
+
import_node_path11.default.join(import_node_path11.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
7709
7730
|
"resolve",
|
|
7710
7731
|
"--platform",
|
|
7711
7732
|
"apple",
|
|
@@ -7729,7 +7750,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
7729
7750
|
if (typeof sourceRoot !== "string")
|
|
7730
7751
|
throw new Error("Expo autolinking entry has no path");
|
|
7731
7752
|
const canonical = import_node_fs10.default.realpathSync(sourceRoot);
|
|
7732
|
-
if (canonical.split(
|
|
7753
|
+
if (canonical.split(import_node_path11.default.sep).includes("node_modules")) continue;
|
|
7733
7754
|
const resolution = resolutions.find(
|
|
7734
7755
|
(candidate) => candidate && typeof candidate === "object" && Reflect.get(candidate, "packageName") === Reflect.get(entry, "name")
|
|
7735
7756
|
);
|
|
@@ -7753,12 +7774,12 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
7753
7774
|
`(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
|
|
7754
7775
|
);
|
|
7755
7776
|
}
|
|
7756
|
-
const ios =
|
|
7777
|
+
const ios = import_node_path11.default.join(canonical, "ios");
|
|
7757
7778
|
if (import_node_fs10.default.lstatSync(ios).isSymbolicLink())
|
|
7758
7779
|
throw new Error(`Expo Swift source directory is a symlink: ${ios}`);
|
|
7759
7780
|
const walk = (dir) => {
|
|
7760
7781
|
for (const child of import_node_fs10.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
7761
|
-
const file =
|
|
7782
|
+
const file = import_node_path11.default.join(dir, child.name);
|
|
7762
7783
|
if (child.isSymbolicLink())
|
|
7763
7784
|
throw new Error(`Expo Swift source is a symlink: ${file}`);
|
|
7764
7785
|
if (child.isDirectory()) {
|
|
@@ -7770,7 +7791,7 @@ async function collectExpoSwiftSources(appRoot) {
|
|
|
7770
7791
|
bytes += size;
|
|
7771
7792
|
if (Object.keys(files).length + 1 > MAX_SWIFT_COMPILE_FILES - 2 || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES)
|
|
7772
7793
|
throw new Error("Expo Swift sources exceed compile service caps");
|
|
7773
|
-
files[`Sources/${namespace}/${
|
|
7794
|
+
files[`Sources/${namespace}/${import_node_path11.default.relative(ios, file).split(import_node_path11.default.sep).join("/")}`] = `#sourceLocation(file: ${JSON.stringify(file)}, line: 1)
|
|
7774
7795
|
${import_node_fs10.default.readFileSync(file, "utf8")}`;
|
|
7775
7796
|
}
|
|
7776
7797
|
};
|
|
@@ -7821,7 +7842,7 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
7821
7842
|
return true;
|
|
7822
7843
|
}
|
|
7823
7844
|
const root = url.searchParams.get("root");
|
|
7824
|
-
if (!root || !
|
|
7845
|
+
if (!root || !import_node_path11.default.isAbsolute(root)) {
|
|
7825
7846
|
res.writeHead(400);
|
|
7826
7847
|
res.end("missing absolute app root");
|
|
7827
7848
|
return true;
|
|
@@ -7832,16 +7853,16 @@ async function handleExpoSwiftRequest(req, res) {
|
|
|
7832
7853
|
pending = (async () => {
|
|
7833
7854
|
const files = await collectExpoSwiftSources(root);
|
|
7834
7855
|
if (!files) return null;
|
|
7835
|
-
const moduleRoot =
|
|
7856
|
+
const moduleRoot = import_node_path11.default.resolve(import_meta2.dirname, "../../sootsim-swift");
|
|
7836
7857
|
if (!localSwiftToolchain(moduleRoot)) return null;
|
|
7837
7858
|
const key = (0, import_node_crypto5.createHash)("sha256").update(import_node_fs10.default.realpathSync(root)).digest("hex");
|
|
7838
|
-
const packagePath =
|
|
7839
|
-
const sources =
|
|
7859
|
+
const packagePath = import_node_path11.default.join(import_node_os5.default.tmpdir(), "peach-expo-swift", key);
|
|
7860
|
+
const sources = import_node_path11.default.join(packagePath, "Sources");
|
|
7840
7861
|
import_node_fs10.default.rmSync(sources, { recursive: true, force: true });
|
|
7841
7862
|
import_node_fs10.default.mkdirSync(sources, { recursive: true });
|
|
7842
7863
|
for (const [name2, content] of Object.entries(files)) {
|
|
7843
|
-
const target =
|
|
7844
|
-
import_node_fs10.default.mkdirSync(
|
|
7864
|
+
const target = import_node_path11.default.join(packagePath, name2);
|
|
7865
|
+
import_node_fs10.default.mkdirSync(import_node_path11.default.dirname(target), { recursive: true });
|
|
7845
7866
|
import_node_fs10.default.writeFileSync(target, content);
|
|
7846
7867
|
}
|
|
7847
7868
|
const artifact = await artifactFor(
|
|
@@ -7889,14 +7910,14 @@ var import_url = require("url");
|
|
|
7889
7910
|
var import_node_child_process5 = require("node:child_process");
|
|
7890
7911
|
var import_node_crypto6 = __toESM(require("node:crypto"), 1);
|
|
7891
7912
|
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
7892
|
-
var
|
|
7893
|
-
var
|
|
7913
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
7914
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
7894
7915
|
var import_node_stream = require("node:stream");
|
|
7895
7916
|
var import_promises3 = require("node:stream/promises");
|
|
7896
7917
|
|
|
7897
7918
|
// ../contrast-runtime-delivery/src/product.ts
|
|
7898
7919
|
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
7899
|
-
var
|
|
7920
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
7900
7921
|
function isValidRuntimeVersion(value) {
|
|
7901
7922
|
return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
|
|
7902
7923
|
}
|
|
@@ -7908,7 +7929,7 @@ function listInstalledRuntimes(product) {
|
|
|
7908
7929
|
}
|
|
7909
7930
|
}
|
|
7910
7931
|
function runtimeTarballCacheName(product, version) {
|
|
7911
|
-
return
|
|
7932
|
+
return import_node_path12.default.posix.basename(product.tarballPath(version));
|
|
7912
7933
|
}
|
|
7913
7934
|
function compareSemver(a, b) {
|
|
7914
7935
|
const parse2 = (v) => {
|
|
@@ -8011,7 +8032,7 @@ function createRuntimeDelivery(product) {
|
|
|
8011
8032
|
const setActive = opts.setActive !== false;
|
|
8012
8033
|
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
8013
8034
|
pruneLocalRetention({ protectVersions });
|
|
8014
|
-
if (!opts.force && import_node_fs12.default.existsSync(
|
|
8035
|
+
if (!opts.force && import_node_fs12.default.existsSync(import_node_path13.default.join(destDir, product.installedMarker))) {
|
|
8015
8036
|
if (setActive) product.writeActiveRuntime(version);
|
|
8016
8037
|
pruneLocalRetention({ protectVersions });
|
|
8017
8038
|
return {
|
|
@@ -8055,7 +8076,7 @@ function createRuntimeDelivery(product) {
|
|
|
8055
8076
|
if (pin) {
|
|
8056
8077
|
const activeVersion2 = product.readActiveRuntime();
|
|
8057
8078
|
const pinInstalled = import_node_fs12.default.existsSync(
|
|
8058
|
-
|
|
8079
|
+
import_node_path13.default.join(product.runtimeDir(pin), product.installedMarker)
|
|
8059
8080
|
);
|
|
8060
8081
|
if (activeVersion2 === pin && pinInstalled) {
|
|
8061
8082
|
return {
|
|
@@ -8104,7 +8125,7 @@ function createRuntimeDelivery(product) {
|
|
|
8104
8125
|
}
|
|
8105
8126
|
const activeVersion = product.readActiveRuntime();
|
|
8106
8127
|
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
8107
|
-
const activeInstalled = activeDir ? import_node_fs12.default.existsSync(
|
|
8128
|
+
const activeInstalled = activeDir ? import_node_fs12.default.existsSync(import_node_path13.default.join(activeDir, product.installedMarker)) : false;
|
|
8108
8129
|
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
8109
8130
|
if (!shouldInstall) {
|
|
8110
8131
|
return {
|
|
@@ -8184,7 +8205,7 @@ function createRuntimeDelivery(product) {
|
|
|
8184
8205
|
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
8185
8206
|
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
8186
8207
|
return complete || partial;
|
|
8187
|
-
}).map((entry) =>
|
|
8208
|
+
}).map((entry) => import_node_path13.default.join(product.cacheDir(), entry.name)).sort();
|
|
8188
8209
|
} catch {
|
|
8189
8210
|
}
|
|
8190
8211
|
}
|
|
@@ -8225,11 +8246,11 @@ function createRuntimeDelivery(product) {
|
|
|
8225
8246
|
}
|
|
8226
8247
|
async function installVerifiedTarball(tarball) {
|
|
8227
8248
|
const { url, digest, destDir, installedMarker, label } = tarball;
|
|
8228
|
-
const downloadDir = import_node_fs12.default.mkdtempSync(
|
|
8229
|
-
const archivePath =
|
|
8230
|
-
import_node_fs12.default.mkdirSync(
|
|
8249
|
+
const downloadDir = import_node_fs12.default.mkdtempSync(import_node_path13.default.join(import_node_os6.default.tmpdir(), "runtime-delivery-download-"));
|
|
8250
|
+
const archivePath = import_node_path13.default.join(downloadDir, "archive.tar.gz");
|
|
8251
|
+
import_node_fs12.default.mkdirSync(import_node_path13.default.dirname(destDir), { recursive: true });
|
|
8231
8252
|
const tmpDir = import_node_fs12.default.mkdtempSync(
|
|
8232
|
-
|
|
8253
|
+
import_node_path13.default.join(import_node_path13.default.dirname(destDir), `.installing-${import_node_path13.default.basename(destDir)}-`)
|
|
8233
8254
|
);
|
|
8234
8255
|
try {
|
|
8235
8256
|
await downloadToFile(url, archivePath);
|
|
@@ -8240,7 +8261,7 @@ async function installVerifiedTarball(tarball) {
|
|
|
8240
8261
|
);
|
|
8241
8262
|
}
|
|
8242
8263
|
await extractTarball(archivePath, tmpDir, tarball.stripComponents ?? 0);
|
|
8243
|
-
if (!import_node_fs12.default.existsSync(
|
|
8264
|
+
if (!import_node_fs12.default.existsSync(import_node_path13.default.join(tmpDir, installedMarker))) {
|
|
8244
8265
|
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
8245
8266
|
}
|
|
8246
8267
|
try {
|
|
@@ -8256,7 +8277,7 @@ async function installVerifiedTarball(tarball) {
|
|
|
8256
8277
|
try {
|
|
8257
8278
|
import_node_fs12.default.renameSync(tmpDir, destDir);
|
|
8258
8279
|
} catch (landErr) {
|
|
8259
|
-
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs12.default.existsSync(
|
|
8280
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs12.default.existsSync(import_node_path13.default.join(destDir, installedMarker))) {
|
|
8260
8281
|
throw landErr;
|
|
8261
8282
|
}
|
|
8262
8283
|
} finally {
|
|
@@ -8276,7 +8297,7 @@ async function downloadToFile(url, destPath) {
|
|
|
8276
8297
|
if (!res.ok || !res.body) {
|
|
8277
8298
|
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
8278
8299
|
}
|
|
8279
|
-
import_node_fs12.default.mkdirSync(
|
|
8300
|
+
import_node_fs12.default.mkdirSync(import_node_path13.default.dirname(destPath), { recursive: true });
|
|
8280
8301
|
const tmp = `${destPath}.partial`;
|
|
8281
8302
|
try {
|
|
8282
8303
|
await (0, import_promises3.pipeline)(
|
|
@@ -8447,18 +8468,18 @@ var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
|
8447
8468
|
// src/host/agent-host.ts
|
|
8448
8469
|
var import_node_crypto9 = require("node:crypto");
|
|
8449
8470
|
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
8450
|
-
var
|
|
8471
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
8451
8472
|
|
|
8452
8473
|
// src/agent-sessions.ts
|
|
8453
8474
|
var import_node_child_process6 = require("node:child_process");
|
|
8454
8475
|
var import_node_crypto8 = require("node:crypto");
|
|
8455
8476
|
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
8456
|
-
var
|
|
8477
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
8457
8478
|
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
8458
8479
|
|
|
8459
8480
|
// cli/self-invocation.ts
|
|
8460
8481
|
var import_node_fs13 = require("node:fs");
|
|
8461
|
-
var
|
|
8482
|
+
var import_node_path14 = require("node:path");
|
|
8462
8483
|
var import_node_url3 = require("node:url");
|
|
8463
8484
|
init_public_brand();
|
|
8464
8485
|
|
|
@@ -8468,14 +8489,14 @@ var IS_STANDALONE = typeof __SOOTSIM_STANDALONE__ !== "undefined" && __SOOTSIM_S
|
|
|
8468
8489
|
// cli/self-invocation.ts
|
|
8469
8490
|
function sourceEntryPath() {
|
|
8470
8491
|
try {
|
|
8471
|
-
const candidate = (0,
|
|
8492
|
+
const candidate = (0, import_node_path14.join)((0, import_node_path14.dirname)((0, import_node_url3.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
8472
8493
|
return (0, import_node_fs13.existsSync)(candidate) ? candidate : null;
|
|
8473
8494
|
} catch {
|
|
8474
8495
|
return null;
|
|
8475
8496
|
}
|
|
8476
8497
|
}
|
|
8477
|
-
function isCliEntry(
|
|
8478
|
-
const name2 = (0,
|
|
8498
|
+
function isCliEntry(path17) {
|
|
8499
|
+
const name2 = (0, import_node_path14.basename)(path17);
|
|
8479
8500
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
8480
8501
|
}
|
|
8481
8502
|
function rnxSelfInvocation() {
|
|
@@ -8536,7 +8557,7 @@ function encodeAgentPromptEnvelope(input) {
|
|
|
8536
8557
|
// src/attached-projects.ts
|
|
8537
8558
|
var import_node_crypto7 = require("node:crypto");
|
|
8538
8559
|
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
8539
|
-
var
|
|
8560
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
8540
8561
|
init_home_paths();
|
|
8541
8562
|
var overrideDir = null;
|
|
8542
8563
|
function userDataDir() {
|
|
@@ -8549,7 +8570,7 @@ function getUserDataDir() {
|
|
|
8549
8570
|
return userDataDir();
|
|
8550
8571
|
}
|
|
8551
8572
|
function storeFile() {
|
|
8552
|
-
return
|
|
8573
|
+
return import_node_path15.default.join(userDataDir(), "attached-projects.json");
|
|
8553
8574
|
}
|
|
8554
8575
|
function cloneEmpty() {
|
|
8555
8576
|
return {
|
|
@@ -8591,7 +8612,7 @@ function loadStore() {
|
|
|
8591
8612
|
}
|
|
8592
8613
|
function writeStore(store) {
|
|
8593
8614
|
const file = storeFile();
|
|
8594
|
-
import_node_fs14.default.mkdirSync(
|
|
8615
|
+
import_node_fs14.default.mkdirSync(import_node_path15.default.dirname(file), { recursive: true });
|
|
8595
8616
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
8596
8617
|
const fd = import_node_fs14.default.openSync(tmp, "w", 384);
|
|
8597
8618
|
try {
|
|
@@ -8609,13 +8630,13 @@ function mutateStore(fn) {
|
|
|
8609
8630
|
return store;
|
|
8610
8631
|
}
|
|
8611
8632
|
function projectIdForCwd(cwd) {
|
|
8612
|
-
return (0, import_node_crypto7.createHash)("sha256").update(
|
|
8633
|
+
return (0, import_node_crypto7.createHash)("sha256").update(import_node_path15.default.resolve(cwd)).digest("hex").slice(0, 16);
|
|
8613
8634
|
}
|
|
8614
8635
|
function newSessionId() {
|
|
8615
8636
|
return `s_${(0, import_node_crypto7.randomBytes)(10).toString("hex")}`;
|
|
8616
8637
|
}
|
|
8617
8638
|
function upsertProject(input) {
|
|
8618
|
-
const cwd =
|
|
8639
|
+
const cwd = import_node_path15.default.resolve(input.cwd);
|
|
8619
8640
|
const id = projectIdForCwd(cwd);
|
|
8620
8641
|
let result;
|
|
8621
8642
|
mutateStore((store) => {
|
|
@@ -8641,7 +8662,7 @@ function upsertProject(input) {
|
|
|
8641
8662
|
const now = Date.now();
|
|
8642
8663
|
const created = {
|
|
8643
8664
|
id,
|
|
8644
|
-
name: input.name ??
|
|
8665
|
+
name: input.name ?? import_node_path15.default.basename(cwd),
|
|
8645
8666
|
cwd,
|
|
8646
8667
|
repoRoot: input.repoRoot,
|
|
8647
8668
|
sourceRoots: input.sourceRoots ?? [cwd],
|
|
@@ -8788,7 +8809,7 @@ async function seedFromDemoAppRegistry() {
|
|
|
8788
8809
|
mutateStore((store) => {
|
|
8789
8810
|
for (const app of apps) {
|
|
8790
8811
|
if (!import_node_fs14.default.existsSync(app.dir)) continue;
|
|
8791
|
-
const cwd =
|
|
8812
|
+
const cwd = import_node_path15.default.resolve(app.dir);
|
|
8792
8813
|
const id = projectIdForCwd(cwd);
|
|
8793
8814
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
8794
8815
|
const now = Date.now();
|
|
@@ -8813,16 +8834,16 @@ async function seedFromDemoAppRegistry() {
|
|
|
8813
8834
|
// src/agent-sessions.ts
|
|
8814
8835
|
init_public_brand();
|
|
8815
8836
|
function sessionDir(sessionId) {
|
|
8816
|
-
return
|
|
8837
|
+
return import_node_path16.default.join(getUserDataDir(), "sessions", sessionId);
|
|
8817
8838
|
}
|
|
8818
8839
|
function promptFifoPath(sessionId) {
|
|
8819
|
-
return
|
|
8840
|
+
return import_node_path16.default.join(sessionDir(sessionId), "prompt.in");
|
|
8820
8841
|
}
|
|
8821
8842
|
function eventsFifoPath(sessionId) {
|
|
8822
|
-
return
|
|
8843
|
+
return import_node_path16.default.join(sessionDir(sessionId), "events.out");
|
|
8823
8844
|
}
|
|
8824
8845
|
function transcriptPath(sessionId) {
|
|
8825
|
-
return
|
|
8846
|
+
return import_node_path16.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
|
|
8826
8847
|
}
|
|
8827
8848
|
function pidIsAlive(pid, sessionId) {
|
|
8828
8849
|
if (!pid) return false;
|
|
@@ -8845,8 +8866,8 @@ function resolveSootsimInvocation() {
|
|
|
8845
8866
|
const resourcesPath = process.resourcesPath;
|
|
8846
8867
|
if (resourcesPath) {
|
|
8847
8868
|
const candidates = [
|
|
8848
|
-
|
|
8849
|
-
|
|
8869
|
+
import_node_path16.default.join(resourcesPath, "bin", "sootsim"),
|
|
8870
|
+
import_node_path16.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
8850
8871
|
];
|
|
8851
8872
|
for (const c of candidates) {
|
|
8852
8873
|
if (import_node_fs15.default.existsSync(c)) return { executable: c, prefixArgs: [] };
|
|
@@ -8868,12 +8889,12 @@ function tryWorkspaceSootsim() {
|
|
|
8868
8889
|
const sootsimDir = resolveSootsimPackageDir();
|
|
8869
8890
|
if (!sootsimDir) return null;
|
|
8870
8891
|
const binaryName = `peach-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
8871
|
-
const distBinary =
|
|
8892
|
+
const distBinary = import_node_path16.default.join(sootsimDir, "dist-bin", binaryName);
|
|
8872
8893
|
if (import_node_fs15.default.existsSync(distBinary)) return { executable: distBinary, prefixArgs: [] };
|
|
8873
|
-
const distBin =
|
|
8894
|
+
const distBin = import_node_path16.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
8874
8895
|
if (import_node_fs15.default.existsSync(distBin)) {
|
|
8875
8896
|
try {
|
|
8876
|
-
const src =
|
|
8897
|
+
const src = import_node_path16.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
8877
8898
|
if (import_node_fs15.default.existsSync(src)) {
|
|
8878
8899
|
const srcMtime = import_node_fs15.default.statSync(src).mtimeMs;
|
|
8879
8900
|
const buildMtime = import_node_fs15.default.statSync(distBin).mtimeMs;
|
|
@@ -8895,14 +8916,14 @@ function tryWorkspaceSootsim() {
|
|
|
8895
8916
|
function resolveSootsimPackageDir() {
|
|
8896
8917
|
try {
|
|
8897
8918
|
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
8898
|
-
return
|
|
8919
|
+
return import_node_path16.default.dirname(resolved);
|
|
8899
8920
|
} catch {
|
|
8900
8921
|
}
|
|
8901
8922
|
const here = fileFromImportMeta();
|
|
8902
8923
|
if (!here) return null;
|
|
8903
|
-
let cur =
|
|
8924
|
+
let cur = import_node_path16.default.dirname(here);
|
|
8904
8925
|
for (let i = 0; i < 8; i++) {
|
|
8905
|
-
const pkg =
|
|
8926
|
+
const pkg = import_node_path16.default.join(cur, "package.json");
|
|
8906
8927
|
try {
|
|
8907
8928
|
if (import_node_fs15.default.existsSync(pkg)) {
|
|
8908
8929
|
const parsed = JSON.parse(import_node_fs15.default.readFileSync(pkg, "utf8"));
|
|
@@ -8910,7 +8931,7 @@ function resolveSootsimPackageDir() {
|
|
|
8910
8931
|
}
|
|
8911
8932
|
} catch {
|
|
8912
8933
|
}
|
|
8913
|
-
const parent =
|
|
8934
|
+
const parent = import_node_path16.default.dirname(cur);
|
|
8914
8935
|
if (parent === cur) break;
|
|
8915
8936
|
cur = parent;
|
|
8916
8937
|
}
|
|
@@ -8926,13 +8947,13 @@ function fileFromImportMeta() {
|
|
|
8926
8947
|
}
|
|
8927
8948
|
}
|
|
8928
8949
|
async function withStartLock(projectId, provider, fn) {
|
|
8929
|
-
const lockDir =
|
|
8950
|
+
const lockDir = import_node_path16.default.join(getUserDataDir(), "locks");
|
|
8930
8951
|
import_node_fs15.default.mkdirSync(lockDir, { recursive: true });
|
|
8931
8952
|
try {
|
|
8932
8953
|
import_node_fs15.default.chmodSync(lockDir, 448);
|
|
8933
8954
|
} catch {
|
|
8934
8955
|
}
|
|
8935
|
-
const lockPath =
|
|
8956
|
+
const lockPath = import_node_path16.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
8936
8957
|
const deadline = Date.now() + 4e3;
|
|
8937
8958
|
let fd = null;
|
|
8938
8959
|
while (fd === null) {
|
|
@@ -8983,7 +9004,7 @@ function isProcessAlive(pid) {
|
|
|
8983
9004
|
}
|
|
8984
9005
|
}
|
|
8985
9006
|
function mkfifoSync(p) {
|
|
8986
|
-
const parent =
|
|
9007
|
+
const parent = import_node_path16.default.dirname(p);
|
|
8987
9008
|
import_node_fs15.default.mkdirSync(parent, { recursive: true });
|
|
8988
9009
|
try {
|
|
8989
9010
|
import_node_fs15.default.chmodSync(parent, 448);
|
|
@@ -9048,7 +9069,7 @@ async function startSession(opts) {
|
|
|
9048
9069
|
const transcript = transcriptPath(session.id);
|
|
9049
9070
|
mkfifoSync(promptIn);
|
|
9050
9071
|
mkfifoSync(eventsOut);
|
|
9051
|
-
const transcriptDir =
|
|
9072
|
+
const transcriptDir = import_node_path16.default.dirname(transcript);
|
|
9052
9073
|
import_node_fs15.default.mkdirSync(transcriptDir, { recursive: true });
|
|
9053
9074
|
try {
|
|
9054
9075
|
import_node_fs15.default.chmodSync(transcriptDir, 448);
|
|
@@ -9482,7 +9503,7 @@ var AgentHost = class {
|
|
|
9482
9503
|
);
|
|
9483
9504
|
const project = upsertProject({
|
|
9484
9505
|
cwd: match.cwd,
|
|
9485
|
-
name: match.projectName ??
|
|
9506
|
+
name: match.projectName ?? import_node_path17.default.basename(match.cwd),
|
|
9486
9507
|
preferredProvider: input.provider ?? existing?.preferredProvider,
|
|
9487
9508
|
sourceRoots: existing?.sourceRoots ?? [match.cwd],
|
|
9488
9509
|
knownBundleUrls,
|
|
@@ -9502,9 +9523,9 @@ var AgentHost = class {
|
|
|
9502
9523
|
const dir = getUserDataDir();
|
|
9503
9524
|
return {
|
|
9504
9525
|
userDataDir: dir,
|
|
9505
|
-
storeFile:
|
|
9506
|
-
sessionsDir:
|
|
9507
|
-
transcriptsDir:
|
|
9526
|
+
storeFile: import_node_path17.default.join(dir, "attached-projects.json"),
|
|
9527
|
+
sessionsDir: import_node_path17.default.join(dir, "sessions"),
|
|
9528
|
+
transcriptsDir: import_node_path17.default.join(dir, "transcripts")
|
|
9508
9529
|
};
|
|
9509
9530
|
}
|
|
9510
9531
|
// --- subscription management ---
|
|
@@ -10212,7 +10233,7 @@ async function openUrl(url, options = {}) {
|
|
|
10212
10233
|
|
|
10213
10234
|
// src/host/plane-host.ts
|
|
10214
10235
|
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
10215
|
-
var
|
|
10236
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
10216
10237
|
|
|
10217
10238
|
// ../peach-box/src/planeProtocol.ts
|
|
10218
10239
|
var PLANE_FLAG_READ_ONLY = 1;
|
|
@@ -10293,7 +10314,7 @@ async function dispatchPlaneCommand(plane, type, msg, mutationOptions) {
|
|
|
10293
10314
|
// cli/commands/box/checkout-plane.ts
|
|
10294
10315
|
var import_node_child_process7 = require("node:child_process");
|
|
10295
10316
|
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
10296
|
-
var
|
|
10317
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
10297
10318
|
var CheckoutRequiresGitError = class extends Error {
|
|
10298
10319
|
};
|
|
10299
10320
|
var BINARY_SNIFF_BYTES = 8192;
|
|
@@ -10324,7 +10345,7 @@ var CheckoutFilePlane = class {
|
|
|
10324
10345
|
listTimeoutMs;
|
|
10325
10346
|
trackedOnly;
|
|
10326
10347
|
constructor(root, options = {}) {
|
|
10327
|
-
this.root =
|
|
10348
|
+
this.root = import_node_path18.default.resolve(root);
|
|
10328
10349
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
10329
10350
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
10330
10351
|
}
|
|
@@ -10386,13 +10407,13 @@ var CheckoutFilePlane = class {
|
|
|
10386
10407
|
if (!relative2) continue;
|
|
10387
10408
|
let stat2;
|
|
10388
10409
|
try {
|
|
10389
|
-
stat2 = import_node_fs17.default.statSync(
|
|
10410
|
+
stat2 = import_node_fs17.default.statSync(import_node_path18.default.join(this.root, relative2));
|
|
10390
10411
|
} catch {
|
|
10391
10412
|
continue;
|
|
10392
10413
|
}
|
|
10393
10414
|
if (!stat2.isFile()) continue;
|
|
10394
10415
|
const seen = this.sniffed.get(relative2);
|
|
10395
|
-
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
10416
|
+
const binary = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path18.default.join(this.root, relative2), stat2.size);
|
|
10396
10417
|
nextSniffed.set(relative2, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary });
|
|
10397
10418
|
next.set(relative2, {
|
|
10398
10419
|
size: stat2.size,
|
|
@@ -10406,8 +10427,8 @@ var CheckoutFilePlane = class {
|
|
|
10406
10427
|
this.sniffed = nextSniffed;
|
|
10407
10428
|
}
|
|
10408
10429
|
absolute(planePath) {
|
|
10409
|
-
const resolved =
|
|
10410
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
10430
|
+
const resolved = import_node_path18.default.resolve(this.root, planePath);
|
|
10431
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path18.default.sep}`)) {
|
|
10411
10432
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
10412
10433
|
}
|
|
10413
10434
|
return resolved;
|
|
@@ -10420,7 +10441,7 @@ var CheckoutFilePlane = class {
|
|
|
10420
10441
|
}
|
|
10421
10442
|
async write(planePath, content) {
|
|
10422
10443
|
const absolute = this.absolute(planePath);
|
|
10423
|
-
await import_node_fs17.default.promises.mkdir(
|
|
10444
|
+
await import_node_fs17.default.promises.mkdir(import_node_path18.default.dirname(absolute), { recursive: true });
|
|
10424
10445
|
await import_node_fs17.default.promises.writeFile(absolute, content);
|
|
10425
10446
|
this.entries.set(planePath, {
|
|
10426
10447
|
size: content.byteLength,
|
|
@@ -10556,7 +10577,7 @@ var PlaneHost = class {
|
|
|
10556
10577
|
// root and an opened one cannot disagree about the same directory.
|
|
10557
10578
|
realRoot(root) {
|
|
10558
10579
|
if (!root) throw new Error("root is required");
|
|
10559
|
-
const resolved =
|
|
10580
|
+
const resolved = import_node_path19.default.resolve(root);
|
|
10560
10581
|
let real;
|
|
10561
10582
|
try {
|
|
10562
10583
|
real = import_node_fs18.default.realpathSync(resolved);
|
|
@@ -10585,7 +10606,7 @@ var PlaneHost = class {
|
|
|
10585
10606
|
// src/host/replacement-module-handler.ts
|
|
10586
10607
|
var import_node_fs19 = require("node:fs");
|
|
10587
10608
|
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
10588
|
-
var
|
|
10609
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
10589
10610
|
|
|
10590
10611
|
// ../contrast-bundler/src/replacementModule.ts
|
|
10591
10612
|
var import_dist = require("sucrase/dist/index.js");
|
|
@@ -10910,13 +10931,13 @@ function sendJavaScript(req, res, source) {
|
|
|
10910
10931
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
10911
10932
|
}
|
|
10912
10933
|
function resolveLocalImport(fromFile, specifier) {
|
|
10913
|
-
const base =
|
|
10934
|
+
const base = import_node_path20.default.resolve(import_node_path20.default.dirname(fromFile), specifier);
|
|
10914
10935
|
const candidates = [
|
|
10915
10936
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
10916
|
-
(ext) => ext ===
|
|
10937
|
+
(ext) => ext === import_node_path20.default.extname(base).toLowerCase()
|
|
10917
10938
|
) ? [base] : [],
|
|
10918
10939
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
10919
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
10940
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path20.default.join(base, `index${ext}`))
|
|
10920
10941
|
];
|
|
10921
10942
|
const found = candidates.find(
|
|
10922
10943
|
(candidate) => (0, import_node_fs19.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
@@ -10974,13 +10995,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10974
10995
|
res.end("missing path param");
|
|
10975
10996
|
return true;
|
|
10976
10997
|
}
|
|
10977
|
-
const extension =
|
|
10998
|
+
const extension = import_node_path20.default.extname(targetPath).toLowerCase();
|
|
10978
10999
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
10979
11000
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10980
11001
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
10981
11002
|
return true;
|
|
10982
11003
|
}
|
|
10983
|
-
if (!
|
|
11004
|
+
if (!import_node_path20.default.isAbsolute(targetPath)) {
|
|
10984
11005
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10985
11006
|
res.end("replacement file path must be absolute");
|
|
10986
11007
|
return true;
|
|
@@ -10988,10 +11009,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10988
11009
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
10989
11010
|
let resolvedProjectRoot;
|
|
10990
11011
|
if (options.projectRoot) {
|
|
10991
|
-
const lexicalProjectRoot =
|
|
11012
|
+
const lexicalProjectRoot = import_node_path20.default.resolve(options.projectRoot);
|
|
10992
11013
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
10993
|
-
const lexicalTarget =
|
|
10994
|
-
if (lexicalTarget.startsWith("..") ||
|
|
11014
|
+
const lexicalTarget = import_node_path20.default.relative(lexicalProjectRoot, targetPath);
|
|
11015
|
+
if (lexicalTarget.startsWith("..") || import_node_path20.default.isAbsolute(lexicalTarget)) {
|
|
10995
11016
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10996
11017
|
res.end("replacement file must be inside the project root");
|
|
10997
11018
|
return true;
|
|
@@ -11007,8 +11028,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
11007
11028
|
return true;
|
|
11008
11029
|
}
|
|
11009
11030
|
if (resolvedProjectRoot) {
|
|
11010
|
-
const relativeTarget =
|
|
11011
|
-
if (relativeTarget.startsWith("..") ||
|
|
11031
|
+
const relativeTarget = import_node_path20.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
11032
|
+
if (relativeTarget.startsWith("..") || import_node_path20.default.isAbsolute(relativeTarget)) {
|
|
11012
11033
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
11013
11034
|
res.end("replacement file must be inside the project root");
|
|
11014
11035
|
return true;
|