rnxsim 0.1.368 → 0.1.370
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/auth.ts +2 -1
- package/cli/bin.ts +283 -273
- package/cli/commands/app-fonts.ts +3 -2
- package/cli/commands/assert.ts +8 -7
- package/cli/commands/auth.ts +2 -1
- package/cli/commands/box/checkout-plane.ts +49 -16
- package/cli/commands/compat.ts +93 -4
- package/cli/commands/config.ts +2 -1
- package/cli/commands/control.ts +37 -33
- package/cli/commands/daemon.ts +22 -21
- package/cli/commands/debug.ts +17 -15
- package/cli/commands/detect.ts +11 -7
- package/cli/commands/detox.ts +5 -4
- package/cli/commands/device.ts +6 -5
- package/cli/commands/electron.ts +6 -5
- package/cli/commands/flow.ts +12 -11
- package/cli/commands/inspect/find.ts +2 -1
- package/cli/commands/inspect/keyboard.ts +2 -1
- package/cli/commands/inspect/sleep.ts +2 -1
- package/cli/commands/inspect/wait-event.ts +4 -3
- package/cli/commands/inspect/wait-idle.ts +2 -1
- package/cli/commands/inspect/wait-ready.ts +3 -2
- package/cli/commands/inspect/wait-selector.ts +4 -3
- package/cli/commands/inspect/wait.ts +2 -1
- package/cli/commands/inspect.ts +82 -80
- package/cli/commands/install-desktop.ts +5 -4
- package/cli/commands/login.ts +3 -2
- package/cli/commands/mode.ts +2 -1
- package/cli/commands/record.ts +38 -37
- package/cli/commands/runtime.ts +9 -8
- package/cli/commands/screenshot-layers.ts +4 -3
- package/cli/commands/screenshot-mode.ts +2 -1
- package/cli/commands/screenshot.ts +8 -7
- package/cli/commands/screenshots-capture.ts +2 -1
- package/cli/commands/serve.ts +5 -4
- package/cli/commands/shell-boolean-mode.ts +2 -1
- package/cli/commands/skills.ts +11 -10
- package/cli/commands/telemetry.ts +2 -1
- package/cli/commands/three-mode.ts +2 -1
- package/cli/commands/timeline.ts +4 -3
- package/cli/commands/upload.ts +14 -13
- package/cli/commands/what-happened.ts +2 -1
- package/cli/recording-access.ts +6 -5
- package/cli/run-rnx.ts +140 -0
- package/dist-cli/bin.js +6 -6
- package/dist-cli/chunks/{agent-GXCQMYV4.js → agent-3R4424LW.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-Y3PQAL6I.js → agent-wrapper-4PPWZWSY.js} +2 -2
- package/dist-cli/chunks/app-fonts-KYXB6CXQ.js +4 -0
- package/dist-cli/chunks/{assert-BSRQBRH7.js → assert-7EZOWGYQ.js} +11 -11
- package/dist-cli/chunks/auth-L7M36H6C.js +12 -0
- package/dist-cli/chunks/{beta-R4IZ5SWO.js → beta-FKAF6YWJ.js} +2 -2
- package/dist-cli/chunks/{box-2NQYYY3B.js → box-5Y5VBMHV.js} +62 -62
- package/dist-cli/chunks/{camera-ER66WWAX.js → camera-XHF2RPFG.js} +2 -2
- package/dist-cli/chunks/{chunk-UBH2BWCY.js → chunk-2FOGXVOK.js} +2 -2
- package/dist-cli/chunks/{chunk-7B22IPSC.js → chunk-3BG6UCQY.js} +2 -2
- package/dist-cli/chunks/{chunk-IXRVFQMT.js → chunk-3SOPYG7S.js} +2 -2
- package/dist-cli/chunks/{chunk-7V3S2DY2.js → chunk-3UXXYJVD.js} +1 -1
- package/dist-cli/chunks/{chunk-3MPFC3DS.js → chunk-5BR33NAZ.js} +1 -1
- package/dist-cli/chunks/{chunk-BWJOLJOK.js → chunk-5RKRVS5A.js} +2 -2
- package/dist-cli/chunks/{chunk-WVVAYLWZ.js → chunk-64JAEJ6N.js} +1 -1
- package/dist-cli/chunks/{chunk-GXHCJRKE.js → chunk-6A6L3VJR.js} +2 -2
- package/dist-cli/chunks/chunk-6GPS7U4X.js +74 -0
- package/dist-cli/chunks/{chunk-JHYXRORU.js → chunk-6S5LJV2O.js} +2 -2
- package/dist-cli/chunks/{chunk-TOE5O6JE.js → chunk-6W4HIWC7.js} +2 -2
- package/dist-cli/chunks/{chunk-ESVUVW3R.js → chunk-72S5FCBY.js} +2 -2
- package/dist-cli/chunks/{chunk-TC6DNQL6.js → chunk-7C7TJYZ3.js} +2 -2
- package/dist-cli/chunks/{chunk-M7COA4BE.js → chunk-AALKIAUZ.js} +1 -1
- package/dist-cli/chunks/{chunk-CKNNO6ZG.js → chunk-ARMXC3C3.js} +25 -25
- package/dist-cli/chunks/chunk-AVJBT5LF.js +4 -0
- package/dist-cli/chunks/chunk-BMIJZNKD.js +28 -0
- package/dist-cli/chunks/{chunk-FSPZY4AI.js → chunk-C7BA5CCM.js} +2 -2
- package/dist-cli/chunks/{chunk-EHA65UVJ.js → chunk-CMVRTZ5G.js} +2 -2
- package/dist-cli/chunks/chunk-D24EOJ4C.js +24 -0
- package/dist-cli/chunks/{chunk-3XMEIZEV.js → chunk-D2GZASRV.js} +1 -1
- package/dist-cli/chunks/{chunk-3S2J6IVC.js → chunk-DHYTRCIP.js} +2 -2
- package/dist-cli/chunks/{chunk-QMVBWZH2.js → chunk-DMHSD6YJ.js} +2 -2
- package/dist-cli/chunks/{chunk-NGWUGNPV.js → chunk-DUXHYPBP.js} +2 -2
- package/dist-cli/chunks/{chunk-4FLQYRGN.js → chunk-DXV37CJN.js} +1 -1
- package/dist-cli/chunks/{chunk-T2MGLXY5.js → chunk-EOIBLKZO.js} +2 -2
- package/dist-cli/chunks/{chunk-PNBQBBG5.js → chunk-EQ3OE2AV.js} +1 -1
- package/dist-cli/chunks/{chunk-WFAFAGMG.js → chunk-EWSWOWXK.js} +2 -2
- package/dist-cli/chunks/{chunk-HKQXGCQT.js → chunk-FA75F34Z.js} +1 -1
- package/dist-cli/chunks/{chunk-NERY6HGZ.js → chunk-FK4JSTZ3.js} +2 -2
- package/dist-cli/chunks/{chunk-NPSPWMBO.js → chunk-GJRLPJQL.js} +2 -2
- package/dist-cli/chunks/{chunk-TPIPKXJL.js → chunk-GRO74J2X.js} +1 -1
- package/dist-cli/chunks/chunk-H5X5FJ63.js +99 -0
- package/dist-cli/chunks/chunk-HEKHLQ3B.js +497 -0
- package/dist-cli/chunks/chunk-HQQTS2CB.js +30 -0
- package/dist-cli/chunks/{chunk-Q65KH25G.js → chunk-I52NT6VG.js} +1 -1
- package/dist-cli/chunks/{chunk-AUPJX4KI.js → chunk-IDLFVRPN.js} +1 -1
- package/dist-cli/chunks/{chunk-LAKWOJ5Y.js → chunk-JZLDHPB7.js} +2 -2
- package/dist-cli/chunks/{chunk-WJQB6AXZ.js → chunk-LIMWG54N.js} +1 -1
- package/dist-cli/chunks/{chunk-TE645QCO.js → chunk-LUOHRBJG.js} +1 -1
- package/dist-cli/chunks/{chunk-DJSPNOF6.js → chunk-LXPHL6FO.js} +2 -2
- package/dist-cli/chunks/{chunk-ECXDCED5.js → chunk-MDCY532E.js} +2 -2
- package/dist-cli/chunks/{chunk-4VA2ISWX.js → chunk-NJMU5BN6.js} +1 -1
- package/dist-cli/chunks/{chunk-RRALQ4WM.js → chunk-NR2V2ONN.js} +2 -2
- package/dist-cli/chunks/{chunk-SHMLYTNH.js → chunk-NTC46LSA.js} +2 -2
- package/dist-cli/chunks/{chunk-X5MXQB3L.js → chunk-O6QLKSAM.js} +10 -10
- package/dist-cli/chunks/{chunk-LPAOOJIW.js → chunk-OJZHECGH.js} +1 -1
- package/dist-cli/chunks/chunk-OTFTMGAL.js +7 -0
- package/dist-cli/chunks/{chunk-QKOY7UW5.js → chunk-PAUEZO6F.js} +2 -2
- package/dist-cli/chunks/{chunk-WXRDFUR7.js → chunk-PIZXOXBL.js} +2 -2
- package/dist-cli/chunks/{chunk-WF2CRNYF.js → chunk-PNOENVMJ.js} +1 -1
- package/dist-cli/chunks/{chunk-FDAFSRQE.js → chunk-Q4MRJ6PO.js} +2 -2
- package/dist-cli/chunks/{chunk-SSUPPM6K.js → chunk-RRX52O37.js} +1 -1
- package/dist-cli/chunks/{chunk-E6XYIIJK.js → chunk-U63T6LIQ.js} +1 -1
- package/dist-cli/chunks/{chunk-OZJMWTGA.js → chunk-UFVAAWGZ.js} +1 -1
- package/dist-cli/chunks/{chunk-GS5VUDCF.js → chunk-VVQCZ42C.js} +1 -1
- package/dist-cli/chunks/{chunk-MCO7V4VN.js → chunk-WFQHT4QD.js} +2 -2
- package/dist-cli/chunks/{chunk-JFGW75UL.js → chunk-WPV4H5S4.js} +2 -2
- package/dist-cli/chunks/{chunk-OXCDE3DD.js → chunk-X6WQ4YWE.js} +1 -1
- package/dist-cli/chunks/{chunk-FVODUDPS.js → chunk-YIZGNT7A.js} +1 -1
- package/dist-cli/chunks/{chunk-MGOAQHMO.js → chunk-Z2VBSNFI.js} +2 -2
- package/dist-cli/chunks/{chunk-GFWUIGGY.js → chunk-Z3DENGXW.js} +2 -2
- package/dist-cli/chunks/{cleanup-WHGLBAJ2.js → cleanup-MXMMJ7JW.js} +2 -2
- package/dist-cli/chunks/cli-version-MLS55UTY.js +4 -0
- package/dist-cli/chunks/compat-E6KE5KDI.js +23 -0
- package/dist-cli/chunks/config-QSLLVZDS.js +13 -0
- package/dist-cli/chunks/{connect-N4FV3DDV.js → connect-QE4VU6GB.js} +2 -2
- package/dist-cli/chunks/control-XD5F6K5T.js +4 -0
- package/dist-cli/chunks/daemon-UN5SE2JO.js +4 -0
- package/dist-cli/chunks/{debug-AHEK43AJ.js → debug-5FG3MBJS.js} +20 -20
- package/dist-cli/chunks/desktop-5EZX7NX5.js +31 -0
- package/dist-cli/chunks/detox-WJGQP5TM.js +52 -0
- package/dist-cli/chunks/device-D7LKCAMS.js +18 -0
- package/dist-cli/chunks/{diagnose-WDP3CVIX.js → diagnose-A3W6ZTGA.js} +2 -2
- package/dist-cli/chunks/{disk-cleanup-JRT5MKFW.js → disk-cleanup-BDRHX5ZG.js} +2 -2
- package/dist-cli/chunks/{do-chain-7FDMO56C.js → do-chain-RUJNRPPF.js} +2 -2
- package/dist-cli/chunks/drivers-3NJ5RL6X.js +4 -0
- package/dist-cli/chunks/{env-YIBOMB24.js → env-U67SQVTV.js} +2 -2
- package/dist-cli/chunks/{film-R3EQADMG.js → film-XC6UAQ3V.js} +3 -3
- package/dist-cli/chunks/flow-FHZZD3P6.js +4 -0
- package/dist-cli/chunks/help-BYYDUSXF.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-6M4UERRQ.js → hidden-runtime-alias-7S2TNZXG.js} +2 -2
- package/dist-cli/chunks/{home-paths-QJNOHZJO.js → home-paths-LMO5LB4F.js} +2 -2
- package/dist-cli/chunks/inspect-RQCTWDCC.js +4 -0
- package/dist-cli/chunks/install-desktop-GOWXCQUE.js +4 -0
- package/dist-cli/chunks/login-JIU42S4C.js +26 -0
- package/dist-cli/chunks/{logout-VNJX2IEW.js → logout-JTAWQXZO.js} +2 -2
- package/dist-cli/chunks/{maestro-SQS2OS2D.js → maestro-TYBQYOGB.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-GWVPISG5.js → maestro-generate-YLAGWVKE.js} +3 -3
- package/dist-cli/chunks/mode-DV24ZRZ6.js +26 -0
- package/dist-cli/chunks/{optional-demo-registry-L3LRBQHG.js → optional-demo-registry-JZH66VIM.js} +2 -2
- package/dist-cli/chunks/{perf-XLPC4UKR.js → perf-LXXJ4EAX.js} +2 -2
- package/dist-cli/chunks/{permissions-QRHWVMDP.js → permissions-KAOVZUPW.js} +2 -2
- package/dist-cli/chunks/{platform-F47URZNB.js → platform-KW35446W.js} +3 -3
- package/dist-cli/chunks/privacy-MIFE72CG.js +4 -0
- package/dist-cli/chunks/record-EK3ETFHZ.js +72 -0
- package/dist-cli/chunks/report-issue-NW5PCAZF.js +29 -0
- package/dist-cli/chunks/reset-RZ4O5AFJ.js +4 -0
- package/dist-cli/chunks/resolve-target-7R5BNYMM.js +4 -0
- package/dist-cli/chunks/runtime-MZHLSRS6.js +4 -0
- package/dist-cli/chunks/{screenshot-command-RK7IJHVK.js → screenshot-command-TQSPTFT2.js} +11 -11
- package/dist-cli/chunks/screenshot-layers-IZP3L3AQ.js +20 -0
- package/dist-cli/chunks/screenshots-capture-K7LJOVAE.js +42 -0
- package/dist-cli/chunks/{serve-UBXNGLNP.js → serve-MMX4WXXG.js} +18 -18
- package/dist-cli/chunks/setup-YFP3KEQZ.js +4 -0
- package/dist-cli/chunks/{sim-client-VTKFEDJX.js → sim-client-KLAYIFOC.js} +2 -2
- package/dist-cli/chunks/skills-N4D3POIS.js +50 -0
- package/dist-cli/chunks/{state-273XJPUE.js → state-ES6TFQZF.js} +2 -2
- package/dist-cli/chunks/{storage-RTDFWIY7.js → storage-52DR5V2C.js} +2 -2
- package/dist-cli/chunks/store-HOL45WCI.js +4 -0
- package/dist-cli/chunks/telemetry-BV6OTYPF.js +4 -0
- package/dist-cli/chunks/timeline-NRVNB5JR.js +24 -0
- package/dist-cli/chunks/{upgrade-R74NVHKG.js → upgrade-LNED5YQ2.js} +2 -2
- package/dist-cli/chunks/upload-RXKHFIBU.js +4 -0
- package/dist-cli/chunks/{version-RTFCYQZ7.js → version-VEF2DYGG.js} +2 -2
- package/dist-cli/chunks/{web-35SSKBRU.js → web-CGDE6S73.js} +2 -2
- package/dist-cli/chunks/welcome-FT2AMUWW.js +5 -0
- package/dist-cli/chunks/what-happened-FSIDWL32.js +25 -0
- package/dist-cli/chunks/{ws-bridge-JXQUAWFA.js → ws-bridge-QXFQLRE7.js} +2 -2
- 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/cli-constants.cjs +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 +1 -1
- 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/menu.cjs +1 -1
- package/dist-lib/menu.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/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +2 -1
- package/dist-lib/react-native-host-modules.mjs +2 -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 +560 -48
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/react-native-host-modules.ts +1 -0
- package/dist-cli/chunks/app-fonts-MDD3W4VN.js +0 -4
- package/dist-cli/chunks/auth-SLPHDPCF.js +0 -12
- package/dist-cli/chunks/chunk-2YK5J2D2.js +0 -24
- package/dist-cli/chunks/chunk-42TLK75A.js +0 -497
- package/dist-cli/chunks/chunk-57LITN73.js +0 -7
- package/dist-cli/chunks/chunk-T4ZZ26A2.js +0 -28
- package/dist-cli/chunks/chunk-UXROQPIN.js +0 -30
- package/dist-cli/chunks/chunk-YSHJ3LMQ.js +0 -74
- package/dist-cli/chunks/chunk-YYPTSF6W.js +0 -99
- package/dist-cli/chunks/cli-version-DMXIXBIM.js +0 -4
- package/dist-cli/chunks/compat-MGBKGYGQ.js +0 -20
- package/dist-cli/chunks/config-TRDOMP4T.js +0 -13
- package/dist-cli/chunks/control-5GRBZVYK.js +0 -4
- package/dist-cli/chunks/daemon-MBT5E3ZC.js +0 -4
- package/dist-cli/chunks/desktop-LDRIXOVV.js +0 -31
- package/dist-cli/chunks/detox-6HAKYISO.js +0 -52
- package/dist-cli/chunks/device-QM3S7OVU.js +0 -18
- package/dist-cli/chunks/drivers-AJL2EVXH.js +0 -4
- package/dist-cli/chunks/flow-BDAA6BWL.js +0 -4
- package/dist-cli/chunks/help-5EJD6LJF.js +0 -4
- package/dist-cli/chunks/inspect-S3LR3R2A.js +0 -4
- package/dist-cli/chunks/install-desktop-GXE6K7BJ.js +0 -4
- package/dist-cli/chunks/login-ISWDW4WU.js +0 -26
- package/dist-cli/chunks/mode-3URDGBZB.js +0 -26
- package/dist-cli/chunks/privacy-BF23T67T.js +0 -4
- package/dist-cli/chunks/record-2DN3OUE5.js +0 -72
- package/dist-cli/chunks/report-issue-D3BQPSLU.js +0 -29
- package/dist-cli/chunks/reset-T5CNZ7D3.js +0 -4
- package/dist-cli/chunks/resolve-target-KAAS274S.js +0 -4
- package/dist-cli/chunks/runtime-AQJDBR3X.js +0 -4
- package/dist-cli/chunks/screenshot-layers-DP2QKSMN.js +0 -20
- package/dist-cli/chunks/screenshots-capture-MA7P3FUT.js +0 -42
- package/dist-cli/chunks/setup-GH7OW4GC.js +0 -4
- package/dist-cli/chunks/skills-HPK25R4B.js +0 -50
- package/dist-cli/chunks/store-DLKNNM4L.js +0 -4
- package/dist-cli/chunks/telemetry-7CWDXEOO.js +0 -4
- package/dist-cli/chunks/timeline-IF2PGK7C.js +0 -24
- package/dist-cli/chunks/upload-3JFFVCZ4.js +0 -4
- package/dist-cli/chunks/welcome-N5V352SE.js +0 -5
- package/dist-cli/chunks/what-happened-WXTP6EPR.js +0 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as
|
|
4
|
+
import{a as se,b as ie,g as ae}from"./chunk-ARMXC3C3.js";import{a as C}from"./chunk-X6WQ4YWE.js";import"./chunk-BMIJZNKD.js";import"./chunk-HEKHLQ3B.js";import"./chunk-UFVAAWGZ.js";import{a as te}from"./chunk-LIMWG54N.js";import{a as re}from"./chunk-Q4MRJ6PO.js";import"./chunk-H5X5FJ63.js";import{a as oe,b as ne}from"./chunk-NTC46LSA.js";import"./chunk-6W4HIWC7.js";import"./chunk-LUOHRBJG.js";import"./chunk-DUXHYPBP.js";import"./chunk-OTFTMGAL.js";import"./chunk-6S5LJV2O.js";import"./chunk-3UXXYJVD.js";import"./chunk-DMHSD6YJ.js";import"./chunk-PAUEZO6F.js";import"./chunk-6A6L3VJR.js";import"./chunk-3BG6UCQY.js";import"./chunk-5BR33NAZ.js";import"./chunk-NR2V2ONN.js";import"./chunk-D2GZASRV.js";import{o as Q,p as ee}from"./chunk-AALKIAUZ.js";import"./chunk-EWSWOWXK.js";import"./chunk-PNOENVMJ.js";import"./chunk-WFQHT4QD.js";import"./chunk-EQ3OE2AV.js";import"./chunk-C7BA5CCM.js";import"./chunk-JZLDHPB7.js";import{b as R,g as $,h as I,i as L,j as U,k as H,l as A}from"./chunk-CMVRTZ5G.js";import{t as B,u as X,v as O,w as J,x as Z,y as N,z as k}from"./chunk-EOIBLKZO.js";import"./chunk-OJZHECGH.js";import"./chunk-YIZGNT7A.js";import{c as P}from"./chunk-AVJBT5LF.js";import"./chunk-LXPHL6FO.js";import"./chunk-RRX52O37.js";import"./chunk-FA75F34Z.js";import"./chunk-DHYTRCIP.js";import"./chunk-IDLFVRPN.js";import"./chunk-U63T6LIQ.js";import"./chunk-64JAEJ6N.js";import"./chunk-I52NT6VG.js";import{mkdirSync as ue,writeFileSync as le}from"fs";import{dirname as de,resolve as pe}from"path";async function me(e,t){let r=Ue(e);(r.includes("--help")||r.includes("-h"))&&(console.log(`
|
|
5
5
|
rnx screenshot \u2014 capture the canvas as a PNG
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -31,15 +31,15 @@ examples:
|
|
|
31
31
|
rnx screenshot --with-frame --output framed.png
|
|
32
32
|
rnx screenshot --area 0,200,393,400 --output hero.png
|
|
33
33
|
rnx screenshot --id loginButton --output button.png
|
|
34
|
-
`),
|
|
34
|
+
`),P(0));let i=He(r);if(i.length>0){for(let{flag:h,suggestion:w}of i)console.error(w?` unknown flag: ${h} (did you mean ${w}?)`:` unknown flag: ${h}`);console.error(" run `rnx screenshot --help` for the list of supported flags"),P(1)}let o=r.includes("--gallery"),s=r.includes("--themes"),n=r.includes("--allow-loading"),a=_e(r),l=je(r);if(o||s)return a&&(console.error(" --with-frame is not supported with --gallery / --themes"),P(1)),ce(r,t);a&&r.some(h=>h==="--area"||h==="--id"||h==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),P(1));let c=B(r,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading"],stripValueFlags:["--output","--area","--id","--text"]}),u=fe(r),d=await Oe(r);if(await Be(c.wsPort)){try{await Te(c,u,d,a,l,n)}catch(h){console.error(` screenshot failed: ${h instanceof Error?h.message:String(h)}`),P(1)}return}a&&(console.error(" --with-frame requires a running rnx bridge"),console.error(" open the app in a live sim first, then rerun the command"),P(1)),d&&(console.error(" --area / --id / --text require a running rnx bridge"),console.error(" start one with `rnx serve`, `rnx desktop`, or your project dev server"),P(1)),await ce(r,t)}async function Be(e){let t=X(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Oe(e){let t=e.find((o,s)=>e[s-1]==="--area");if(t){let o=t.split(",").map(c=>Number(c.trim()));if(o.length!==4||o.some(c=>!Number.isFinite(c)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[s,n,a,l]=o;return{x:s,y:n,w:a,h:l}}let r=e.find((o,s)=>e[s-1]==="--id"),i=e.find((o,s)=>e[s-1]==="--text");return r||i?{__matcher:{id:r,text:i}}:null}async function Te(e,t,r,i,o,s){let n=O({...e,commandTimeoutMs:45e3});try{if((await J(n)).hidden&&process.stderr.write(` \u26A0 screenshot will capture the LAST PAINTED canvas \u2014 likely stale.
|
|
35
35
|
navigation/\`shell\` commands sent before this screenshot may not
|
|
36
36
|
have repainted yet. focus the tab manually or \`rnx --sim <id>\`
|
|
37
37
|
to target a visible sim before capturing.
|
|
38
38
|
|
|
39
|
-
`),!s){let f=Number(process.env.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,x=await
|
|
39
|
+
`),!s){let f=Number(process.env.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,x=await ee(n,f);if(!x.ready&&x.externalError)process.stderr.write(` \u26A0 capturing an ERROR screen. the app failed to load: ${x.externalError}
|
|
40
40
|
this is failure evidence, not app content. never use it as a baseline.
|
|
41
41
|
|
|
42
|
-
`);else if(!x.ready)throw new Error(`app not ready to capture after ${Math.round(x.elapsedMs/1e3)}s (${
|
|
42
|
+
`);else if(!x.ready)throw new Error(`app not ready to capture after ${Math.round(x.elapsedMs/1e3)}s (${Q(x)}); refusing to capture the boot/loading card. retry once the app paints.`)}let l=r,c=r?.__matcher;if(c){let f=await n.send({type:"evaluate",code:te(c)});if(!f)throw new Error(c.id?`no node with id "${c.id}"`:`no node matching text "${c.text}"`);l=f}let u=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,d={type:"screenshot"};o&&(d.layers=o),u&&(d.crop=u);let m=await n.send(d);if(typeof m!="string"||m.length<="data:image/png;base64,".length)throw new Error("screenshot capture returned no image data \u2014 the sim is connected but not painting; check `rnx get errors`");let w=m.replace(/^data:image\/png;base64,/,"");u&&console.log(` area: x=${u.x} y=${u.y} w=${u.w} h=${u.h}`),o&&console.log(` layers: ${o}`);let p=pe(process.cwd(),t||"/tmp/sootsim-inspect.png");ue(de(p),{recursive:!0});let y=Buffer.from(w,"base64");if(i){let f=await ze(n);if(!f)throw new Error("could not read current device model from the target sim");let x=await se(y,f);le(p,x),console.log(` frame: ${f}`)}else le(p,y);console.log(` saved: ${p}`)}finally{n.close()}}async function ze(e){let t=await N(e,"SootSim.bridges.settings.get")??{deviceModel:null},r=typeof t.deviceModel=="string"?t.deviceModel:null;return!r||!(r in R)?null:r}function _e(e){let t=!1;for(let r of e)r==="--with-frame"&&(t=!0),r==="--no-frame"&&(t=!1);return t}function je(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var Ie=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading","--gallery","--themes"]),he=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),Le={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function Ue(e){let t=[],r={"-o":"--output","--out":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id","--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area"};for(let i of e){let o=r[i];t.push(o??i)}return t}function He(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){if(he.has(i)){r++;continue}Ie.has(i)||t.push({flag:i,suggestion:Le[i]})}}return t}function fe(e){let t=e.find((r,i)=>e[i-1]==="--output");if(t)return t;for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){he.has(i)&&r++;continue}return i}}async function ce(e,t){let r=fe(e)||"sootsim-screenshot.png",i=e.includes("--gallery"),o=e.find((a,l)=>e[l-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:s}=await import("playwright"),n=await C(a=>s.launch(a),{headless:!0});try{if(i)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let a=await n.newPage({viewport:{width:500,height:900}});await a.goto(o,{waitUntil:"networkidle"}),await a.waitForTimeout(2e3);let l=pe(process.cwd(),r);ue(de(l),{recursive:!0}),await a.screenshot({path:l}),console.log(` saved: ${l}`),await a.close()}}catch(a){console.error(` screenshot failed: ${a.message}`),process.exitCode=1}finally{await n.close()}}import{mkdirSync as K,readFileSync as tt,writeFileSync as Ne}from"fs";import{tmpdir as or}from"os";import _ from"path";import{mkdirSync as we,readFileSync as Ye,writeFileSync as ye}from"fs";import Y from"path";function ge(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function G(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function Ge(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function T(e,t){let r=Ge(e),i=Math.max(0,Math.min(1,t)),o=r.match(/^#([0-9a-f]{6})$/i);if(o){let s=o[1],n=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${n}, ${a}, ${l}, ${i})`}return r.startsWith("rgb(")?r.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):r}function We(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,r=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${r})`}function qe(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${T(t,.46)} 0%, ${T(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function W(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function be(...e){let t=e.map(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function q(e){let t=T(e.color,e.opacity),r=T(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) drop-shadow(0 0 ${e.blur}px ${t})`}function V(e,t){return!t.glow||e.color&&e.color!==$.color?e:{...e,color:t.glow}}function Ve(e,t){if(e==="editorial-left"){let o=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.68*(a.scale??n.scale)),u=Math.round(t.height*(.03+n.offsetY+(a.offsetY??0))),d=a.pose||n.pose||"tilted-right",m=V(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.18)+u}px`,`left:${Math.round(t.width*.56)}px`,`width:${c}px`,"transform-origin:center center",`transform:${W(d)}`,`filter:${q(m)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let o=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.84*(a.scale??n.scale)),u=Math.round(t.height*(n.offsetY+(a.offsetY??0))),d=a.pose||n.pose,m=V(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${c}px`,"transform-origin:center center",`transform:${be("translateX(-50%)",W(d))}`,`filter:${q(m)}`,"z-index:2"].join(";")}}}let r=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(o,s,n)=>{let a=Math.round(t.width*.64*(s.scale??o.scale)),l=Math.round(t.height*(o.offsetY+(s.offsetY??0))),c=s.pose||o.pose,u=V(o.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+l}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${be("translateX(-50%)",W(c))}`,`filter:${q(u)}`,"z-index:2"].join(";")}}}function Ke({canvas:e,compose:t,slide:r,imageDataUrl:i}){let o=r.background??t.background,s=Ve(t.text.preset,e),n=t.text.preset!=="none"&&!!(r.eyebrow||r.headline||r.subheadline),a=s.deviceStyle(t.frame,r,o),l=r.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${G(r.headline)}</div>`:"",c=r.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${G(r.subheadline)}</div>`:"",u=r.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${G(r.eyebrow)}</div></div>`:"";return`<!doctype html>
|
|
43
43
|
<html>
|
|
44
44
|
<head>
|
|
45
45
|
<meta charset="utf-8" />
|
|
@@ -59,14 +59,14 @@ examples:
|
|
|
59
59
|
width: ${e.width}px;
|
|
60
60
|
height: ${e.height}px;
|
|
61
61
|
overflow: hidden;
|
|
62
|
-
background: ${
|
|
62
|
+
background: ${We(o)};
|
|
63
63
|
color: ${t.text.color};
|
|
64
64
|
isolation: isolate;
|
|
65
65
|
}
|
|
66
66
|
#glow {
|
|
67
67
|
position: absolute;
|
|
68
68
|
inset: 0;
|
|
69
|
-
background: ${
|
|
69
|
+
background: ${qe(o)};
|
|
70
70
|
pointer-events: none;
|
|
71
71
|
}
|
|
72
72
|
#copy {
|
|
@@ -89,7 +89,7 @@ examples:
|
|
|
89
89
|
<div id="device"><img src="${i}" alt="" /></div>
|
|
90
90
|
</div>
|
|
91
91
|
</body>
|
|
92
|
-
</html>`}async function
|
|
92
|
+
</html>`}async function Se(e,t,r){let i=[],o=r??await(async()=>{let{chromium:n}=await import("playwright");return C(a=>n.launch(a),{headless:!0})})();try{let n=await o.newContext({viewport:{width:1280,height:720}});try{for(let a of t){let c=`data:image/png;base64,${Ye(a.imagePath).toString("base64")}`;for(let u of e.canvases){let d=await n.newPage();try{await d.setViewportSize({width:u.width,height:u.height}),await d.setContent(Ke({canvas:u,compose:e,slide:a.slide,imageDataUrl:c}),{waitUntil:"load"}),await d.waitForTimeout(20);let m=Y.join(e.outDir,u.name,e.locale);we(m,{recursive:!0});let h=Y.join(m,`${a.slide.assetKey}.png`),w=await d.screenshot({type:"png",clip:{x:0,y:0,width:u.width,height:u.height}});ye(h,w),i.push({slideId:a.slide.id,canvas:u.name,locale:e.locale,outputPath:h,sourcePath:a.imagePath})}finally{await d.close()}}}}finally{await n.close()}}finally{!r&&typeof o.close=="function"&&await o.close()}we(e.outDir,{recursive:!0});let s=Y.join(e.outDir,"manifest.json");return ye(s,JSON.stringify({generatedAt:new Date().toISOString(),locale:e.locale,outputs:i},null,2)),{manifestPath:s,outputs:i.map(n=>n.outputPath),entries:i}}function D(e){return typeof e=="string"&&e.length>0?e:void 0}async function xe(e){let r=`${e.origin.replace(/\/$/,"")}/api/sootsim/screenshot-decks?org=${encodeURIComponent(e.org)}&repo=${encodeURIComponent(e.repo)}`,i=await fetch(r,{headers:{Authorization:e.authHeader}});if(!i.ok){let a=await i.text().catch(()=>"");throw new Error(`org deck fetch failed (${i.status} ${i.statusText}) for ${e.org}/${e.repo}${a?` \u2014 ${a.slice(0,200)}`:""}`)}let s=(await i.json()).decks?.[0];if(!s||!s.config||typeof s.config!="object")return null;let n=s.config.frames;return Array.isArray(n)?n.map(a=>{let l=a??{};return{title:D(l.title),subtitle:D(l.subtitle),bgTop:D(l.bgTop),bgBottom:D(l.bgBottom),titleColor:D(l.titleColor)}}):null}function Pe(e,t){e.compose.slides.forEach((r,i)=>{let o=t[i];if(o&&(o.title!=null&&(r.headline=o.title),o.subtitle!=null&&(r.subheadline=o.subtitle),o.bgTop&&o.bgBottom)){let s={type:"gradient",direction:180,stops:[{offset:0,color:L(o.bgTop)},{offset:1,color:L(o.bgBottom)}]};r.background=s}})}import{readFileSync as Xe}from"fs";import v from"path";function g(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function z(e,t){if(!g(e))throw new Error(`${t} must be an object`);return e}function b(e,t=""){return typeof e=="string"?e:t}function S(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function $e(e,t){return typeof e=="boolean"?e:t}function M(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ke(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(R,e)?e:null}function ve(e,t){if(typeof e=="string"){let o=A(e);if(!o)throw new Error(`unknown background preset: ${e}`);return o}if(!g(e))return H(t);let r=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(r==="solid")return{type:r,color:b(e.color,t.color??"#000000"),glow:S(e.glow)??t.glow};let i=Array.isArray(e.stops)?e.stops.map(o=>{if(!g(o))return null;let s=M(o.offset,Number.NaN),n=S(o.color);return!Number.isFinite(s)||!n?null:{offset:s,color:n}}).filter(o=>!!o):t.stops?.map(o=>({...o}))??[];return{type:r,direction:M(e.direction,t.direction??180),glow:S(e.glow)??t.glow,stops:i.length>0?i:t.stops?.map(o=>({...o}))??[]}}function Je(e){let r=(Array.isArray(e)?e:["iphone-6-9"]).map(i=>{if(typeof i!="string")throw new Error("compose.canvases entries must be strings");let o=U(i);if(!o)throw new Error(`unknown canvas preset: ${i}`);return o});if(r.length===0)throw new Error("compose.canvases must include at least one preset");return r}function Ze(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function Qe(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function Ce(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function E(e,t){return v.isAbsolute(t)?t:v.resolve(e,t)}function et(e,t){if(!Array.isArray(e)||e.length===0)throw new Error("compose.slides must be a non-empty array");return e.map((r,i)=>{let o=z(r,`compose.slides[${i}]`),s=S(o.screenshot);if(!s)throw new Error(`compose.slides[${i}].screenshot is required`);let n=S(o.id),a=ge(n||s);return{id:n||a,assetKey:a,screenshot:s,headline:b(o.headline),subheadline:b(o.subheadline),eyebrow:b(o.eyebrow),pose:Ce(o.pose),scale:typeof o.scale=="number"&&Number.isFinite(o.scale)?o.scale:void 0,offsetY:typeof o.offsetY=="number"&&Number.isFinite(o.offsetY)?o.offsetY:void 0,background:o.theme||o.background?ve(o.theme??o.background,t):void 0}})}function Me(e){let t=v.resolve(e),r=v.dirname(t),i=re.parse(Xe(t,"utf8")),o=z(i,"screenshots plan"),s=z(o.capture??{},"capture"),n=z(o.compose??{},"compose"),a=typeof o.app=="number"?String(o.app):S(o.app),l=ke(o.device,null),c=E(r,b(s.out,v.join(".sootsim","screenshots","capture"))),u=S(s.from),d=S(s.flow);if(!u&&!d)throw new Error("capture.flow or capture.from is required");let m=s.mode==="raw"||s.mode==="framed"||s.mode==="raw+framed"?s.mode:"raw+framed",h=Qe(s.pathMode),w=ve(n.background??"cyan",A("cyan")),p={show:$e(n.frame&&g(n.frame)?n.frame.show:void 0,!0),style:ke(n.frame&&g(n.frame)?n.frame.style:null,null)||l||I,pose:Ce(n.frame&&g(n.frame)?n.frame.pose:void 0)||"straight",scale:M(n.frame&&g(n.frame)?n.frame.scale:void 0,1),offsetY:M(n.frame&&g(n.frame)?n.frame.offsetY:void 0,0),shadow:{color:b(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.color:void 0,$.color),blur:M(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.blur:void 0,$.blur),spread:M(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.spread:void 0,$.spread),opacity:M(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.opacity:void 0,$.opacity)}};return{planPath:t,planDir:r,appTarget:a,deviceModel:l,capture:{flowPath:d?E(r,d):null,fromDir:u?E(r,u):null,outDir:c,rawDir:u?E(r,u):v.join(c,"raw"),framedDir:v.join(c,"framed"),mode:m,pathMode:h,simId:S(s.sim),openInNewSim:$e(s.new,!1)},compose:{outDir:E(r,b(n.out,v.join(".sootsim","screenshots","exports"))),locale:b(n.locale,"en"),canvases:Je(n.canvases),frame:p,background:w,text:{preset:Ze(n.text&&g(n.text)?n.text.preset:void 0),color:b(n.text&&g(n.text)?n.text.color:void 0,"#ffffff"),subColor:b(n.text&&g(n.text)?n.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:b(n.text&&g(n.text)?n.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:et(n.slides,w)}}}function rt(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function ot(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let r=[e.capture.flowPath],i=rt(e);r.push("--screenshots",e.capture.rawDir),i==="flow"&&r.push("--screenshot-paths","flow");let o=t.appTarget??e.appTarget,s=t.deviceModel??e.deviceModel,n=t.simId??e.capture.simId;return o&&r.push("--url",o),s&&r.push("--device",s),n&&r.push("--sim",n),e.capture.openInNewSim&&r.push("--new"),r}function j(e,t){return _.isAbsolute(t)?t:_.join(e.capture.rawDir,t)}function nt(e){return _.join(e.capture.outDir,"manifest.json")}async function st(e,t){if(!e.capture.flowPath)return;K(e.capture.rawDir,{recursive:!0});let r=ot(e,t),i=await ae(r);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function it(e,t){let r=new Map;K(e.capture.framedDir,{recursive:!0});let i=t??await(async()=>{let{chromium:o}=await import("playwright");return C(s=>o.launch(s),{headless:!0})})();try{let o=await ie(i);try{for(let s of e.compose.slides){let n=j(e,s.screenshot),a=tt(n),l=await o.compose(a,e.compose.frame.style),c=_.join(e.capture.framedDir,`${s.assetKey}.png`);Ne(c,l),r.set(s.id,c)}}finally{await o.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return r}function at(e,t,r){let i=[],o=[];K(e.capture.outDir,{recursive:!0});let s=nt(e),n=e.compose.slides.map(a=>{let l=j(e,a.screenshot),c=t.get(a.id)??null;return i.push(l),c&&o.push(c),{id:a.id,screenshot:a.screenshot,rawPath:l,framedPath:c}});return Ne(s,JSON.stringify({generatedAt:new Date().toISOString(),deviceModel:r,mode:e.capture.mode,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,slides:n},null,2)),{manifestPath:s,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,rawFiles:i,framedFiles:o}}function lt(e,t){return e.compose.slides.map(r=>({slide:r,imagePath:e.compose.frame.show===!0?t.get(r.id)??j(e,r.screenshot):j(e,r.screenshot)}))}async function De(e,t={}){let r=Me(e);t.orgDeckFrames&&t.orgDeckFrames.length>0&&Pe(r,t.orgDeckFrames);let i=t.deviceModel??r.deviceModel;t.composeOnly||await st(r,t);let o=r.capture.mode!=="raw"||!t.captureOnly&&r.compose.frame.show===!0,n=o||!t.captureOnly?await(async()=>{let{chromium:a}=await import("playwright");return C(l=>a.launch(l),{headless:!0})})():null;try{let a=o?await it(r,n??void 0):new Map,l=at(r,a,i);if(t.captureOnly)return{plan:r,capture:l,compose:null};let c=lt(r,a),u=await Se(r.compose,c,n??void 0);return{plan:r,capture:l,compose:u}}finally{n&&typeof n.close=="function"&&await n.close()}}async function Ee(e,t={}){if(e.includes("--help")||e.includes("-h"))return console.log(`
|
|
93
93
|
rnx screenshot appstore \u2014 capture and compose app-store screenshot sets
|
|
94
94
|
|
|
95
95
|
usage:
|
|
@@ -111,7 +111,7 @@ examples:
|
|
|
111
111
|
rnx screenshot appstore --plan app-store.yaml
|
|
112
112
|
rnx screenshot appstore --plan app-store.yaml --sim a9
|
|
113
113
|
rnx screenshot appstore --plan app-store.yaml --org acme --repo mobile
|
|
114
|
-
`),0;let r=p=>e.find((y,f)=>e[f-1]===p),i=new Set(["--plan","--sim","--app","--device","--org","--repo","--api-origin"]),o=e.filter((p,y)=>{if(p.startsWith("-"))return!1;let f=e[y-1];return!f||!i.has(f)}),s=r("--plan")||o[0];if(!s)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let n=r("--sim")?.trim()||null,a=r("--app")?.trim()||null,l=r("--device")?.trim()||null,c=r("--org")?.trim()||null,u=r("--repo")?.trim()||null,d=r("--api-origin")?.trim()||null,m=e.includes("--capture-only"),h=e.includes("--compose-only"),w=null;if(c||u){if(!c||!u)return console.error(" error: --org and --repo must be passed together."),1;let p=
|
|
114
|
+
`),0;let r=p=>e.find((y,f)=>e[f-1]===p),i=new Set(["--plan","--sim","--app","--device","--org","--repo","--api-origin"]),o=e.filter((p,y)=>{if(p.startsWith("-"))return!1;let f=e[y-1];return!f||!i.has(f)}),s=r("--plan")||o[0];if(!s)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let n=r("--sim")?.trim()||null,a=r("--app")?.trim()||null,l=r("--device")?.trim()||null,c=r("--org")?.trim()||null,u=r("--repo")?.trim()||null,d=r("--api-origin")?.trim()||null,m=e.includes("--capture-only"),h=e.includes("--compose-only"),w=null;if(c||u){if(!c||!u)return console.error(" error: --org and --repo must be passed together."),1;let p=oe();if(!p)return console.error(" error: --org/--repo needs auth \u2014 run `rnx login` or set RNX_API_KEY."),1;let y=d||(p.kind==="session"?p.origin:"https://contrast.dev");try{w=await xe({org:c,repo:u,origin:y,authHeader:ne(p)})}catch(f){return console.error(` ${f.message}`),1}!w||w.length===0?console.log(` note: no org deck for ${c}/${u} \u2014 composing with the plan's copy/colors.`):console.log(` org deck: ${w.length} slide(s) from ${c}/${u}`)}try{let p=await De(s,{simId:n,appTarget:a,deviceModel:l,captureOnly:m,composeOnly:h,orgDeckFrames:w});return console.log(` capture manifest: ${p.capture.manifestPath}`),p.compose?(console.log(` compose manifest: ${p.compose.manifestPath}`),console.log(` exports: ${p.compose.outputs.length}`)):console.log(" compose skipped"),0}catch(p){return console.error(` screenshots failed: ${p.message}`),1}}import{mkdirSync as ct,writeFileSync as ut}from"node:fs";import{dirname as dt,isAbsolute as pt,join as Fe,resolve as mt}from"node:path";var ht=`
|
|
115
115
|
rnx screenshot slides \u2014 compose App Store screenshots in the live sim
|
|
116
116
|
|
|
117
117
|
usage:
|
|
@@ -145,7 +145,7 @@ examples:
|
|
|
145
145
|
rnx screenshot slides set 1 --title "The ultimate MMA community." --bg-top cyan --bg-bottom black
|
|
146
146
|
rnx screenshot slides capture 1
|
|
147
147
|
rnx screenshot slides export --out ./exports
|
|
148
|
-
`,
|
|
148
|
+
`,ft={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function gt(e){let t=[],r={},i=!1;for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--json"){i=!0;continue}let n=s.indexOf("="),a=n>0?s.slice(0,n):s,l=ft[a];if(l){n>0?r[l]=s.slice(n+1):(r[l]=e[o+1]??"",o+=1);continue}t.push(s)}return{rest:t,values:r,json:i}}function wt(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function yt(e){if(!await Z(e,`(async () => {
|
|
149
149
|
if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
|
|
150
150
|
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
151
151
|
detail: { type: 'fire-action', id: 'toggle-screenshot-mode' },
|
|
@@ -156,4 +156,4 @@ examples:
|
|
|
156
156
|
await new Promise((r) => setTimeout(r, 40))
|
|
157
157
|
}
|
|
158
158
|
return false
|
|
159
|
-
})()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function
|
|
159
|
+
})()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function bt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let r=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",o=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${o} [${r}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function St(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Re(e,t){if(e.includes("--help")||e.includes("-h")){console.log(ht);return}let{rest:r,values:i,json:o}=gt(e),s=B(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=wt(s.positional[1]),l=Number(s.positional[2]),c=O(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):bt(d)};try{switch(await yt(c),n){case"list":{u(await N(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: rnx screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await k(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await k(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnx screenshot slides remove <n>");u(await k(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: rnx screenshot slides move <n> <position>");u(await k(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnx screenshot slides focus <n>");u(await k(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await k(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await k(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?pt(i.out)?i.out:mt(process.cwd(),i.out):Fe(process.cwd(),"screenshots"),m=await N(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await N(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Fe(d,y.name);ct(dt(f),{recursive:!0}),ut(f,St(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}o&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see rnx screenshot slides --help`)}}finally{c.close()}}var xt=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),Pt=new Set(["capture","slides","appstore","layers"]);function Ae(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){xt.has(r)&&t++;continue}return Pt.has(r)?{name:r,index:t}:null}return null}function F(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function $t(e){let t=[];for(let r=0;r<e.length;r++){if(e[r]==="--sim"){r++;continue}t.push(e[r])}return t}async function $r(e,t){let r=Ae(e);if(!r||r.name==="capture"){await me(r?F(e,r.index):e,t);return}if(r.name==="slides"){await Re(F(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-IZP3L3AQ.js");await s(F(e,r.index),t);return}let i=F(e,r.index),o=Ae(i);if(o?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-K7LJOVAE.js");return await s($t(F(i,o.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the rnx workspace (playwright is not shipped with the published CLI)."),1;throw s}return Ee(i,t)}export{$r as runScreenshotCommand};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as R}from"./chunk-LIMWG54N.js";import"./chunk-3UXXYJVD.js";import{o as I,p as S}from"./chunk-AALKIAUZ.js";import"./chunk-EWSWOWXK.js";import"./chunk-JZLDHPB7.js";import{b as f}from"./chunk-CMVRTZ5G.js";import{t as v,v as w,y as b}from"./chunk-EOIBLKZO.js";import"./chunk-OJZHECGH.js";import{c}from"./chunk-AVJBT5LF.js";import"./chunk-U63T6LIQ.js";import"./chunk-I52NT6VG.js";import{mkdirSync as F,writeFileSync as $}from"fs";import{resolve as u}from"path";async function _(s,D){(s.includes("--help")||s.includes("-h"))&&(console.log(`
|
|
5
|
+
sootsim screenshot layers \u2014 export a screen as engine-isolated layers
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
sootsim screenshot layers --ids <testID,testID,...> [--out-dir <dir>]
|
|
9
|
+
|
|
10
|
+
options:
|
|
11
|
+
--ids <list> comma-separated testIDs of the subtrees to isolate
|
|
12
|
+
--out-dir <dir> output directory (default: /tmp/sootsim-layers)
|
|
13
|
+
|
|
14
|
+
output:
|
|
15
|
+
full.png the normal frame
|
|
16
|
+
base.png the frame re-rendered with every listed subtree hidden
|
|
17
|
+
layer-<id>.png each subtree rendered alone on a transparent frame
|
|
18
|
+
manifest.json device metrics + logical rect per layer
|
|
19
|
+
`),c(0));let g=s.find((r,n)=>s[n-1]==="--ids");g||(console.error(" --ids is required (comma-separated testIDs)"),c(1));let i=g.split(",").map(r=>r.trim()).filter(Boolean);i.length===0&&(console.error(" --ids resolved to an empty list"),c(1));let M=s.find((r,n)=>s[n-1]==="--out-dir"),l=u(process.cwd(),M??"/tmp/sootsim-layers"),B=v(s,{port:D.port,stripValueFlags:["--ids","--out-dir"]}),o=w({...B,commandTimeoutMs:45e3});try{let r=await S(o,9e4);if(!r.ready)throw new Error(`app not ready to capture after ${Math.round(r.elapsedMs/1e3)}s (${I(r)})`);let n={};for(let e of i){let t=await o.send({type:"evaluate",code:R({id:e})});if(!t)throw new Error(`no node with testID "${e}"`);n[e]=t}F(l,{recursive:!0});let p=(e,t)=>{if(typeof t!="string"||!t.startsWith("data:image/png;base64,"))throw new Error(`capture for ${e} returned no image data`);let y=u(l,e);$(y,Buffer.from(t.slice(22),"base64")),console.log(` saved: ${y}`)};p("full.png",await o.send({type:"screenshot"})),p("base.png",await o.send({type:"screenshot",captureFilter:{hideTestIds:i}}));for(let e of i)p(`layer-${e}.png`,await o.send({type:"screenshot",captureFilter:{soloTestId:e,hideTestIds:i.filter(t=>t!==e)}}));let m=await b(o,"SootSim.bridges.settings.get")??{deviceModel:null},a=typeof m.deviceModel=="string"&&m.deviceModel in f?m.deviceModel:null,d=a?f[a]:null,E={device:d?{model:a,width:d.width,height:d.height,scale:d.scale}:{model:a},layers:i.map(e=>({testId:e,rect:n[e]}))},h=u(l,"manifest.json");$(h,`${JSON.stringify(E,null,2)}
|
|
20
|
+
`),console.log(` saved: ${h}`)}finally{o.close()}}export{_ as runScreenshotLayers};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{b as I}from"./chunk-X6WQ4YWE.js";import{a as U}from"./chunk-NTC46LSA.js";import"./chunk-6W4HIWC7.js";import{c as M}from"./chunk-AVJBT5LF.js";import"./chunk-U63T6LIQ.js";import{a as F}from"./chunk-64JAEJ6N.js";import"./chunk-I52NT6VG.js";import{execSync as A}from"node:child_process";import{mkdirSync as O,mkdtempSync as j,rmSync as G,writeFileSync as q}from"node:fs";import{tmpdir as B}from"node:os";import{dirname as L,isAbsolute as z,join as T,resolve as W}from"node:path";import{chromium as H}from"playwright-core";var J=`
|
|
5
|
+
rnx screenshot appstore capture \u2014 headlessly capture + upload App Store slides
|
|
6
|
+
|
|
7
|
+
usage:
|
|
8
|
+
rnx screenshot appstore capture --org <org> --repo <repo> [options]
|
|
9
|
+
|
|
10
|
+
what it does:
|
|
11
|
+
boots the org-mode build shell in headless GPU Chrome (authed via your
|
|
12
|
+
\`rnx login\` session), captures each slide through the live screenshot
|
|
13
|
+
composer so every slide gets editable layers (captureRef + cleanRef +
|
|
14
|
+
screenRef), and lets the shell auto-upload them to your org deck.
|
|
15
|
+
|
|
16
|
+
options:
|
|
17
|
+
--org <org> github org slug (required)
|
|
18
|
+
--repo <repo> repo name (required)
|
|
19
|
+
--branch <branch> build branch to boot (default: main)
|
|
20
|
+
--platform <p> ios | android (default: ios)
|
|
21
|
+
--slides <list> 1-based indices to capture, e.g. 1,3,5 (default: all)
|
|
22
|
+
--dry-run capture + report refs, do NOT upload (PUTs aborted)
|
|
23
|
+
--force allow overwriting a NON-EMPTY existing deck
|
|
24
|
+
--out <dir> also write composed App-Store PNGs locally
|
|
25
|
+
--shell-origin <url> origin serving /build (default: your session origin)
|
|
26
|
+
--api-origin <url> origin for deck/capture APIs (default: session origin)
|
|
27
|
+
--timeout <ms> per-step bridge timeout (default: 45000)
|
|
28
|
+
--json machine-readable summary
|
|
29
|
+
|
|
30
|
+
examples:
|
|
31
|
+
rnx screenshot appstore capture --org acme --repo my-app --dry-run
|
|
32
|
+
rnx screenshot appstore capture --org acme --repo my-app --branch main --force
|
|
33
|
+
`;function Y(t){let e=a=>{let d=t.indexOf(a);return d>=0?t[d+1]:void 0},n=a=>t.includes(a),s=e("--slides"),i=s?s.split(",").map(a=>Number(a.trim())).filter(a=>Number.isInteger(a)&&a>0):null;return{org:e("--org")??"",repo:e("--repo")??"",branch:e("--branch")??"main",platform:e("--platform")??"ios",slides:i&&i.length?i:null,dryRun:n("--dry-run"),force:n("--force"),out:e("--out")??null,shellOrigin:e("--shell-origin")??null,apiOrigin:e("--api-origin")??null,timeoutMs:Number(e("--timeout")??"45000")||45e3,json:n("--json")}}function K(){let t=U();if(t&&t.kind==="session")return{token:t.token,origin:t.origin};process.stderr.write(`
|
|
34
|
+
rnx screenshot appstore capture needs a logged-in session.
|
|
35
|
+
run \`rnx login\` first (the captured slides upload to that account).
|
|
36
|
+
|
|
37
|
+
`),M(1)}function Q(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();return e==="localhost"||e.endsWith(".localhost")||e==="::1"||/^127(?:\.\d{1,3}){3}$/.test(e)}function V(t){let e=new URL(t);if(Q(e.hostname)){let s=(Number(e.port)||3e3)-3e3;if(s>=0&&s<=1e3)return e.port=String(5173+s),e.origin}return e.hostname==="contrast.dev"||e.hostname.endsWith(".contrast.dev")?F.origin:t}function X(){try{return Number(A("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function Z(t,e,n,s){let i=await fetch(`${t}/api/sootsim/screenshot-decks?org=${encodeURIComponent(n)}&repo=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e}`}});if(!i.ok)return[];let a=await i.json().catch(()=>null),d=[];for(let g of a?.decks??[])Array.isArray(g.config?.frames)&&d.push(...g.config.frames);return d}async function _(t,e,n,s){let i=await fetch(`${t}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(s)}&org=${encodeURIComponent(n)}`,{headers:{authorization:`Bearer ${e}`}});return i.ok?`data:image/png;base64,${Buffer.from(await i.arrayBuffer()).toString("base64")}`:null}async function ee(t,e){let n=Date.now()+e;for(;Date.now()<n;){for(let s of t.frames())if(await s.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return s;await t.waitForTimeout(250)}throw new Error("screenshot bridge never appeared \u2014 the build shell did not boot screenshot mode (check --branch/--platform has a ready build, and you are logged in)")}async function N(t){return t.evaluate(async()=>{let n=globalThis.SootSim?.bridges?.screenshotControl;if(!n)throw new Error("screenshotControl missing");return n.getState()})}async function te(t){await t.evaluate(async()=>{let e=globalThis.SootSim?.bridges?.settings,n=Date.now()+3e3;for(;Date.now()<n;){if(e?.get?.()?.screenshotMode)return;await new Promise(s=>setTimeout(s,50))}e&&!e.get().screenshotMode&&(e.set("screenshotMode",!0),e.get().showFrame||e.set("showFrame",!0))})}async function re(t,e,n,s){await t.evaluate(async([i,a,d])=>{let g=globalThis.SootSim,h=g?.bridges?.screenshotControl;if(!h)throw new Error("screenshotControl missing");let w=b=>new Promise(u=>setTimeout(u,b));if(a){h.focusSlide(i);let b=Date.now()+3e4,u=g?.bridges?.threeMode;for(;Date.now()<b&&(u=g?.bridges?.threeMode,!(u?.setScreenImage&&u?.captureStage&&u?.getState?.()?.ready));)await w(150);await w(1e3);let c=a;u?.configure?.({colorway:c.colorway,background:c.background,...c.customGradient?{customGradient:c.customGradient}:{},setting:c.setting,focus:c.focus,environment:c.environmentActive?{pins:c.environmentPins??{},effects:c.environmentEffects??{}}:!1,pose:{phonePosition:c.phonePosition,phoneRotation:c.phoneRotation,cameraPosition:c.cameraPosition,target:c.target}}),await w(900),d&&u?.setScreenImage&&(u.setScreenImage(d),await w(1200))}await h.capture(i)},[e,n,s])}async function me(t){if(t.includes("--help")||t.includes("-h"))return console.log(J),0;let e=Y(t);if(!e.org||!e.repo)return process.stderr.write(` --org and --repo are required (see --help)
|
|
38
|
+
`),1;let{token:n,origin:s}=K(),i=(e.apiOrigin??s).replace(/\/$/,""),a=(e.shellOrigin??V(i)).replace(/\/$/,""),d=await Z(i,n,e.org,e.repo);if(!e.dryRun&&!e.force&&d.length>0)return process.stderr.write(` refusing to overwrite the existing ${e.org}/${e.repo} deck (${d.length} slide(s)). re-run with --force to replace it, or --dry-run to preview.
|
|
39
|
+
`),1;let g=X(),h=Number(A("sysctl -n hw.ncpu").toString().trim())||8;if(g>h)return process.stderr.write(` load average ${g.toFixed(1)} exceeds ${h} cores \u2014 tear down other work first.
|
|
40
|
+
`),1;let w=`${a}/build/${encodeURIComponent(e.org)}/${encodeURIComponent(e.repo)}/${encodeURIComponent(e.branch)}?platform=${encodeURIComponent(e.platform)}&ssMode=1`,b=j(T(B(),"sootsim-capture-")),{browser:u,reapNow:c}=await I(o=>H.launchPersistentContext(b,o),{headless:!0,viewport:{width:393,height:852},deviceScaleFactor:3,args:["--hide-scrollbars"]});await u.addInitScript(o=>{try{localStorage.setItem("sootsim.session.token",o)}catch{}},n);let y=[],m=u.pages()[0]??await u.newPage();e.dryRun?await m.route(/\/api\/sootsim\/screenshot-(decks|capture)/,o=>o.request().method()==="PUT"?o.abort():o.continue()):m.on("response",o=>{let p=o.url();o.request().method()==="PUT"&&(p.includes("/api/sootsim/screenshot-decks")?y.push({kind:"deck",status:o.status()}):p.includes("/api/sootsim/screenshot-capture")&&y.push({kind:"capture",status:o.status()}))});let R=[];m.on("pageerror",o=>R.push(o.message));let D=m.waitForResponse(o=>o.url().includes("/api/sootsim/screenshot-decks")&&o.request().method()==="GET",{timeout:e.timeoutMs}).catch(()=>null);try{await m.goto(w,{waitUntil:"domcontentloaded",timeout:e.timeoutMs});let o=await ee(m,e.timeoutMs);await te(o),await D,await m.waitForTimeout(800);let p=await N(o);if(p.slides.length===0)return process.stderr.write(` the deck has no slides to capture \u2014 add slides in the composer first.
|
|
41
|
+
`),1;let $=e.slides?p.slides.filter(r=>e.slides.includes(r.index)):p.slides;console.log(` ${p.projectName} on ${p.deviceModel} \u2014 capturing ${$.length}/${p.slides.length} slide(s)${e.dryRun?" (dry-run, no upload)":""}`);for(let r of $)try{let l=d[r.index-1],f=l?.threeScene??null,C=f&&l?.screenRef?await _(i,n,e.org,l.screenRef):null;await re(o,r.index,f,C),console.log(` \u2713 slide ${r.index} "${r.title.slice(0,40)}"`)}catch(l){console.log(` \u2717 slide ${r.index} "${r.title.slice(0,40)}" \u2014 ${l.message}`)}e.dryRun||await m.waitForTimeout(2500);let S=(await N(o)).slides.filter(r=>$.some(l=>l.id===r.id)),v=[];if(e.out){let r=z(e.out)?e.out:W(process.cwd(),e.out);for(let l of S){if(!l.captureRef)continue;let f=await o.evaluate(async k=>{let x=globalThis.SootSim?.bridges?.screenshotControl;if(!x)throw new Error("screenshotControl missing");return x.exportSlide(k)},l.index),C=f.dataUrl.match(/^data:[^;]+;base64,(.+)$/);if(C){let k=T(r,f.name);O(L(k),{recursive:!0}),q(k,Buffer.from(C[1],"base64")),v.push(k)}}}let P=S.filter(r=>r.captureRef&&r.cleanRef),E={org:e.org,repo:e.repo,branch:e.branch,dryRun:e.dryRun,slides:S.map(r=>({index:r.index,title:r.title,captureRef:!!r.captureRef,cleanRef:!!r.cleanRef,screenRef:!!r.screenRef,captureMode:r.captureMode})),editableCount:P.length,uploads:e.dryRun?"skipped (dry-run)":y,written:v,pageErrors:R.slice(0,5)};if(e.json)console.log(JSON.stringify(E,null,2));else{console.log(`
|
|
42
|
+
${P.length}/${S.length} slide(s) now have editable layers (captureRef + cleanRef)`);let r=S.filter(l=>l.captureRef&&!l.cleanRef);if(r.length&&console.log(` \u26A0 ${r.length} slide(s) baked a flat capture only (no cleanRef) \u2014 typically 3d slides whose scene didn't restore for a re-bake.`),!e.dryRun){let l=y.filter(f=>f.status>=200&&f.status<300).length;console.log(` uploads: ${l}/${y.length} PUT(s) succeeded`)}v.length&&console.log(` wrote ${v.length} local PNG(s) to ${e.out}`),R.length&&console.log(` \u26A0 ${R.length} page error(s) during capture`)}return 0}finally{await u.close().catch(()=>{}),c(),G(b,{recursive:!0,force:!0})}}export{me as runScreenshotsCapture};
|