peachsim 0.1.1469 → 0.1.1477
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/drivers/playwright-sim-host.ts +7 -2
- package/cli/drivers/playwright.ts +6 -6
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +13 -2
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +46 -40
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +7 -2
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +134 -37
- 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-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +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/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 +141 -93
- package/dist-lib/swift-compile.cjs +7 -2
- package/dist-lib/swift-compile.mjs +7 -2
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +7 -2
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/admitted-mac-build.ts +12 -0
- package/src/bridge-constants.ts +5 -3
- package/src/host/bridge-host.ts +34 -6
- package/src/swift-compile.ts +5 -4
- package/src/worker-system-chunks.ts +10 -9
package/src/host/bridge-host.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { spawn } from 'child_process'
|
|
1
|
+
import childProcess, { spawn } from 'child_process'
|
|
2
2
|
import fs from 'fs'
|
|
3
3
|
import { createServer, type IncomingMessage, type ServerResponse } from 'http'
|
|
4
|
+
import os from 'os'
|
|
4
5
|
import path from 'path'
|
|
5
6
|
import { WebSocket, WebSocketServer } from 'ws'
|
|
7
|
+
import { readChromiumQueue } from '../../../../scripts/lib/chromium-admission.ts'
|
|
6
8
|
import {
|
|
7
9
|
scanDevServers,
|
|
8
10
|
type DiscoveredServer,
|
|
@@ -2038,6 +2040,7 @@ export class SootSimBridgeHost {
|
|
|
2038
2040
|
|
|
2039
2041
|
private reapIdleSims(now = Date.now()) {
|
|
2040
2042
|
const attachedSimIds = new Set(this.cliSimBySocket.values())
|
|
2043
|
+
let reclaimable: { ws: WebSocket; idleMs: number } | null = null
|
|
2041
2044
|
for (const sim of this.sims.values()) {
|
|
2042
2045
|
if (attachedSimIds.has(sim.id)) continue
|
|
2043
2046
|
const automation = this.isAutomationSim(sim)
|
|
@@ -2053,13 +2056,38 @@ export class SootSimBridgeHost {
|
|
|
2053
2056
|
// never-CLI-driven sims have lastActiveAt 0 — fall back to connectedAt
|
|
2054
2057
|
// so a freshly opened, not-yet-primary tab isn't reaped on the spot.
|
|
2055
2058
|
const idleMs = now - Math.max(sim.lastActiveAt, sim.connectedAt)
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
+
if (automation) {
|
|
2060
|
+
if (
|
|
2061
|
+
idleMs >= AUTOMATION_SIM_IDLE_REAP_TTL_MS &&
|
|
2062
|
+
idleMs > (reclaimable?.idleMs ?? 0)
|
|
2063
|
+
)
|
|
2064
|
+
reclaimable = { ws: sim.ws, idleMs }
|
|
2065
|
+
continue
|
|
2066
|
+
}
|
|
2059
2067
|
// terminal close → client closes the window, does not reconnect; the
|
|
2060
2068
|
// 'close' handler runs rememberDisconnectedSim → this.sims.delete.
|
|
2061
|
-
if (idleMs >=
|
|
2062
|
-
|
|
2069
|
+
if (idleMs >= SootSimBridgeHost.SIM_IDLE_REAP_TTL_MS)
|
|
2070
|
+
this.closeSimSocketFromHost(sim.ws)
|
|
2071
|
+
}
|
|
2072
|
+
// an automation sim lives as long as the session that opened it, as a
|
|
2073
|
+
// simulator stays booted between commands; its host closes chrome when that
|
|
2074
|
+
// session exits. an idle one gives up its chromium slot only while another
|
|
2075
|
+
// launch on this machine waits for one, the longest idle first.
|
|
2076
|
+
if (reclaimable && this.chromiumLaunchWaiting())
|
|
2077
|
+
this.closeSimSocketFromHost(reclaimable.ws)
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
private chromiumQueueVerified = new Map<string, boolean>()
|
|
2081
|
+
|
|
2082
|
+
private chromiumLaunchWaiting(): boolean {
|
|
2083
|
+
const queue = readChromiumQueue(
|
|
2084
|
+
{ fs, os, path, childProcess },
|
|
2085
|
+
this.chromiumQueueVerified,
|
|
2086
|
+
)
|
|
2087
|
+
const live = new Set(queue.tickets)
|
|
2088
|
+
for (const entry of this.chromiumQueueVerified.keys())
|
|
2089
|
+
if (!live.has(entry)) this.chromiumQueueVerified.delete(entry)
|
|
2090
|
+
return queue.tickets.length > queue.limit
|
|
2063
2091
|
}
|
|
2064
2092
|
|
|
2065
2093
|
// ping every connected ws; if the previous round's ping went unanswered,
|
package/src/swift-compile.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import os from 'node:os'
|
|
16
16
|
import path from 'node:path'
|
|
17
17
|
import { promisify } from 'node:util'
|
|
18
|
+
import { admittedMacBuilderSlot } from './admitted-mac-build'
|
|
18
19
|
import {
|
|
19
20
|
parseSwiftDistributionManifest,
|
|
20
21
|
SWIFT_DISTRIBUTION_MANIFEST,
|
|
@@ -2690,13 +2691,13 @@ export function compileSwiftProjectUnit(
|
|
|
2690
2691
|
}
|
|
2691
2692
|
const hash = swiftArtifactHash(input, options.release, moduleRoot)
|
|
2692
2693
|
return serialize(root, async () => {
|
|
2693
|
-
//
|
|
2694
|
-
//
|
|
2695
|
-
//
|
|
2694
|
+
// an admitted mac slot already holds the build lock and the pinned
|
|
2695
|
+
// toolchain, so it compiles here. a bare CONTRAST_REMOTE_BUILD value is
|
|
2696
|
+
// only an inherited marker and still dispatches through admission.
|
|
2696
2697
|
if (
|
|
2697
2698
|
process.platform === 'darwin' &&
|
|
2698
2699
|
process.env.TM_SESSION &&
|
|
2699
|
-
!
|
|
2700
|
+
!admittedMacBuilderSlot() &&
|
|
2700
2701
|
process.env.CI !== 'true' &&
|
|
2701
2702
|
moduleRoot === path.resolve(import.meta.dirname, '../../sootsim-swift') &&
|
|
2702
2703
|
!swiftDistributionAt(moduleRoot)
|
|
@@ -6,22 +6,23 @@ import { isRecord } from './is-record'
|
|
|
6
6
|
|
|
7
7
|
const require = createRequire(import.meta.url)
|
|
8
8
|
const systemRuntime = fs.readFileSync(require.resolve('systemjs/dist/s.min.js'), 'utf8')
|
|
9
|
-
const minifierModule = require.resolve('
|
|
9
|
+
const minifierModule = require.resolve('rolldown/utils')
|
|
10
10
|
type MinifiedWorkerChunk = { code: string; map: string }
|
|
11
11
|
const minifierWorker = `
|
|
12
12
|
const { parentPort, workerData } = require('node:worker_threads');
|
|
13
|
-
const
|
|
13
|
+
const minifier = import(workerData.module);
|
|
14
14
|
parentPort.on('message', async ({ code, map, keepNames, measurement }) => {
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
16
|
+
const { minifySync } = await minifier;
|
|
17
|
+
const result = minifySync('peach-worker-chunk.js', code, {
|
|
17
18
|
module: true,
|
|
18
|
-
compress: measurement ? false : {
|
|
19
|
-
mangle:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
sourceMap: { content: map },
|
|
19
|
+
compress: measurement ? false : { keepNames: { function: keepNames, class: keepNames } },
|
|
20
|
+
mangle: measurement ? false : { keepNames },
|
|
21
|
+
sourcemap: true,
|
|
22
|
+
inputMap: JSON.parse(map),
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
if (result.errors.length) throw new Error(result.errors.map(error => error.message).join('; '));
|
|
25
|
+
parentPort.postMessage({ code: result.code, map: result.map && JSON.stringify(result.map) });
|
|
25
26
|
} catch (error) {
|
|
26
27
|
parentPort.postMessage({ error: error instanceof Error ? error.message : String(error) });
|
|
27
28
|
}
|