peachsim 0.1.2438 → 0.1.2439
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/README.md +30 -98
- package/cli/app-catalog.ts +4 -73
- package/cli/catalog/content.ts +1 -1
- package/cli/cloud-box-artifact.ts +26 -39
- package/cli/cloud-client.ts +69 -117
- package/cli/cloud-session.ts +2 -9
- package/cli/commands/box.ts +6 -6
- package/cli/commands/control.ts +4 -11
- package/cli/commands/flow.ts +5 -9
- package/cli/commands/kotlin.ts +2 -1
- package/cli/commands/platform.ts +21 -39
- package/cli/commands/record-three.ts +1 -1
- package/cli/commands/shell-url.ts +29 -23
- package/cli/dev-build-freshness.ts +4 -3
- package/cli/native-input.ts +2 -2
- package/cli/outbound-endpoints.ts +20 -45
- package/cli/remote-project-bundle.ts +8 -14
- package/cli/remote-simulators.ts +1 -1
- package/cli/send-to-box.ts +2 -1
- package/detox/jest-preset.cjs +1 -1
- package/detox/jest-transform.cjs +40 -2
- package/dist-lib/agent-daemon-client.cjs +34 -24
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +19 -17
- package/dist-lib/auth/shared-session.cjs +18 -16
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -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 +20 -583
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +17 -99
- package/dist-lib/bundle-channel.cjs +8718 -5552
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +13 -363
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +34 -155
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +26 -155
- package/dist-lib/config.cjs +1 -4
- package/dist-lib/config.mjs +11 -30
- package/dist-lib/detox/index.cjs +2554 -230
- package/dist-lib/detox/jest-preset.cjs +1 -1
- package/dist-lib/detox/jest-transform.cjs +40 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/acorn-FGE4PYDJ.mjs +50 -0
- package/dist-lib/esm-chunks/chunk-2EUHEBIJ.mjs +664 -0
- package/dist-lib/esm-chunks/chunk-2NPABFPN.mjs +5719 -0
- package/dist-lib/esm-chunks/chunk-4ZFNH7TU.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-5T4XBUJP.mjs +1353 -0
- package/dist-lib/esm-chunks/chunk-6VY6HTJC.mjs +18951 -0
- package/dist-lib/esm-chunks/chunk-7HANEMO4.mjs +188 -0
- package/dist-lib/esm-chunks/chunk-C3WBGYP6.mjs +186 -0
- package/dist-lib/esm-chunks/chunk-CVGDRROP.mjs +57 -0
- package/dist-lib/esm-chunks/chunk-DADGQELM.mjs +375 -0
- package/dist-lib/esm-chunks/chunk-DEGYKHN7.mjs +12 -0
- package/dist-lib/esm-chunks/chunk-HIDNO3RP.mjs +10992 -0
- package/dist-lib/esm-chunks/chunk-HSADZOVN.mjs +30 -0
- package/dist-lib/esm-chunks/chunk-IWJUYJQO.mjs +42 -0
- package/dist-lib/esm-chunks/chunk-JCKI3VZ6.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-KSQ5KM5Y.mjs +17 -0
- package/dist-lib/esm-chunks/chunk-KVTIDLBK.mjs +598 -0
- package/dist-lib/esm-chunks/chunk-MIQSRBVU.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-YB27R6JG.mjs +115 -0
- package/dist-lib/esm-chunks/metro-layout-parser-MVUAXRUJ.mjs +58 -0
- package/dist-lib/expo-swift-bundle.cjs +7856 -4707
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +16 -165
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +15658 -11404
- package/dist-lib/host/fetch-proxy-handler.cjs +3927 -342
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -1
- package/dist-lib/host/replacement-module-handler.cjs +4 -4
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +9145 -32150
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +260 -253
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +5 -13
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +5 -6
- package/dist-lib/metro-production-bundle.cjs +22 -3
- package/dist-lib/metro-production-bundle.mjs +26 -92
- package/dist-lib/native-app-identity-project.cjs +663 -451
- package/dist-lib/native-app-identity-project.mjs +509 -2318
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +27 -1340
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +5 -18
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +5 -7
- package/dist-lib/profiles.cjs +2 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +246 -187
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +1059 -1238
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -1
- package/dist-lib/reap-browser.cjs +18 -7
- package/dist-lib/scripts/dev-server-scanner.cjs +6 -230
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +22 -78
- package/dist-lib/skills.cjs +21657 -17374
- package/dist-lib/swift-compile.cjs +1343 -1318
- package/dist-lib/swift-compile.mjs +68 -19013
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +35 -630
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +9 -24
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +18061 -0
- package/dist-lib/vendor/acorn.cjs +5699 -0
- package/dist-lib/vendor/bplist-parser.cjs +1589 -0
- package/dist-lib/vendor/ignore.cjs +455 -0
- package/dist-lib/vendor/magic-string.cjs +1693 -0
- package/dist-lib/vendor/plist.cjs +10978 -0
- package/dist-lib/vendor/smol-toml.cjs +768 -0
- package/dist-lib/vendor/stream-json.cjs +1997 -0
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +23593 -0
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +15750 -0
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +11316 -0
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +482 -0
- package/dist-lib/vendor/sucrase.cjs +23593 -0
- package/dist-lib/vendor/terser.cjs +36874 -0
- package/dist-lib/vendor/valibot.cjs +6253 -0
- package/dist-lib/vendor/zod.cjs +23262 -0
- package/dist-lib/worklet-executable.cjs +3 -3
- package/dist-lib/worklet-executable.mjs +11 -16
- package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
- package/kotlin/fork/NOTICE +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/kotlin/toolchain.json +6 -6
- package/package.json +17 -121
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +13 -223
- package/src/android-autolinking.ts +2 -2
- package/src/bundle-channel.mjs +3 -15
- package/src/cloud-contract.ts +3 -4
- package/src/config.ts +0 -5
- package/src/host/bridge-host.ts +19 -1
- package/src/host/server-scan-handler.ts +1 -9
- package/src/index.ts +0 -2
- package/src/kotlin-host.ts +1 -2
- package/src/kotlinDiscoveryContract.ts +1 -0
- package/src/metro-production-bundle.ts +28 -6
- package/src/native-seam-manifest.ts +0 -13
- package/src/one-native-app-catalog.ts +8 -27
- package/src/one-native-app-config.ts +95 -0
- package/src/one-native-source.ts +250 -0
- package/src/one-widget-metadata.ts +45 -126
- package/src/oneWidgetContract.ts +80 -117
- package/src/serverDiscoveryContract.ts +0 -1
- package/src/simulator-route.ts +8 -0
- package/src/vite-plugin.ts +2 -2
- package/src/xcode-project.ts +1 -1
- package/dist-lib/metro.cjs +0 -27984
- package/dist-lib/vite-swift.cjs +0 -43376
- package/dist-lib/vite.cjs +0 -21456
- package/src/androidAutolinkingContract.ts +0 -48
- package/src/androidRootModuleContract.ts +0 -39
- package/src/dev-server-open.ts +0 -92
- package/src/metro-plugin.ts +0 -578
- package/src/one-widget-discovery.ts +0 -23
- package/src/swift-vite-lifetime.ts +0 -42
- package/src/vite-plugin-one.ts +0 -746
- package/src/vite-plugin-swift.ts +0 -225
- package/src/vite.d.ts +0 -10
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
alignLoopbackBundleUrlWithProbe,
|
|
38
38
|
normalizeNativeDevBundleUrl,
|
|
39
39
|
} from '../src/native-dev-bundle-url.ts'
|
|
40
|
-
import { configuredWidgetFromScan } from '../src/oneWidgetContract'
|
|
41
40
|
import {
|
|
42
41
|
__resetAppSettingsBundleCacheForTests,
|
|
43
42
|
readAppSettingsBundle,
|
|
@@ -48,7 +47,6 @@ import {
|
|
|
48
47
|
parseSwiftHostDiscovery,
|
|
49
48
|
} from '../src/swiftDiscoveryContract'
|
|
50
49
|
import { loadOptionalDemoApps, optionalDemoAppsSync } from './optional-demo-registry.ts'
|
|
51
|
-
import type { ConfiguredOneWidget } from '../src/oneWidgetContract'
|
|
52
50
|
import type { DiscoveredServer } from '../src/serverDiscoveryContract'
|
|
53
51
|
|
|
54
52
|
export type { DiscoveredServer } from '../src/serverDiscoveryContract'
|
|
@@ -327,13 +325,6 @@ const TIMEOUT_MS = 250
|
|
|
327
325
|
// (404|502)" regression on monorepo One projects (apps/<name>/...). give
|
|
328
326
|
// the manifest more headroom so the canonical launchAsset.url wins.
|
|
329
327
|
const MANIFEST_TIMEOUT_MS = 1500
|
|
330
|
-
/**
|
|
331
|
-
* marks the scanner's /__server-scan probe of a candidate port. the probe reads
|
|
332
|
-
* only a One server's entry for itself, which a peach host's list never holds,
|
|
333
|
-
* so a host answers it from what it already knows instead of scanning the
|
|
334
|
-
* machine: otherwise every scan sets off one more in each host it probes.
|
|
335
|
-
*/
|
|
336
|
-
export const SERVER_SCAN_PROBE_HEADER = 'x-peach-scan-probe'
|
|
337
328
|
// cheap TCP-connect check gate for HTTP probes — if we can't open a socket
|
|
338
329
|
// within this budget the port isn't actually reachable, and all 5 HTTP probes
|
|
339
330
|
// would just time out for nothing.
|
|
@@ -1017,7 +1008,7 @@ function applyManifest(
|
|
|
1017
1008
|
buildLoopbackProbeBaseUrl('http:', manifestRes.hostname, result.port),
|
|
1018
1009
|
)
|
|
1019
1010
|
: undefined
|
|
1020
|
-
if (launchUrl && !
|
|
1011
|
+
if (launchUrl && !isDirectOneBundleUrl(result.bundleUrl)) {
|
|
1021
1012
|
result.bundleUrl = withRuntimeConfig(result.port, launchUrl, result.cwd)
|
|
1022
1013
|
}
|
|
1023
1014
|
// expo's withIosIcons.ts selects its base icon as light || dark || tinted.
|
|
@@ -1174,58 +1165,19 @@ async function fetchManifestEnrichment(
|
|
|
1174
1165
|
invalidatePortCache(result.port)
|
|
1175
1166
|
}
|
|
1176
1167
|
|
|
1177
|
-
// ports confirmed to be running a non-sootsim dev server — safe to skip the
|
|
1178
|
-
// /__peachsim/ probe on subsequent scans. cleared when the port disappears from the
|
|
1179
|
-
// listening set (process restarted, could now be a different server).
|
|
1180
|
-
const knownNonPatched = new Set<number>()
|
|
1181
|
-
|
|
1182
1168
|
// ports confirmed to be a one/vxrn dev server. on these, we skip the manifest
|
|
1183
1169
|
// probe (`GET /` with expo-platform headers) on subsequent scans: one already
|
|
1184
1170
|
// served the bundle HEAD so we know what it is, AND one's Expo Go manifest
|
|
1185
1171
|
// middleware crashes the whole server when a probe aborts mid-stream
|
|
1186
1172
|
// (Cannot pipe to a closed or destroyed stream → unhandled rejection → exit).
|
|
1187
1173
|
// the bundle URL is enough; no information is lost by skipping the manifest.
|
|
1188
|
-
//
|
|
1189
|
-
// disappearance, owning-pid change, and __resetScannerCache.
|
|
1174
|
+
// cleared on port disappearance, owning-pid change, and __resetScannerCache.
|
|
1190
1175
|
const knownOne = new Set<number>()
|
|
1191
|
-
const oneNativeApps = new Map<number, { root: string; bundleId: string }>()
|
|
1192
|
-
|
|
1193
|
-
function oneNativeWidgetFromScan(
|
|
1194
|
-
scan: unknown,
|
|
1195
|
-
result: DiscoveredServer,
|
|
1196
|
-
identity: { root: string; bundleId: string },
|
|
1197
|
-
): ConfiguredOneWidget | null {
|
|
1198
|
-
if (!Array.isArray(scan)) return null
|
|
1199
|
-
for (const entry of scan) {
|
|
1200
|
-
if (!entry || typeof entry !== 'object' || entry.port !== result.port) continue
|
|
1201
|
-
if (typeof entry.bundleUrl !== 'string') continue
|
|
1202
|
-
let advertised: URL
|
|
1203
|
-
try {
|
|
1204
|
-
advertised = new URL(entry.bundleUrl)
|
|
1205
|
-
} catch {
|
|
1206
|
-
continue
|
|
1207
|
-
}
|
|
1208
|
-
if (!isLoopbackHost(advertised.hostname) || advertised.port !== String(result.port))
|
|
1209
|
-
continue
|
|
1210
|
-
const widget = configuredWidgetFromScan(scan, advertised.href)
|
|
1211
|
-
if (
|
|
1212
|
-
widget?.projectRoot === identity.root &&
|
|
1213
|
-
widget.metadata.bundleId === identity.bundleId
|
|
1214
|
-
)
|
|
1215
|
-
return {
|
|
1216
|
-
...widget,
|
|
1217
|
-
bundleUrl: result.bundleUrl,
|
|
1218
|
-
packageUrl: new URL('/__peach/swift-package/OneWidgets', result.bundleUrl).href,
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
return null
|
|
1222
|
-
}
|
|
1223
1176
|
|
|
1224
1177
|
// fire signature probes in waves and pick the best match by precedence:
|
|
1225
1178
|
// 1. expo manifest (JSON manifest at /)
|
|
1226
1179
|
// 2. metro/expo (packager-status:running on /status)
|
|
1227
|
-
// 3.
|
|
1228
|
-
// 4. one/vxrn (HEAD on /node_modules/one/metro-entry.bundle) — only
|
|
1180
|
+
// 3. one/vxrn (HEAD on /node_modules/one/metro-entry.bundle) — only
|
|
1229
1181
|
// fires as a true last resort; on expo apps this probe
|
|
1230
1182
|
// crashes metro by triggering HmrServer.registerEntryPoint
|
|
1231
1183
|
// for a path metro can't resolve, so we never fire it
|
|
@@ -1271,7 +1223,6 @@ export async function probePort(
|
|
|
1271
1223
|
|
|
1272
1224
|
// wave 1 — safe parallel probes. none of these mutate metro state. a known
|
|
1273
1225
|
// verdict skips its probe and counts as answered.
|
|
1274
|
-
const skipPatched = knownNonPatched.has(port)
|
|
1275
1226
|
const skipManifest = knownOne.has(port)
|
|
1276
1227
|
const [[statusRes, manifestRes], owner] = await Promise.all([
|
|
1277
1228
|
Promise.all([
|
|
@@ -1288,30 +1239,11 @@ export async function probePort(
|
|
|
1288
1239
|
// a busy one is slow enough to miss the manifest timeout. the host and scan
|
|
1289
1240
|
// endpoints below belong to other servers, so asking a metro packager only
|
|
1290
1241
|
// burns its web build. a packager is the metro status body, other than one
|
|
1291
|
-
// whose manifest names a One entry
|
|
1292
|
-
//
|
|
1242
|
+
// whose manifest names a One entry; a spa fallback answers 200 html to every
|
|
1243
|
+
// path and never matches the status body.
|
|
1293
1244
|
const manifestParsed = manifestRes ? safeParseManifest(manifestRes.body) : null
|
|
1294
1245
|
const { launchUrl: manifestLaunchUrl, client: manifestClient } =
|
|
1295
1246
|
readExpoManifestFields(manifestParsed)
|
|
1296
|
-
const metadata = manifestParsed?.metadata
|
|
1297
|
-
const extra = manifestParsed?.extra
|
|
1298
|
-
const expoGo = extra && typeof extra === 'object' ? Reflect.get(extra, 'expoGo') : null
|
|
1299
|
-
const developer =
|
|
1300
|
-
expoGo && typeof expoGo === 'object' ? Reflect.get(expoGo, 'developer') : null
|
|
1301
|
-
const projectRoot =
|
|
1302
|
-
developer && typeof developer === 'object'
|
|
1303
|
-
? Reflect.get(developer, 'projectRoot')
|
|
1304
|
-
: null
|
|
1305
|
-
const bundleId = manifestClient.ios?.bundleIdentifier
|
|
1306
|
-
if (
|
|
1307
|
-
metadata &&
|
|
1308
|
-
typeof metadata === 'object' &&
|
|
1309
|
-
Reflect.get(metadata, 'oneNativeApp') === true &&
|
|
1310
|
-
typeof projectRoot === 'string' &&
|
|
1311
|
-
typeof bundleId === 'string'
|
|
1312
|
-
)
|
|
1313
|
-
oneNativeApps.set(port, { root: projectRoot, bundleId })
|
|
1314
|
-
else if (manifestRes) oneNativeApps.delete(port)
|
|
1315
1247
|
// `manifestRes === null` means the probe got NO answer — it timed out or the
|
|
1316
1248
|
// connection failed. that is not the same fact as a server that answered and
|
|
1317
1249
|
// turned out to have no manifest, and only the second one licenses the
|
|
@@ -1327,71 +1259,13 @@ export async function probePort(
|
|
|
1327
1259
|
manifestState === 'resolved' &&
|
|
1328
1260
|
manifestLaunchUrl?.includes('/one/metro-entry.bundle')
|
|
1329
1261
|
)
|
|
1330
|
-
const [
|
|
1331
|
-
? [null, null
|
|
1262
|
+
const [swiftRes, kotlinRes] = metroPackager
|
|
1263
|
+
? [null, null]
|
|
1332
1264
|
: await Promise.all([
|
|
1333
|
-
skipPatched
|
|
1334
|
-
? Promise.resolve(null)
|
|
1335
|
-
: httpGet(probeHostname, port, '/__peachsim/'),
|
|
1336
1265
|
httpGet(probeHostname, port, SWIFT_DISCOVERY_PATH),
|
|
1337
1266
|
httpGet(probeHostname, port, KOTLIN_DISCOVERY_PATH),
|
|
1338
|
-
httpGet(probeHostname, port, '/__server-scan', 'GET', MANIFEST_TIMEOUT_MS, {
|
|
1339
|
-
[SERVER_SCAN_PROBE_HEADER]: '1',
|
|
1340
|
-
}),
|
|
1341
1267
|
])
|
|
1342
1268
|
|
|
1343
|
-
// the One plugin advertises its exact native entry, including replacement
|
|
1344
|
-
// identity. native.app's Expo Go manifest can instead advertise index.bundle.
|
|
1345
|
-
const oneScan =
|
|
1346
|
-
oneScanRes?.statusCode === 200 ? safeParseManifest(oneScanRes.body) : null
|
|
1347
|
-
if (Array.isArray(oneScan)) {
|
|
1348
|
-
for (const entry of oneScan) {
|
|
1349
|
-
if (
|
|
1350
|
-
!entry ||
|
|
1351
|
-
typeof entry !== 'object' ||
|
|
1352
|
-
entry.framework !== 'one' ||
|
|
1353
|
-
entry.port !== port ||
|
|
1354
|
-
typeof entry.bundleUrl !== 'string'
|
|
1355
|
-
)
|
|
1356
|
-
continue
|
|
1357
|
-
let bundle: URL
|
|
1358
|
-
try {
|
|
1359
|
-
bundle = new URL(entry.bundleUrl)
|
|
1360
|
-
} catch {
|
|
1361
|
-
continue
|
|
1362
|
-
}
|
|
1363
|
-
if (
|
|
1364
|
-
bundle.protocol !== 'http:' ||
|
|
1365
|
-
!isLoopbackHost(bundle.hostname) ||
|
|
1366
|
-
bundle.port !== String(port) ||
|
|
1367
|
-
!bundle.pathname.endsWith('/one/metro-entry.bundle')
|
|
1368
|
-
)
|
|
1369
|
-
continue
|
|
1370
|
-
knownOne.add(port)
|
|
1371
|
-
return enrichWithManifest(
|
|
1372
|
-
applyManifest(
|
|
1373
|
-
{
|
|
1374
|
-
port,
|
|
1375
|
-
framework: 'one',
|
|
1376
|
-
bundleUrl: withRuntimeConfig(
|
|
1377
|
-
port,
|
|
1378
|
-
alignLoopbackBundleUrlWithProbe(
|
|
1379
|
-
bundle.href,
|
|
1380
|
-
buildLoopbackProbeBaseUrl('http:', probeHostname, port),
|
|
1381
|
-
),
|
|
1382
|
-
owner.cwd,
|
|
1383
|
-
),
|
|
1384
|
-
lastSeen: Date.now(),
|
|
1385
|
-
...owner,
|
|
1386
|
-
},
|
|
1387
|
-
manifestRes,
|
|
1388
|
-
buildIconProxyUrl,
|
|
1389
|
-
),
|
|
1390
|
-
buildIconProxyUrl,
|
|
1391
|
-
)
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
1269
|
const swift =
|
|
1396
1270
|
swiftRes?.statusCode === 200
|
|
1397
1271
|
? parseSwiftHostDiscovery(safeParseManifest(swiftRes.body))
|
|
@@ -1437,7 +1311,6 @@ export async function probePort(
|
|
|
1437
1311
|
// /node_modules/one/metro-entry.bundle constant we used as a discriminator
|
|
1438
1312
|
// below, so we check the manifest FIRST.
|
|
1439
1313
|
if (manifestState === 'resolved') {
|
|
1440
|
-
knownNonPatched.add(port)
|
|
1441
1314
|
const launchUrl =
|
|
1442
1315
|
manifestLaunchUrl ||
|
|
1443
1316
|
`${buildLoopbackProbeBaseUrl('http:', probeHostname, port)}/index.bundle?platform=ios&dev=true&hot=true&minify=false`
|
|
@@ -1477,7 +1350,6 @@ export async function probePort(
|
|
|
1477
1350
|
// identifying expo/metro instances here from their /status response we
|
|
1478
1351
|
// never fire the HEAD against them.
|
|
1479
1352
|
if (statusRes && statusRes.body.includes('packager-status:running')) {
|
|
1480
|
-
knownNonPatched.add(port)
|
|
1481
1353
|
// `makeResult` builds the entry the app's native delegate names. that is
|
|
1482
1354
|
// the RIGHT answer for a vanilla Metro or plain Expo packager, which is a
|
|
1483
1355
|
// server that ANSWERED `/` and had no manifest to give. it is a guess when
|
|
@@ -1494,36 +1366,6 @@ export async function probePort(
|
|
|
1494
1366
|
)
|
|
1495
1367
|
}
|
|
1496
1368
|
|
|
1497
|
-
// patched sootsim — fallback for legacy /__peachsim/ patched servers. also
|
|
1498
|
-
// checked before the one HEAD for the same reason.
|
|
1499
|
-
if (
|
|
1500
|
-
sootsimRes &&
|
|
1501
|
-
sootsimRes.statusCode === 200 &&
|
|
1502
|
-
sootsimRes.body.includes('sootsim-patched')
|
|
1503
|
-
) {
|
|
1504
|
-
knownNonPatched.delete(port)
|
|
1505
|
-
return enrichWithManifest(
|
|
1506
|
-
applyManifest(
|
|
1507
|
-
{
|
|
1508
|
-
port,
|
|
1509
|
-
framework: 'one',
|
|
1510
|
-
bundleUrl: withRuntimeConfig(
|
|
1511
|
-
port,
|
|
1512
|
-
`${buildLoopbackProbeBaseUrl('http:', probeHostname, port)}/__peachsim/bundle.js`,
|
|
1513
|
-
owner.cwd,
|
|
1514
|
-
),
|
|
1515
|
-
hmrUrl: `${buildLoopbackProbeBaseUrl('ws:', probeHostname, port)}/hot`,
|
|
1516
|
-
lastSeen: Date.now(),
|
|
1517
|
-
patched: true,
|
|
1518
|
-
...owner,
|
|
1519
|
-
},
|
|
1520
|
-
manifestRes,
|
|
1521
|
-
buildIconProxyUrl,
|
|
1522
|
-
),
|
|
1523
|
-
buildIconProxyUrl,
|
|
1524
|
-
)
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
1369
|
// wave 2 — one/vxrn HEAD probe. only fired as a true last resort, since
|
|
1528
1370
|
// it has the metro side-effect documented above. older One bare-dev-server
|
|
1529
1371
|
// setups that don't serve a manifest still resolve through this path; new
|
|
@@ -1545,8 +1387,8 @@ export async function probePort(
|
|
|
1545
1387
|
(statusRes && statusRes.statusCode === 200) ||
|
|
1546
1388
|
(manifestRes && manifestRes.statusCode === 200 && manifestParsed != null)
|
|
1547
1389
|
if (looksLikeMetroPackager) {
|
|
1548
|
-
//
|
|
1549
|
-
//
|
|
1390
|
+
// a fresh wave-1 pass next scan sees the packager once its manifest and
|
|
1391
|
+
// status are ready.
|
|
1550
1392
|
return null
|
|
1551
1393
|
}
|
|
1552
1394
|
|
|
@@ -1558,7 +1400,6 @@ export async function probePort(
|
|
|
1558
1400
|
// one's native dev engine serves text/javascript; metro uses application/javascript.
|
|
1559
1401
|
/^(?:application|text)\/javascript(?:\s*;|$)/i.test(oneRes.contentType?.trim() || '')
|
|
1560
1402
|
) {
|
|
1561
|
-
knownNonPatched.add(port)
|
|
1562
1403
|
knownOne.add(port)
|
|
1563
1404
|
return enrichWithManifest(
|
|
1564
1405
|
applyManifest(
|
|
@@ -1581,16 +1422,12 @@ export async function probePort(
|
|
|
1581
1422
|
)
|
|
1582
1423
|
}
|
|
1583
1424
|
|
|
1584
|
-
// only an answer is knowledge: a /__peachsim/ that never answered is asked again
|
|
1585
|
-
if (sootsimRes) knownNonPatched.add(port)
|
|
1586
1425
|
if (verdict) {
|
|
1587
1426
|
verdict.answeredNegative =
|
|
1588
|
-
(skipPatched || sootsimRes !== null) &&
|
|
1589
1427
|
statusRes !== null &&
|
|
1590
1428
|
(skipManifest || manifestRes !== null) &&
|
|
1591
1429
|
swiftRes !== null &&
|
|
1592
1430
|
kotlinRes !== null &&
|
|
1593
|
-
oneScanRes !== null &&
|
|
1594
1431
|
oneRes !== null
|
|
1595
1432
|
}
|
|
1596
1433
|
return null
|
|
@@ -1686,9 +1523,7 @@ export function __shouldReuseScannerCacheEntry(
|
|
|
1686
1523
|
// exported for tests / `peach debug` — forces the next scan to re-probe.
|
|
1687
1524
|
export function __resetScannerCache() {
|
|
1688
1525
|
portCache.clear()
|
|
1689
|
-
knownNonPatched.clear()
|
|
1690
1526
|
knownOne.clear()
|
|
1691
|
-
oneNativeApps.clear()
|
|
1692
1527
|
enrichmentCache.clear()
|
|
1693
1528
|
enrichmentInFlight.clear()
|
|
1694
1529
|
portCacheInvalidatedAt.clear()
|
|
@@ -1734,20 +1569,14 @@ export async function scanDevServers(
|
|
|
1734
1569
|
const currentPorts = new Set(processes.map((p) => p.port))
|
|
1735
1570
|
|
|
1736
1571
|
// evict cache entries for ports that disappeared. a restarted process may
|
|
1737
|
-
// bring up a different server
|
|
1738
|
-
//
|
|
1572
|
+
// bring up a different server on the same port, and the caches need to let
|
|
1573
|
+
// go so the next probe sees the new state.
|
|
1739
1574
|
for (const p of [...portCache.keys()]) {
|
|
1740
1575
|
if (!currentPorts.has(p)) portCache.delete(p)
|
|
1741
1576
|
}
|
|
1742
|
-
for (const p of [...knownNonPatched]) {
|
|
1743
|
-
if (!currentPorts.has(p)) knownNonPatched.delete(p)
|
|
1744
|
-
}
|
|
1745
1577
|
for (const p of [...knownOne]) {
|
|
1746
1578
|
if (!currentPorts.has(p)) knownOne.delete(p)
|
|
1747
1579
|
}
|
|
1748
|
-
for (const p of [...oneNativeApps.keys()]) {
|
|
1749
|
-
if (!currentPorts.has(p)) oneNativeApps.delete(p)
|
|
1750
|
-
}
|
|
1751
1580
|
for (const p of [...enrichmentCache.keys()]) {
|
|
1752
1581
|
if (!currentPorts.has(p)) enrichmentCache.delete(p)
|
|
1753
1582
|
}
|
|
@@ -1767,22 +1596,16 @@ export async function scanDevServers(
|
|
|
1767
1596
|
// so we can't trust the cache — reprobe.
|
|
1768
1597
|
const retryNegative =
|
|
1769
1598
|
opts.fresh === true && cached?.result === null && cached.answeredNegative
|
|
1770
|
-
if (retryNegative) {
|
|
1771
|
-
// middleware may mount on the same listener after its negative answer.
|
|
1772
|
-
knownNonPatched.delete(port)
|
|
1773
|
-
}
|
|
1774
1599
|
if (cached && !retryNegative && __shouldReuseScannerCacheEntry(cached, pid)) {
|
|
1775
1600
|
if (cached.result) results.push(cached.result)
|
|
1776
1601
|
continue
|
|
1777
1602
|
}
|
|
1778
1603
|
// pid changed or cache expired — drop any endpoint-specific verdicts so
|
|
1779
1604
|
// the re-probe starts from scratch. otherwise a restarted process that
|
|
1780
|
-
// swapped frameworks keeps the old skip
|
|
1781
|
-
//
|
|
1605
|
+
// swapped frameworks keeps the old skip-manifest decision, and the
|
|
1606
|
+
// scanner never discovers the new server.
|
|
1782
1607
|
if (cached && cached.pid !== pid) {
|
|
1783
|
-
knownNonPatched.delete(port)
|
|
1784
1608
|
knownOne.delete(port)
|
|
1785
|
-
oneNativeApps.delete(port)
|
|
1786
1609
|
// a restarted process may be a different app — drop its captured name/icon.
|
|
1787
1610
|
enrichmentCache.delete(port)
|
|
1788
1611
|
localIconPathCache.delete(port)
|
|
@@ -1815,39 +1638,6 @@ export async function scanDevServers(
|
|
|
1815
1638
|
})
|
|
1816
1639
|
}
|
|
1817
1640
|
|
|
1818
|
-
// the app server's Vite root, rather than a process cwd, owns widget metadata,
|
|
1819
|
-
// and its /__server-scan reads it from source on every request, so each scan
|
|
1820
|
-
// asks again within the budget wave 1 gives that endpoint. a server too busy
|
|
1821
|
-
// to answer keeps the widget it last advertised: no answer is not the answer
|
|
1822
|
-
// "no widget".
|
|
1823
|
-
await Promise.all(
|
|
1824
|
-
results.map(async (result) => {
|
|
1825
|
-
const nativeIdentity = oneNativeApps.get(result.port)
|
|
1826
|
-
if (result.framework !== 'one' && result.framework !== 'vxrn' && !nativeIdentity) {
|
|
1827
|
-
result.widget = null
|
|
1828
|
-
return
|
|
1829
|
-
}
|
|
1830
|
-
const scanRes = await httpGet(
|
|
1831
|
-
normalizeHostname(new URL(result.bundleUrl).hostname),
|
|
1832
|
-
result.port,
|
|
1833
|
-
'/__server-scan',
|
|
1834
|
-
'GET',
|
|
1835
|
-
MANIFEST_TIMEOUT_MS,
|
|
1836
|
-
)
|
|
1837
|
-
if (!scanRes) {
|
|
1838
|
-
result.widget ??= null
|
|
1839
|
-
return
|
|
1840
|
-
}
|
|
1841
|
-
const scan =
|
|
1842
|
-
scanRes.statusCode === 200 && scanRes.contentType?.includes('json')
|
|
1843
|
-
? safeParseManifest(scanRes.body)
|
|
1844
|
-
: null
|
|
1845
|
-
result.widget = nativeIdentity
|
|
1846
|
-
? oneNativeWidgetFromScan(scan, result, nativeIdentity)
|
|
1847
|
-
: configuredWidgetFromScan(scan, result.bundleUrl)
|
|
1848
|
-
}),
|
|
1849
|
-
)
|
|
1850
|
-
|
|
1851
1641
|
// attach pid + cwd. pid comes from the listening-process scan; cwd is
|
|
1852
1642
|
// lsof-resolved and cached per pid. both enable auto-attach of agent
|
|
1853
1643
|
// sessions to the right project without a manual `sootsim agent attach`.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import { createRequire } from 'node:module'
|
|
4
4
|
import path from 'node:path'
|
|
5
|
-
import { readAndroidAutolinkedPackages } from '
|
|
5
|
+
import { readAndroidAutolinkedPackages } from '@peach/globals/android-autolinking'
|
|
6
6
|
import { autolinkerJson, runAutolinker } from './autolinker-process'
|
|
7
7
|
import { isRecord } from './is-record'
|
|
8
8
|
import { reactNativeAutolinkingConfig } from './react-native-autolinking'
|
|
9
|
-
import type { AndroidAutolinkedDependency } from '
|
|
9
|
+
import type { AndroidAutolinkedDependency } from '@peach/globals/android-autolinking'
|
|
10
10
|
|
|
11
11
|
const resolving = new Map<string, Promise<readonly Record<string, unknown>[]>>()
|
|
12
12
|
|
package/src/bundle-channel.mjs
CHANGED
|
@@ -18,9 +18,7 @@ import {
|
|
|
18
18
|
import { terminateProcessGroup } from './process-group'
|
|
19
19
|
import {
|
|
20
20
|
discoverAppCatalog,
|
|
21
|
-
|
|
22
|
-
oneDeclaredAppCatalog,
|
|
23
|
-
readProjectOneNativeAppCatalog,
|
|
21
|
+
discoverProjectOneNativeAppCatalog,
|
|
24
22
|
} from '../cli/app-catalog'
|
|
25
23
|
import { captureStagedHostFiles } from './host/staged-host-files'
|
|
26
24
|
|
|
@@ -333,7 +331,7 @@ async function packagePlatformBundle(
|
|
|
333
331
|
projectRoot,
|
|
334
332
|
platform,
|
|
335
333
|
bundle,
|
|
336
|
-
{ config, versions, readAssetFile, configuration
|
|
334
|
+
{ config, versions, readAssetFile, configuration },
|
|
337
335
|
) {
|
|
338
336
|
const { produceConfiguredBundle } = await import('./configured-bundle-producer')
|
|
339
337
|
const assets = new Map()
|
|
@@ -361,8 +359,7 @@ async function packagePlatformBundle(
|
|
|
361
359
|
if (platform === 'ios') {
|
|
362
360
|
const captured = await captureStagedHostFiles(async () =>
|
|
363
361
|
(await discoverAppCatalog(projectRoot, 'https://packaged.invalid')) ??
|
|
364
|
-
(
|
|
365
|
-
(oneDeclared ? oneDeclaredAppCatalog(oneDeclared, 'https://packaged.invalid') : null),
|
|
362
|
+
discoverProjectOneNativeAppCatalog(projectRoot, 'https://packaged.invalid'),
|
|
366
363
|
)
|
|
367
364
|
if (captured.value) {
|
|
368
365
|
appCatalog = {
|
|
@@ -461,7 +458,6 @@ export async function snapshotDevServerBundles(
|
|
|
461
458
|
await packagePlatformBundle(projectRoot, platform, bundle, {
|
|
462
459
|
...inputs,
|
|
463
460
|
configuration: 'Debug',
|
|
464
|
-
devOrigin: origin,
|
|
465
461
|
readAssetFile: async (asset, file) => {
|
|
466
462
|
const response = await fetch(
|
|
467
463
|
`${origin}${asset.httpServerLocation}/${file}?platform=${platform}&hash=${asset.hash}`,
|
|
@@ -490,13 +486,6 @@ export async function snapshotOneProductionBundle(
|
|
|
490
486
|
const { tmpdir } = await import('node:os')
|
|
491
487
|
const { promisify } = await import('node:util')
|
|
492
488
|
const inputs = await readPackagingInputs(projectRoot)
|
|
493
|
-
const oneDeclared = platforms.includes('ios')
|
|
494
|
-
? await readProjectOneNativeAppCatalog(
|
|
495
|
-
projectRoot,
|
|
496
|
-
{ ...process.env, ...env, NODE_ENV: 'production' },
|
|
497
|
-
runtimeExecutable,
|
|
498
|
-
)
|
|
499
|
-
: null
|
|
500
489
|
const snapshots = []
|
|
501
490
|
for (const platform of platforms) {
|
|
502
491
|
const out = await mkdtemp(join(tmpdir(), 'peach-production-bundle-'))
|
|
@@ -519,7 +508,6 @@ export async function snapshotOneProductionBundle(
|
|
|
519
508
|
snapshots.push(
|
|
520
509
|
await packagePlatformBundle(projectRoot, platform, await readFile(join(out, 'bundle.js')), {
|
|
521
510
|
...inputs,
|
|
522
|
-
oneDeclared,
|
|
523
511
|
configuration: 'Release',
|
|
524
512
|
readAssetFile: (asset, file) =>
|
|
525
513
|
readFile(join(out, asset.httpServerLocation, file)),
|
package/src/cloud-contract.ts
CHANGED
|
@@ -261,9 +261,8 @@ export interface RnxCloudSimView {
|
|
|
261
261
|
// one simulator as create and get report it, with the watch URL a browser
|
|
262
262
|
// opens to see it.
|
|
263
263
|
export interface RnxCloudSimInstance extends RnxCloudSimView {
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
streamUrl: string | null
|
|
264
|
+
/** the simulator page for members of the owning account. */
|
|
265
|
+
streamUrl: string
|
|
267
266
|
}
|
|
268
267
|
|
|
269
268
|
// the create/reuse answer: the receipt the box path also returns, plus what
|
|
@@ -272,7 +271,7 @@ export interface RnxCloudSimCreateResponse extends RnxCloudCreateReceipt {
|
|
|
272
271
|
token: string
|
|
273
272
|
status: RnxCloudSimStatus
|
|
274
273
|
labels: Record<string, string>
|
|
275
|
-
streamUrl: string
|
|
274
|
+
streamUrl: string
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
// one grammar for the create map and the list selector: `key=value,key2=value2`.
|
package/src/config.ts
CHANGED
|
@@ -30,11 +30,6 @@ export type ModuleResolution =
|
|
|
30
30
|
| { file: string } // resolve to a file relative to the config
|
|
31
31
|
| { inline: Record<string, any> } // inline stub object
|
|
32
32
|
|
|
33
|
-
// a production bundle has no module paths, so the build tags each workspace
|
|
34
|
-
// module a config `modules` entry names with an assignment of this global to the
|
|
35
|
-
// entry's key; the engine finds the tagged factory and substitutes it
|
|
36
|
-
export const PEACH_WORKSPACE_MODULE_MARKER = '__peach_workspace_module'
|
|
37
|
-
|
|
38
33
|
// match a metro module name against config.modules patterns.
|
|
39
34
|
// config keys match as path prefixes: key "modules/bottom-sheet" matches
|
|
40
35
|
// any module whose name contains "/modules/bottom-sheet/"
|
package/src/host/bridge-host.ts
CHANGED
|
@@ -43,8 +43,14 @@ import {
|
|
|
43
43
|
type DevBridgeLockfile,
|
|
44
44
|
type SharedConfig,
|
|
45
45
|
} from '../home-paths.ts'
|
|
46
|
+
import { KOTLIN_PACKAGE_PATH } from '../kotlinDiscoveryContract'
|
|
46
47
|
import { handleNitroRequest, NITRO_ROUTE } from '../nitro-bundle.ts'
|
|
48
|
+
import {
|
|
49
|
+
handleOneNativeSourceRequest,
|
|
50
|
+
handleOneNativeSourceUpgrade,
|
|
51
|
+
} from '../one-native-source'
|
|
47
52
|
import { handleOneSDKRequest, ONE_SDK_ROUTE } from '../one-sdk-bundle.ts'
|
|
53
|
+
import { ONE_WIDGET_PATH } from '../oneWidgetContract'
|
|
48
54
|
import { isProcessRunning } from '../process-liveness.ts'
|
|
49
55
|
import { rnxPublicBrand } from '../public-brand.ts'
|
|
50
56
|
import {
|
|
@@ -56,6 +62,7 @@ import {
|
|
|
56
62
|
} from '../runtime-assets.ts'
|
|
57
63
|
import { rnxRuntime } from '../runtime-delivery.ts'
|
|
58
64
|
import { ensureRuntimePackFor } from '../runtime-packs.ts'
|
|
65
|
+
import { SWIFT_PACKAGE_PATH } from '../swift-submit'
|
|
59
66
|
import { handleTurboRequest, TURBO_ROUTE } from '../turbo-bundle.ts'
|
|
60
67
|
import {
|
|
61
68
|
handleWidgetExtensionRequest,
|
|
@@ -599,6 +606,7 @@ export class SootSimBridgeHost {
|
|
|
599
606
|
this.wireWebSocketServer()
|
|
600
607
|
server.on('upgrade', (req, socket, head) => {
|
|
601
608
|
if (rejectUntrustedBridgeUpgrade(req, socket)) return
|
|
609
|
+
if (handleOneNativeSourceUpgrade(req, socket, head)) return
|
|
602
610
|
if (handleWebSocketProxyUpgrade(req, socket, head)) return
|
|
603
611
|
this.wss?.handleUpgrade(req, socket, head, (ws) => {
|
|
604
612
|
this.wss?.emit('connection', ws, req)
|
|
@@ -1576,7 +1584,9 @@ export class SootSimBridgeHost {
|
|
|
1576
1584
|
route === NITRO_ROUTE ||
|
|
1577
1585
|
route === ONE_SDK_ROUTE ||
|
|
1578
1586
|
route === TURBO_ROUTE ||
|
|
1579
|
-
/^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact
|
|
1587
|
+
/^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact\/|kotlin-package)/.test(
|
|
1588
|
+
route,
|
|
1589
|
+
)
|
|
1580
1590
|
) {
|
|
1581
1591
|
// a sim waiting on its app's native build is not idle, however long the
|
|
1582
1592
|
// compile takes; the reaper measures idleness from when the work settles.
|
|
@@ -1607,6 +1617,14 @@ export class SootSimBridgeHost {
|
|
|
1607
1617
|
void handleTurboRequest(req, res)
|
|
1608
1618
|
return
|
|
1609
1619
|
}
|
|
1620
|
+
if (
|
|
1621
|
+
route.startsWith(SWIFT_PACKAGE_PATH) ||
|
|
1622
|
+
route === KOTLIN_PACKAGE_PATH ||
|
|
1623
|
+
route === ONE_WIDGET_PATH
|
|
1624
|
+
) {
|
|
1625
|
+
void handleOneNativeSourceRequest(req, res)
|
|
1626
|
+
return
|
|
1627
|
+
}
|
|
1610
1628
|
if (
|
|
1611
1629
|
req.url?.startsWith('/__peach/expo-swift') ||
|
|
1612
1630
|
req.url?.startsWith('/__peach/swift')
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
scanDevServers,
|
|
3
|
-
SERVER_SCAN_PROBE_HEADER,
|
|
4
|
-
} from '../../scripts/dev-server-scanner.ts'
|
|
1
|
+
import { scanDevServers } from '../../scripts/dev-server-scanner.ts'
|
|
5
2
|
import { buildBrowserAssetProxyUrl } from '../backend-origin.ts'
|
|
6
3
|
import type { DiscoveredServer } from '../serverDiscoveryContract'
|
|
7
4
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
@@ -59,11 +56,6 @@ export function createServerScanHandler(options: ServerScanOptions) {
|
|
|
59
56
|
})
|
|
60
57
|
res.end(JSON.stringify(body))
|
|
61
58
|
}
|
|
62
|
-
// another scanner may probe this host while our own scan is in flight.
|
|
63
|
-
if (req.headers[SERVER_SCAN_PROBE_HEADER] !== undefined) {
|
|
64
|
-
sendJson(200, cache ?? [])
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
59
|
if (cache && Date.now() - cachedAt < SCAN_FRESH_MS) {
|
|
68
60
|
sendJson(200, cache)
|
|
69
61
|
return
|
package/src/index.ts
CHANGED
|
@@ -70,8 +70,6 @@ export {
|
|
|
70
70
|
type RnxScreenCapture,
|
|
71
71
|
} from './capture-contract'
|
|
72
72
|
|
|
73
|
-
export { peachPlugin } from './vite-plugin-one'
|
|
74
|
-
export { default as metroPlugin } from './metro-plugin'
|
|
75
73
|
export { default as jumpToSourceBabelPlugin } from './jump-to-source-babel'
|
|
76
74
|
export {
|
|
77
75
|
DEFAULT_SOOTSIM_BRIDGE_PORT,
|
package/src/kotlin-host.ts
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
viewModelClasses,
|
|
41
41
|
type ViewModelClass,
|
|
42
42
|
} from './kotlin-view-models'
|
|
43
|
+
import { KOTLIN_PACKAGE_PATH } from './kotlinDiscoveryContract'
|
|
43
44
|
import type { DayNight, DrawableFile } from './android-drawables'
|
|
44
45
|
import type { TextAppearance } from './android-theme'
|
|
45
46
|
import type { XmlElement } from './android-xml'
|
|
@@ -1676,8 +1677,6 @@ export function serveKotlinArtifact(pathname: string, res: ServerResponse): bool
|
|
|
1676
1677
|
return true
|
|
1677
1678
|
}
|
|
1678
1679
|
|
|
1679
|
-
export const KOTLIN_PACKAGE_PATH = '/__peach/kotlin-package'
|
|
1680
|
-
|
|
1681
1680
|
export { peachKotlinModuleRoot } from './kotlin-module'
|
|
1682
1681
|
|
|
1683
1682
|
// answers one /__peach/kotlin* request: the app's compiled module description,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// the foreground kotlin host's signature, shared by its server and scanner.
|
|
2
2
|
export const KOTLIN_DISCOVERY_PATH = '/__peach/kotlin-host'
|
|
3
3
|
export const KOTLIN_GUEST_PATH = '/__peach/kotlin-guest.js'
|
|
4
|
+
export const KOTLIN_PACKAGE_PATH = '/__peach/kotlin-package'
|
|
4
5
|
|
|
5
6
|
export interface KotlinHostDiscovery {
|
|
6
7
|
framework: 'kotlin'
|
|
@@ -239,11 +239,11 @@ export interface RNXMetroDefine {
|
|
|
239
239
|
/** the dependency array or async-path object, delimiters included; null when omitted. */
|
|
240
240
|
dependencies: { start: number; end: number } | null
|
|
241
241
|
/**
|
|
242
|
-
* the module's verbose name
|
|
243
|
-
* Metro emits it as a fourth `__d` argument on a
|
|
244
|
-
* it entirely on a production one.
|
|
242
|
+
* the module's verbose name when the graph carries one: its range, quotes
|
|
243
|
+
* included, and its value. Metro emits it as a fourth `__d` argument on a
|
|
244
|
+
* development graph and omits it entirely on a production one.
|
|
245
245
|
*/
|
|
246
|
-
verboseName?: { start: number; end: number }
|
|
246
|
+
verboseName?: { start: number; end: number; value: string }
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
export interface RNXMetroRun {
|
|
@@ -372,8 +372,14 @@ export async function readRNXMetroBundleLayout(
|
|
|
372
372
|
dependencies && readableDependencies
|
|
373
373
|
? { start: dependencies.start, end: dependencies.end }
|
|
374
374
|
: null,
|
|
375
|
-
...(verboseName
|
|
376
|
-
? {
|
|
375
|
+
...(verboseName?.type === 'Literal' && typeof verboseName.value === 'string'
|
|
376
|
+
? {
|
|
377
|
+
verboseName: {
|
|
378
|
+
start: verboseName.start,
|
|
379
|
+
end: verboseName.end,
|
|
380
|
+
value: verboseName.value,
|
|
381
|
+
},
|
|
382
|
+
}
|
|
377
383
|
: {}),
|
|
378
384
|
})
|
|
379
385
|
}
|
|
@@ -397,6 +403,22 @@ export async function validateRNXMetroModulePaths(
|
|
|
397
403
|
checkRNXMetroModulePaths(await readRNXMetroBundleLayout(source), modulePaths)
|
|
398
404
|
}
|
|
399
405
|
|
|
406
|
+
// a development graph names every module in its fourth `__d` argument; a graph
|
|
407
|
+
// with an unnamed or blank module has no complete identity of its own.
|
|
408
|
+
export function readRNXMetroDeclaredModulePaths(
|
|
409
|
+
layout: RNXMetroBundleLayout,
|
|
410
|
+
): RNXMetroModulePathMap | null {
|
|
411
|
+
if (layout.moduleIdFailures > 0) return null
|
|
412
|
+
const modulePaths: RNXMetroModulePathMap = {}
|
|
413
|
+
for (const statement of layout.statements) {
|
|
414
|
+
if (statement.kind !== 'define') continue
|
|
415
|
+
const name = statement.verboseName?.value
|
|
416
|
+
if (!name) return null
|
|
417
|
+
modulePaths[String(statement.moduleId)] = name
|
|
418
|
+
}
|
|
419
|
+
return modulePaths
|
|
420
|
+
}
|
|
421
|
+
|
|
400
422
|
/** the identity contract against a layout the caller already read. */
|
|
401
423
|
export function checkRNXMetroModulePaths(
|
|
402
424
|
layout: RNXMetroBundleLayout,
|