Add Electron renderer remote debugging for profiling

This commit is contained in:
Mohamed Boudra
2026-05-13 22:13:47 +07:00
parent bc329a2d85
commit 7a0606952d
3 changed files with 23 additions and 0 deletions
+13
View File
@@ -15,6 +15,18 @@ $env:EXPO_PORT = (npx get-port-cli 8081 8082 8083 8084 8085).Trim()
# Set EXPO_DEV_URL in the environment so Electron inherits it
$env:EXPO_DEV_URL = "http://localhost:$($env:EXPO_PORT)"
$RemoteDebuggingPort = if ($env:PASEO_ELECTRON_REMOTE_DEBUGGING_PORT) {
$env:PASEO_ELECTRON_REMOTE_DEBUGGING_PORT
} else {
"9223"
}
$ExistingElectronFlags = if ($env:PASEO_ELECTRON_FLAGS) {
"$($env:PASEO_ELECTRON_FLAGS) "
} else {
""
}
$env:PASEO_ELECTRON_FLAGS = "$($ExistingElectronFlags)--remote-debugging-port=$RemoteDebuggingPort"
# Allow any origin in dev so Electron on random ports works.
# SECURITY: wildcard CORS is unsafe in production — only acceptable here because
# the daemon binds to localhost and this script is never used for production.
@@ -25,6 +37,7 @@ Write-Host @"
Paseo Desktop Dev (Windows)
======================================================
Metro: http://localhost:$($env:EXPO_PORT)
CDP: http://127.0.0.1:$RemoteDebuggingPort
======================================================
"@
+4
View File
@@ -14,6 +14,9 @@ npm run build:main
EXPO_PORT=$("$ROOT_DIR/node_modules/.bin/get-port" 8081 8082 8083 8084 8085)
export EXPO_PORT
REMOTE_DEBUGGING_PORT="${PASEO_ELECTRON_REMOTE_DEBUGGING_PORT:-9223}"
export PASEO_ELECTRON_FLAGS="${PASEO_ELECTRON_FLAGS:+$PASEO_ELECTRON_FLAGS }--remote-debugging-port=$REMOTE_DEBUGGING_PORT"
# Allow any origin in dev so Electron on random localhost ports can reach
# the daemon websocket. Safe here because this script is development-only
# and the daemon still binds to localhost.
@@ -23,6 +26,7 @@ echo "════════════════════════
echo " Paseo Desktop Dev"
echo "══════════════════════════════════════════════════════"
echo " Metro: http://localhost:${EXPO_PORT}"
echo " CDP: http://127.0.0.1:${REMOTE_DEBUGGING_PORT}"
echo "══════════════════════════════════════════════════════"
# Launch Metro + Electron together, kill both on exit