rnxsim 0.1.335 → 0.1.337
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 +104 -76
- package/cli/auth.ts +2 -2
- package/cli/bin.ts +7 -3
- package/cli/bridge-flow-runner.ts +2 -2
- package/cli/commands/agent-wrapper.ts +1 -1
- package/cli/commands/agent.ts +12 -12
- package/cli/commands/app-fonts.ts +1 -1
- package/cli/commands/assert.ts +7 -7
- package/cli/commands/auth.ts +4 -4
- package/cli/commands/camera.ts +13 -13
- package/cli/commands/cleanup.ts +6 -6
- package/cli/commands/compat.ts +4 -4
- package/cli/commands/config.ts +2 -2
- package/cli/commands/control.ts +37 -43
- package/cli/commands/cpu-profile.ts +2 -2
- package/cli/commands/daemon-mac-app.ts +2 -2
- package/cli/commands/daemon.ts +12 -12
- package/cli/commands/debug.ts +22 -22
- package/cli/commands/desktop.ts +3 -3
- package/cli/commands/detox.ts +17 -17
- package/cli/commands/device.ts +9 -9
- package/cli/commands/diagnose.ts +11 -11
- package/cli/commands/electron.ts +7 -7
- package/cli/commands/film.ts +6 -6
- package/cli/commands/inspect/core.ts +6 -7
- package/cli/commands/inspect/find.ts +2 -2
- package/cli/commands/inspect.ts +36 -36
- package/cli/commands/install-desktop.ts +8 -8
- package/cli/commands/login.ts +6 -6
- package/cli/commands/maestro-generate.ts +2 -2
- package/cli/commands/maestro.ts +23 -23
- package/cli/commands/mode.ts +4 -4
- package/cli/commands/no-bridge-hint.ts +9 -9
- package/cli/commands/perf.ts +11 -11
- package/cli/commands/permissions.ts +5 -5
- package/cli/commands/profile.ts +11 -11
- package/cli/commands/react.ts +15 -15
- package/cli/commands/record.ts +15 -15
- package/cli/commands/report-issue.ts +2 -2
- package/cli/commands/reset.ts +2 -2
- package/cli/commands/runtime.ts +18 -18
- package/cli/commands/screenshot-mode.ts +5 -5
- package/cli/commands/screenshot.ts +12 -12
- package/cli/commands/screenshots-capture.ts +7 -7
- package/cli/commands/screenshots.ts +6 -6
- package/cli/commands/serve.ts +6 -6
- package/cli/commands/setup.ts +13 -15
- package/cli/commands/skills.ts +14 -14
- package/cli/commands/slides.ts +19 -23
- package/cli/commands/state.ts +2 -2
- package/cli/commands/storage.ts +3 -3
- package/cli/commands/telemetry.ts +1 -1
- package/cli/commands/three-mode.ts +16 -16
- package/cli/commands/timeline.ts +4 -4
- package/cli/commands/upgrade.ts +1 -1
- package/cli/commands/upload.ts +11 -11
- package/cli/commands/version.ts +3 -5
- package/cli/commands/what-happened.ts +11 -11
- package/cli/drivers/electron.ts +3 -3
- package/cli/hints.ts +8 -8
- package/cli/recording-access.ts +1 -1
- package/cli/ws-bridge.ts +5 -5
- package/dist-cli/bin.js +5 -5
- package/dist-cli/chunks/{agent-XSJMAFVA.js → agent-QQ3RJNRY.js} +14 -14
- package/dist-cli/chunks/{agent-wrapper-NFLJ5K64.js → agent-wrapper-M6SQSMRY.js} +3 -3
- package/dist-cli/chunks/app-fonts-F6NDV3XC.js +4 -0
- package/dist-cli/chunks/{assert-ILAXIYB5.js → assert-5VB3KQNK.js} +12 -12
- package/dist-cli/chunks/auth-PFXODKFN.js +12 -0
- package/dist-cli/chunks/{beta-TDR6UKJU.js → beta-WUWYHT4F.js} +2 -2
- package/dist-cli/chunks/camera-V3MMTKP7.js +33 -0
- package/dist-cli/chunks/{chunk-INBPUR4T.js → chunk-2ANFH72P.js} +11 -11
- package/dist-cli/chunks/chunk-2GIA5T6B.js +74 -0
- package/dist-cli/chunks/{chunk-GP6QEBZA.js → chunk-4FRSEZ7Z.js} +1 -1
- package/dist-cli/chunks/{chunk-USGOQ3YJ.js → chunk-4GXBZHNA.js} +2 -2
- package/dist-cli/chunks/{chunk-R3CMECGC.js → chunk-4HESY5E7.js} +4 -4
- package/dist-cli/chunks/{chunk-WKT7YM5Q.js → chunk-4VJEXQGD.js} +1 -1
- package/dist-cli/chunks/{chunk-FE6ZHPKD.js → chunk-5LJNNHZH.js} +1 -1
- package/dist-cli/chunks/{chunk-I2HQB5NN.js → chunk-5QXGSTYI.js} +2 -2
- package/dist-cli/chunks/{chunk-FJSHIWAM.js → chunk-5SHAOQHJ.js} +2 -2
- package/dist-cli/chunks/{chunk-CGZWLSYD.js → chunk-5UPRBMIG.js} +1 -1
- package/dist-cli/chunks/{chunk-ZTM2MKNI.js → chunk-5ZEFRPCC.js} +1 -1
- package/dist-cli/chunks/{chunk-RTD3CPDQ.js → chunk-6ART4XVJ.js} +23 -23
- package/dist-cli/chunks/{chunk-MTD6IAEA.js → chunk-6CAUT2LH.js} +1 -1
- package/dist-cli/chunks/{chunk-ZYHCWCMM.js → chunk-7ATIH7OU.js} +1 -1
- package/dist-cli/chunks/{chunk-RVUGKXJD.js → chunk-7Q4QKHMA.js} +1 -1
- package/dist-cli/chunks/{chunk-MTNIDSOA.js → chunk-ABK2V2PR.js} +1 -1
- package/dist-cli/chunks/{chunk-TL4DNDDY.js → chunk-B53ILAHI.js} +2 -2
- package/dist-cli/chunks/{chunk-POC3QTA6.js → chunk-BSSVLFZR.js} +2 -2
- package/dist-cli/chunks/chunk-BVOBXTPN.js +30 -0
- package/dist-cli/chunks/{chunk-4KC35DMK.js → chunk-CPDEUWL5.js} +2 -2
- package/dist-cli/chunks/{chunk-HNQLZZJA.js → chunk-DINU267S.js} +2 -2
- package/dist-cli/chunks/{chunk-DCDKJ4NC.js → chunk-DQQ4CZVC.js} +2 -2
- package/dist-cli/chunks/{chunk-JWAY6DIH.js → chunk-EDWN2HOO.js} +18 -18
- package/dist-cli/chunks/{chunk-3CS4EUMG.js → chunk-EWVG4A3B.js} +2 -2
- package/dist-cli/chunks/{chunk-RTEJXUXN.js → chunk-F3NKCQHM.js} +6 -6
- package/dist-cli/chunks/{chunk-M7CBQ5I4.js → chunk-GEAGFYKP.js} +1 -1
- package/dist-cli/chunks/chunk-GGNH44PZ.js +5 -0
- package/dist-cli/chunks/{chunk-YSUIYK6B.js → chunk-HAHJJJUC.js} +2 -2
- package/dist-cli/chunks/chunk-HPJ5EKIZ.js +4 -0
- package/dist-cli/chunks/{chunk-IN2PZBQD.js → chunk-IBTHGFKE.js} +2 -2
- package/dist-cli/chunks/{chunk-ZZWO6Y7X.js → chunk-J6BYRRZQ.js} +2 -2
- package/dist-cli/chunks/{chunk-6Y3PVPTF.js → chunk-JK4OZ2TQ.js} +5 -5
- package/dist-cli/chunks/{chunk-PO3TOAED.js → chunk-KGQAO25M.js} +2 -2
- package/dist-cli/chunks/{chunk-J7XFINJG.js → chunk-L6UUIQE7.js} +2 -2
- package/dist-cli/chunks/{chunk-35XNGT5C.js → chunk-LXYLCETR.js} +1 -1
- package/dist-cli/chunks/{chunk-JWK5WD44.js → chunk-LZAL3DMP.js} +2 -2
- package/dist-cli/chunks/{chunk-3ZDOPKHE.js → chunk-M43UU7UG.js} +4 -4
- package/dist-cli/chunks/{chunk-ROPHZJ6P.js → chunk-M4LGUVBM.js} +2 -2
- package/dist-cli/chunks/{chunk-RELRA5VW.js → chunk-NCG6C5AH.js} +2 -2
- package/dist-cli/chunks/{chunk-42KDXJUD.js → chunk-NR5TSR2Y.js} +2 -2
- package/dist-cli/chunks/{chunk-R2UL5VFY.js → chunk-OCPWXT73.js} +3 -3
- package/dist-cli/chunks/{chunk-VV4MXLFR.js → chunk-ODKS6JUJ.js} +1 -1
- package/dist-cli/chunks/{chunk-F33DUJGG.js → chunk-R2WBREGQ.js} +1 -1
- package/dist-cli/chunks/chunk-RKY3ZNTA.js +5 -0
- package/dist-cli/chunks/{chunk-MGGRL2Z2.js → chunk-SW7BHOMO.js} +9 -9
- package/dist-cli/chunks/{chunk-GVKISFQ3.js → chunk-TJTLXG3R.js} +1 -1
- package/dist-cli/chunks/chunk-TNI4PW75.js +124 -0
- package/dist-cli/chunks/{chunk-CL3PREIE.js → chunk-UWEDNDND.js} +2 -2
- package/dist-cli/chunks/{chunk-IV36DY6M.js → chunk-WRID5SBV.js} +1 -1
- package/dist-cli/chunks/{chunk-42ALI64M.js → chunk-WUYI3XJ5.js} +2 -2
- package/dist-cli/chunks/{chunk-6VN5ULGQ.js → chunk-X7MHCEGG.js} +2 -2
- package/dist-cli/chunks/chunk-XIQFYLWD.js +15 -0
- package/dist-cli/chunks/{chunk-LCVUJCRJ.js → chunk-ZUK5ZQU7.js} +1 -1
- package/dist-cli/chunks/{cleanup-X6ZRPFDV.js → cleanup-6WBS3MUO.js} +10 -10
- package/dist-cli/chunks/cli-version-HUQCDGMA.js +4 -0
- package/dist-cli/chunks/{compat-VRXJ5J56.js → compat-2WOPKJYK.js} +9 -9
- package/dist-cli/chunks/{config-LHPPE4EP.js → config-FPD7WUYB.js} +5 -5
- package/dist-cli/chunks/{control-TVTNGSSF.js → control-B3XNER7I.js} +2 -2
- package/dist-cli/chunks/daemon-T4D4X2P5.js +4 -0
- package/dist-cli/chunks/{debug-EUHBBPGM.js → debug-LKV5CEAV.js} +17 -17
- package/dist-cli/chunks/desktop-EMDPOYQT.js +31 -0
- package/dist-cli/chunks/detox-4J4UTZE7.js +52 -0
- package/dist-cli/chunks/{device-PONITUZJ.js → device-PMZ7RPXQ.js} +11 -11
- package/dist-cli/chunks/{diagnose-2PN4K4L2.js → diagnose-MLEP727D.js} +12 -12
- package/dist-cli/chunks/{disk-cleanup-U2PQLOEW.js → disk-cleanup-CVEDIPEE.js} +2 -2
- package/dist-cli/chunks/drivers-NTUKJEL6.js +4 -0
- package/dist-cli/chunks/{film-XGZCFTQL.js → film-4RNECABF.js} +9 -9
- package/dist-cli/chunks/flow-5IOCAHVO.js +4 -0
- package/dist-cli/chunks/help-NUJUYEWP.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-I4MYF5CO.js → hidden-runtime-alias-YIF25W4F.js} +2 -2
- package/dist-cli/chunks/{home-paths-YRAPZ5LE.js → home-paths-WNJCCCCZ.js} +2 -2
- package/dist-cli/chunks/inspect-MFEIYUCN.js +4 -0
- package/dist-cli/chunks/install-desktop-NB65KI4D.js +4 -0
- package/dist-cli/chunks/{login-ZMAIAQ6F.js → login-VEHHGN42.js} +6 -6
- package/dist-cli/chunks/{logout-UQZ5JBJU.js → logout-VE7PNXL2.js} +2 -2
- package/dist-cli/chunks/{maestro-BQYKDUC4.js → maestro-ZXHTDEOI.js} +25 -25
- package/dist-cli/chunks/{maestro-generate-VQYMMQJ5.js → maestro-generate-TK33E2Z6.js} +3 -3
- package/dist-cli/chunks/mode-ZDKJ56NT.js +26 -0
- package/dist-cli/chunks/{optional-demo-registry-DUWHCLGD.js → optional-demo-registry-GBZ3WVDW.js} +2 -2
- package/dist-cli/chunks/{perf-7RAU7WRZ.js → perf-JXNZOUKW.js} +28 -28
- package/dist-cli/chunks/permissions-WQ62PW7Y.js +13 -0
- package/dist-cli/chunks/record-4S3ZMDIO.js +72 -0
- package/dist-cli/chunks/{report-issue-P376KFFU.js → report-issue-KKBADTWO.js} +4 -4
- package/dist-cli/chunks/reset-H5XIISJE.js +4 -0
- package/dist-cli/chunks/runtime-FK7EEMWA.js +4 -0
- package/dist-cli/chunks/{screenshot-command-NE7BKTQ2.js → screenshot-command-42U5MVQL.js} +34 -34
- package/dist-cli/chunks/{screenshot-layers-UE4R64PZ.js → screenshot-layers-4G42AHOX.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-ULXPLXMC.js → screenshots-capture-HMQ2OO3I.js} +11 -11
- package/dist-cli/chunks/{serve-P7BT4XHR.js → serve-S4V5EDW2.js} +16 -16
- package/dist-cli/chunks/setup-T43V7GA6.js +32 -0
- package/dist-cli/chunks/{skills-NTRYKJSF.js → skills-O426K26J.js} +16 -16
- package/dist-cli/chunks/{state-4D5YAM47.js → state-ZEEPDKJG.js} +5 -5
- package/dist-cli/chunks/storage-4GQLOFGG.js +37 -0
- package/dist-cli/chunks/store-RFMSNWLJ.js +4 -0
- package/dist-cli/chunks/telemetry-NFAAPSMN.js +4 -0
- package/dist-cli/chunks/{timeline-GZNFGD3Q.js → timeline-ONCYX7KW.js} +6 -6
- package/dist-cli/chunks/{upgrade-A46D6PEY.js → upgrade-A36T52AM.js} +2 -2
- package/dist-cli/chunks/upload-36O32DII.js +4 -0
- package/dist-cli/chunks/version-67HA253N.js +6 -0
- package/dist-cli/chunks/{web-H2IXO5SC.js → web-PWXQHQIE.js} +2 -2
- package/dist-cli/chunks/{what-happened-Z7UII5GH.js → what-happened-WNXE622R.js} +16 -16
- package/dist-lib/agent-daemon-client.cjs +5 -5
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +4 -4
- 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.cjs +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 +7 -7
- 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/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +248 -98
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +2 -2
- package/dist-lib/metro-host-modules/react-dom.js +6 -0
- package/dist-lib/metro-host-modules/react-native-web.js +6 -0
- package/dist-lib/metro-host-modules/react-native.js +6 -0
- package/dist-lib/metro-host-modules/react.js +6 -0
- package/dist-lib/metro-host-modules/react__jsx-dev-runtime.js +6 -0
- package/dist-lib/metro-host-modules/react__jsx-runtime.js +6 -0
- package/dist-lib/metro-production-bundle.cjs +72 -0
- package/dist-lib/metro-production-bundle.mjs +44 -0
- package/dist-lib/metro.cjs +152 -8
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/react-native-host-modules.cjs +50 -0
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +6 -7
- package/dist-lib/sdk.mjs +6 -7
- package/dist-lib/skills.cjs +71 -77
- package/dist-lib/vite.cjs +104 -85
- package/package.json +15 -2
- package/scripts/preuninstall.cjs +1 -1
- package/skills/contrast/SKILL.md +67 -75
- package/skills/rnx-debug/SKILL.md +84 -84
- package/skills/rnx-perf/SKILL.md +8 -8
- package/skills/rnx-setup/SKILL.md +54 -54
- package/skills/rnx-test/SKILL.md +35 -35
- package/skills/rnx-visual/SKILL.md +18 -18
- package/src/agent-daemon-client.ts +2 -2
- package/src/agent-sessions.ts +2 -2
- package/src/connect.ts +6 -6
- package/src/disk-cleanup.ts +1 -1
- package/src/home-paths.ts +1 -1
- package/src/host/bridge-host.ts +6 -6
- package/src/index.ts +1 -1
- package/src/metro-host-modules/react-dom.js +6 -0
- package/src/metro-host-modules/react-native-web.js +6 -0
- package/src/metro-host-modules/react-native.js +6 -0
- package/src/metro-host-modules/react.js +6 -0
- package/src/metro-host-modules/react__jsx-dev-runtime.js +6 -0
- package/src/metro-host-modules/react__jsx-runtime.js +6 -0
- package/src/metro-plugin.ts +249 -10
- package/src/metro-production-bundle.ts +51 -0
- package/src/public-brand.ts +1 -1
- package/src/react-native-host-modules.ts +25 -0
- package/src/runtime-assets.ts +1 -1
- package/src/sim-client.ts +1 -1
- package/src/vite-plugin-one.ts +171 -145
- package/dist-cli/chunks/app-fonts-L3UXFYVE.js +0 -4
- package/dist-cli/chunks/auth-ISX2EUQL.js +0 -12
- package/dist-cli/chunks/camera-4SWTNJUA.js +0 -33
- package/dist-cli/chunks/chunk-BRHZEZKN.js +0 -124
- package/dist-cli/chunks/chunk-EJPYPJWP.js +0 -5
- package/dist-cli/chunks/chunk-KWCD5MOK.js +0 -15
- package/dist-cli/chunks/chunk-MJ7QGY7Z.js +0 -4
- package/dist-cli/chunks/chunk-RSA4XWHN.js +0 -5
- package/dist-cli/chunks/chunk-S3EIOAWZ.js +0 -74
- package/dist-cli/chunks/chunk-TYANJQLO.js +0 -30
- package/dist-cli/chunks/cli-version-NZUSWKZR.js +0 -4
- package/dist-cli/chunks/daemon-XUEC47EC.js +0 -4
- package/dist-cli/chunks/desktop-LLHMP4A3.js +0 -31
- package/dist-cli/chunks/detox-QLNWLXA4.js +0 -52
- package/dist-cli/chunks/drivers-7IU37M2E.js +0 -4
- package/dist-cli/chunks/flow-NZZLR4BN.js +0 -4
- package/dist-cli/chunks/help-D7URIJRD.js +0 -4
- package/dist-cli/chunks/inspect-TJYWKY56.js +0 -4
- package/dist-cli/chunks/install-desktop-LD3W5RS7.js +0 -4
- package/dist-cli/chunks/mode-ZQ6H7KWM.js +0 -26
- package/dist-cli/chunks/permissions-DRZ3HCFL.js +0 -13
- package/dist-cli/chunks/record-J5JAYW4Y.js +0 -72
- package/dist-cli/chunks/reset-KXYRDEFU.js +0 -4
- package/dist-cli/chunks/runtime-66CEPOG6.js +0 -4
- package/dist-cli/chunks/setup-QO5KZAX3.js +0 -32
- package/dist-cli/chunks/storage-X2K2MDPX.js +0 -37
- package/dist-cli/chunks/store-TUJPIRTT.js +0 -4
- package/dist-cli/chunks/telemetry-CF5DVEKI.js +0 -4
- package/dist-cli/chunks/upload-UIQJIBEZ.js +0 -4
- package/dist-cli/chunks/version-CMBB3FXL.js +0 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.337 | (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 ne,b as se,g as ie}from"./chunk-
|
|
5
|
-
|
|
4
|
+
import{a as ne,b as se,g as ie}from"./chunk-4HESY5E7.js";import{a as v}from"./chunk-5LJNNHZH.js";import"./chunk-OCPWXT73.js";import"./chunk-EDWN2HOO.js";import"./chunk-HPJ5EKIZ.js";import{a as ee}from"./chunk-7Q4QKHMA.js";import{a as te}from"./chunk-5QXGSTYI.js";import"./chunk-XIQFYLWD.js";import"./chunk-CPDEUWL5.js";import"./chunk-5ZEFRPCC.js";import"./chunk-HAHJJJUC.js";import"./chunk-KGQAO25M.js";import"./chunk-WRID5SBV.js";import"./chunk-WUYI3XJ5.js";import"./chunk-2ANFH72P.js";import{a as re,b as oe}from"./chunk-5SHAOQHJ.js";import"./chunk-LZAL3DMP.js";import"./chunk-X7MHCEGG.js";import"./chunk-LXYLCETR.js";import"./chunk-DQQ4CZVC.js";import"./chunk-M4LGUVBM.js";import{r as Z,s as Q}from"./chunk-M43UU7UG.js";import"./chunk-7ATIH7OU.js";import"./chunk-4VJEXQGD.js";import"./chunk-L6UUIQE7.js";import"./chunk-NCG6C5AH.js";import"./chunk-J6BYRRZQ.js";import"./chunk-GEAGFYKP.js";import"./chunk-EWVG4A3B.js";import"./chunk-RKY3ZNTA.js";import"./chunk-BSSVLFZR.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as R}from"./chunk-GGNH44PZ.js";import{q as A,r as K,s as B,t as X,u as J,v as M,w as $}from"./chunk-F3NKCQHM.js";import"./chunk-TJTLXG3R.js";import"./chunk-TNI4PW75.js";import"./chunk-4FRSEZ7Z.js";import"./chunk-UWEDNDND.js";import"./chunk-ABK2V2PR.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let r=Le(e);(r.includes("--help")||r.includes("-h"))&&(console.log(`
|
|
5
|
+
rnx screenshot \u2014 capture the canvas as a PNG
|
|
6
6
|
|
|
7
7
|
usage:
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
rnx screenshot [output] [options]
|
|
9
|
+
rnx screenshot [options] --output <path>
|
|
10
10
|
|
|
11
11
|
options:
|
|
12
12
|
--output <path> output file path (default: /tmp/sootsim-inspect.png)
|
|
@@ -26,20 +26,20 @@ options:
|
|
|
26
26
|
--themes capture light and dark variants
|
|
27
27
|
|
|
28
28
|
examples:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`),process.exit(0));let i=Ue(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 `
|
|
29
|
+
rnx screenshot
|
|
30
|
+
rnx screenshot --no-shell --output app.png
|
|
31
|
+
rnx screenshot --with-frame --output framed.png
|
|
32
|
+
rnx screenshot --area 0,200,393,400 --output hero.png
|
|
33
|
+
rnx screenshot --id loginButton --output button.png
|
|
34
|
+
`),process.exit(0));let i=Ue(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"),process.exit(1)}let o=r.includes("--gallery"),s=r.includes("--themes"),n=r.includes("--allow-loading"),a=ze(r),l=_e(r);if(o||s)return a&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),le(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"),process.exit(1));let c=A(r,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading"],stripValueFlags:["--output","--area","--id","--text"]}),u=he(r),d=await Be(r);if(await Ae(c.wsPort)){try{await Oe(c,u,d,a,l,n)}catch(h){console.error(` screenshot failed: ${h instanceof Error?h.message:String(h)}`),process.exit(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"),process.exit(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"),process.exit(1)),await le(r,t)}async function Ae(e){let t=K(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Be(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 Oe(e,t,r,i,o,s){let n=B({...e,commandTimeoutMs:45e3});try{if((await X(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
|
-
have repainted yet. focus the tab manually or \`
|
|
36
|
+
have repainted yet. focus the tab manually or \`rnx --sim <id>\`
|
|
37
37
|
to target a visible sim before capturing.
|
|
38
38
|
|
|
39
39
|
`),!s){let f=Number(process.env.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,x=await Q(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 (${Z(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:ee(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 `
|
|
42
|
+
`);else if(!x.ready)throw new Error(`app not ready to capture after ${Math.round(x.elapsedMs/1e3)}s (${Z(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:ee(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=de(process.cwd(),t||"/tmp/sootsim-inspect.png");ce(ue(p),{recursive:!0});let y=Buffer.from(w,"base64");if(i){let f=await Te(n);if(!f)throw new Error("could not read current device model from the target sim");let x=await ne(y,f);ae(p,x),console.log(` frame: ${f}`)}else ae(p,y);console.log(` saved: ${p}`)}finally{n.close()}}async function Te(e){let t=await M(e,"SootSim.bridges.settings.get")??{deviceModel:null},r=typeof t.deviceModel=="string"?t.deviceModel:null;return!r||!(r in F)?null:r}function ze(e){let t=!1;for(let r of e)r==="--with-frame"&&(t=!0),r==="--no-frame"&&(t=!1);return t}function _e(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var je=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading","--gallery","--themes"]),me=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),Ie={"--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 Le(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 Ue(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){if(me.has(i)){r++;continue}je.has(i)||t.push({flag:i,suggestion:Ie[i]})}}return t}function he(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("-")){me.has(i)&&r++;continue}return i}}async function le(e,t){let r=he(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 v(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=de(process.cwd(),r);ce(ue(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 V,readFileSync as et,writeFileSync as Me}from"fs";import{tmpdir as tr}from"os";import z from"path";import{mkdirSync as ge,readFileSync as He,writeFileSync as we}from"fs";import H from"path";function fe(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 Y(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function Ye(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 O(e,t){let r=Ye(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 Ge(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 We(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${O(t,.46)} 0%, ${O(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function G(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 ye(...e){let t=e.map(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function W(e){let t=O(e.color,e.opacity),r=O(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) drop-shadow(0 0 ${e.blur}px ${t})`}function q(e,t){return!t.glow||e.color&&e.color!==P.color?e:{...e,color:t.glow}}function qe(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=q(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:${G(d)}`,`filter:${W(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=q(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${c}px`,"transform-origin:center center",`transform:${ye("translateX(-50%)",G(d))}`,`filter:${W(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=q(o.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+l}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${ye("translateX(-50%)",G(c))}`,`filter:${W(u)}`,"z-index:2"].join(";")}}}function Ve({canvas:e,compose:t,slide:r,imageDataUrl:i}){let o=r.background??t.background,s=qe(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}">${Y(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}">${Y(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};">${Y(r.eyebrow)}</div></div>`:"";return`<!doctype html>
|
|
43
43
|
<html>
|
|
44
44
|
<head>
|
|
45
45
|
<meta charset="utf-8" />
|
|
@@ -90,10 +90,10 @@ examples:
|
|
|
90
90
|
</div>
|
|
91
91
|
</body>
|
|
92
92
|
</html>`}async function be(e,t,r){let i=[],o=r??await(async()=>{let{chromium:n}=await import("playwright");return v(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,${He(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(Ve({canvas:u,compose:e,slide:a.slide,imageDataUrl:c}),{waitUntil:"load"}),await d.waitForTimeout(20);let m=H.join(e.outDir,u.name,e.locale);ge(m,{recursive:!0});let h=H.join(m,`${a.slide.assetKey}.png`),w=await d.screenshot({type:"png",clip:{x:0,y:0,width:u.width,height:u.height}});we(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()}ge(e.outDir,{recursive:!0});let s=H.join(e.outDir,"manifest.json");return we(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 N(e){return typeof e=="string"&&e.length>0?e:void 0}async function Se(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:N(l.title),subtitle:N(l.subtitle),bgTop:N(l.bgTop),bgBottom:N(l.bgBottom),titleColor:N(l.titleColor)}}):null}function xe(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:I(o.bgTop)},{offset:1,color:I(o.bgBottom)}]};r.background=s}})}import{readFileSync as Ke}from"fs";import k from"path";function g(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function T(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 Pe(e,t){return typeof e=="boolean"?e:t}function C(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function $e(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(F,e)?e:null}function ke(e,t){if(typeof e=="string"){let o=R(e);if(!o)throw new Error(`unknown background preset: ${e}`);return o}if(!g(e))return U(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=C(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:C(e.direction,t.direction??180),glow:S(e.glow)??t.glow,stops:i.length>0?i:t.stops?.map(o=>({...o}))??[]}}function Xe(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=L(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 Je(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function Ze(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function ve(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function D(e,t){return k.isAbsolute(t)?t:k.resolve(e,t)}function Qe(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=T(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=fe(n||s);return{id:n||a,assetKey:a,screenshot:s,headline:b(o.headline),subheadline:b(o.subheadline),eyebrow:b(o.eyebrow),pose:ve(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?ke(o.theme??o.background,t):void 0}})}function Ce(e){let t=k.resolve(e),r=k.dirname(t),i=te.parse(Ke(t,"utf8")),o=T(i,"screenshots plan"),s=T(o.capture??{},"capture"),n=T(o.compose??{},"compose"),a=typeof o.app=="number"?String(o.app):S(o.app),l=$e(o.device,null),c=D(r,b(s.out,k.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=Ze(s.pathMode),w=ke(n.background??"cyan",R("cyan")),p={show:Pe(n.frame&&g(n.frame)?n.frame.show:void 0,!0),style:$e(n.frame&&g(n.frame)?n.frame.style:null,null)||l||j,pose:ve(n.frame&&g(n.frame)?n.frame.pose:void 0)||"straight",scale:C(n.frame&&g(n.frame)?n.frame.scale:void 0,1),offsetY:C(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,P.color),blur:C(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.blur:void 0,P.blur),spread:C(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.spread:void 0,P.spread),opacity:C(n.frame&&g(n.frame)&&g(n.frame.shadow)?n.frame.shadow.opacity:void 0,P.opacity)}};return{planPath:t,planDir:r,appTarget:a,deviceModel:l,capture:{flowPath:d?D(r,d):null,fromDir:u?D(r,u):null,outDir:c,rawDir:u?D(r,u):k.join(c,"raw"),framedDir:k.join(c,"framed"),mode:m,pathMode:h,simId:S(s.sim),openInNewSim:Pe(s.new,!1)},compose:{outDir:D(r,b(n.out,k.join(".sootsim","screenshots","exports"))),locale:b(n.locale,"en"),canvases:Xe(n.canvases),frame:p,background:w,text:{preset:Je(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:Qe(n.slides,w)}}}function tt(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function rt(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let r=[e.capture.flowPath],i=tt(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 _(e,t){return z.isAbsolute(t)?t:z.join(e.capture.rawDir,t)}function ot(e){return z.join(e.capture.outDir,"manifest.json")}async function nt(e,t){if(!e.capture.flowPath)return;V(e.capture.rawDir,{recursive:!0});let r=rt(e,t),i=await ie(r);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function st(e,t){let r=new Map;V(e.capture.framedDir,{recursive:!0});let i=t??await(async()=>{let{chromium:o}=await import("playwright");return v(s=>o.launch(s),{headless:!0})})();try{let o=await se(i);try{for(let s of e.compose.slides){let n=_(e,s.screenshot),a=et(n),l=await o.compose(a,e.compose.frame.style),c=z.join(e.capture.framedDir,`${s.assetKey}.png`);Me(c,l),r.set(s.id,c)}}finally{await o.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return r}function it(e,t,r){let i=[],o=[];V(e.capture.outDir,{recursive:!0});let s=ot(e),n=e.compose.slides.map(a=>{let l=_(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 Me(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 at(e,t){return e.compose.slides.map(r=>({slide:r,imagePath:e.compose.frame.show===!0?t.get(r.id)??_(e,r.screenshot):_(e,r.screenshot)}))}async function Ne(e,t={}){let r=Ce(e);t.orgDeckFrames&&t.orgDeckFrames.length>0&&xe(r,t.orgDeckFrames);let i=t.deviceModel??r.deviceModel;t.composeOnly||await nt(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 v(l=>a.launch(l),{headless:!0})})():null;try{let a=o?await st(r,n??void 0):new Map,l=it(r,a,i);if(t.captureOnly)return{plan:r,capture:l,compose:null};let c=at(r,a),u=await be(r.compose,c,n??void 0);return{plan:r,capture:l,compose:u}}finally{n&&typeof n.close=="function"&&await n.close()}}async function De(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:
|
|
96
|
-
|
|
96
|
+
rnx screenshot appstore --plan <plan.yaml> [options]
|
|
97
97
|
|
|
98
98
|
options:
|
|
99
99
|
--plan <path> screenshot plan yaml
|
|
@@ -108,22 +108,22 @@ options:
|
|
|
108
108
|
--compose-only skip flow capture, reuse existing raw screenshots
|
|
109
109
|
|
|
110
110
|
examples:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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=re();if(!p)return console.error(" error: --org/--repo needs auth \u2014 run `
|
|
115
|
-
|
|
111
|
+
rnx screenshot appstore --plan app-store.yaml
|
|
112
|
+
rnx screenshot appstore --plan app-store.yaml --sim a9
|
|
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=re();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 Se({org:c,repo:u,origin:y,authHeader:oe(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 Ne(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 lt,writeFileSync as ct}from"node:fs";import{dirname as ut,isAbsolute as dt,join as Ee,resolve as pt}from"node:path";var mt=`
|
|
115
|
+
rnx screenshot slides \u2014 compose App Store screenshots in the live sim
|
|
116
116
|
|
|
117
117
|
usage:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
rnx screenshot slides list slides (alias: slides list)
|
|
119
|
+
rnx screenshot slides set <n> [fields] patch a slide's copy/colors
|
|
120
|
+
rnx screenshot slides add append a blank slide (focuses it)
|
|
121
|
+
rnx screenshot slides remove <n> delete a slide
|
|
122
|
+
rnx screenshot slides move <n> <position> reorder a slide
|
|
123
|
+
rnx screenshot slides focus <n> open a slide (device flips into it)
|
|
124
|
+
rnx screenshot slides overview back to the gallery
|
|
125
|
+
rnx screenshot slides capture [<n>] capture the live frame into a slide
|
|
126
|
+
rnx screenshot slides export [<n>] [--out <dir>]
|
|
127
127
|
write composed App-Store PNG(s)
|
|
128
128
|
|
|
129
129
|
set fields:
|
|
@@ -139,12 +139,12 @@ set fields:
|
|
|
139
139
|
notes:
|
|
140
140
|
slides are addressed by 1-based index. screenshot mode is auto-enabled.
|
|
141
141
|
capture shoots whatever the sim currently shows \u2014 navigate the app first
|
|
142
|
-
(
|
|
142
|
+
(rnx do tap-id \u2026), then capture.
|
|
143
143
|
|
|
144
144
|
examples:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
rnx screenshot slides set 1 --title "The ultimate MMA community." --bg-top cyan --bg-bottom black
|
|
146
|
+
rnx screenshot slides capture 1
|
|
147
|
+
rnx screenshot slides export --out ./exports
|
|
148
148
|
`,ht={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function ft(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=ht[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 gt(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function wt(e){if(!await J(e,`(async () => {
|
|
149
149
|
if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
|
|
150
150
|
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
@@ -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 yt(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 bt(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 Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage:
|
|
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 yt(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 bt(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 Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(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 $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnx screenshot slides remove <n>");u(await $(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 $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnx screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(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 M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(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 St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Re(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){St.has(r)&&t++;continue}return xt.has(r)?{name:r,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(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 xr(e,t){let r=Re(e);if(!r||r.name==="capture"){await pe(r?E(e,r.index):e,t);return}if(r.name==="slides"){await Fe(E(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-4G42AHOX.js");await s(E(e,r.index),t);return}let i=E(e,r.index),o=Re(i);if(o?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-HMQ2OO3I.js");return await s(Pt(E(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 De(i,t)}export{xr as runScreenshotCommand};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.337 | (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 S}from"./chunk-
|
|
4
|
+
import{a as S}from"./chunk-7Q4QKHMA.js";import"./chunk-5ZEFRPCC.js";import"./chunk-DQQ4CZVC.js";import{r as b,s as I}from"./chunk-M43UU7UG.js";import"./chunk-BSSVLFZR.js";import{b as m}from"./chunk-GGNH44PZ.js";import{q as y,s as v,v as w}from"./chunk-F3NKCQHM.js";import"./chunk-TJTLXG3R.js";import"./chunk-4FRSEZ7Z.js";import"./chunk-ABK2V2PR.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
|
|
5
5
|
sootsim screenshot layers \u2014 export a screen as engine-isolated layers
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.337 | (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{b as U}from"./chunk-
|
|
5
|
-
|
|
4
|
+
import{b as U}from"./chunk-5LJNNHZH.js";import{a as M}from"./chunk-5SHAOQHJ.js";import"./chunk-J6BYRRZQ.js";import"./chunk-4FRSEZ7Z.js";import{a as F}from"./chunk-UWEDNDND.js";import"./chunk-ABK2V2PR.js";import{execSync as N}from"node:child_process";import{mkdirSync as O,mkdtempSync as E,rmSync as j,writeFileSync as G}from"node:fs";import{tmpdir as q}from"node:os";import{dirname as B,isAbsolute as L,join as I,resolve as z}from"node:path";import{chromium as W}from"playwright-core";var H=`
|
|
5
|
+
rnx screenshot appstore capture \u2014 headlessly capture + upload App Store slides
|
|
6
6
|
|
|
7
7
|
usage:
|
|
8
|
-
|
|
8
|
+
rnx screenshot appstore capture --org <org> --repo <repo> [options]
|
|
9
9
|
|
|
10
10
|
what it does:
|
|
11
11
|
boots the org-mode build shell in headless GPU Chrome (authed via your
|
|
12
|
-
\`
|
|
12
|
+
\`rnx login\` session), captures each slide through the live screenshot
|
|
13
13
|
composer so every slide gets editable layers (captureRef + cleanRef +
|
|
14
14
|
screenRef), and lets the shell auto-upload them to your org deck.
|
|
15
15
|
|
|
@@ -28,15 +28,15 @@ options:
|
|
|
28
28
|
--json machine-readable summary
|
|
29
29
|
|
|
30
30
|
examples:
|
|
31
|
-
|
|
32
|
-
|
|
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
33
|
`;function J(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 Y(){let t=M();if(t&&t.kind==="session")return{token:t.token,origin:t.origin};process.stderr.write(`
|
|
34
|
-
|
|
35
|
-
run \`
|
|
34
|
+
rnx screenshot appstore capture needs a logged-in session.
|
|
35
|
+
run \`rnx login\` first (the captured slides upload to that account).
|
|
36
36
|
|
|
37
37
|
`),process.exit(1)}function K(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();return e==="localhost"||e.endsWith(".localhost")||e==="::1"||/^127(?:\.\d{1,3}){3}$/.test(e)}function Q(t){let e=new URL(t);if(K(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 V(){try{return Number(N("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function X(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 Z(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 _(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 T(t){return t.evaluate(async()=>{let n=globalThis.SootSim?.bridges?.screenshotControl;if(!n)throw new Error("screenshotControl missing");return n.getState()})}async function ee(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 te(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 ge(t){if(t.includes("--help")||t.includes("-h"))return console.log(H),0;let e=J(t);if(!e.org||!e.repo)return process.stderr.write(` --org and --repo are required (see --help)
|
|
38
38
|
`),1;let{token:n,origin:s}=Y(),i=(e.apiOrigin??s).replace(/\/$/,""),a=(e.shellOrigin??Q(i)).replace(/\/$/,""),d=await X(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
39
|
`),1;let g=V(),h=Number(N("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=E(I(q(),"sootsim-capture-")),{browser:u,reapNow:c}=await U(o=>W.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=[],
|
|
41
|
-
`),1;let $=e.slides?
|
|
40
|
+
`),1;let w=`${a}/build/${encodeURIComponent(e.org)}/${encodeURIComponent(e.repo)}/${encodeURIComponent(e.branch)}?platform=${encodeURIComponent(e.platform)}&ssMode=1`,b=E(I(q(),"sootsim-capture-")),{browser:u,reapNow:c}=await U(o=>W.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 A=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 _(m,e.timeoutMs);await ee(o),await A,await m.waitForTimeout(800);let p=await T(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 Z(i,n,e.org,l.screenRef):null;await te(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 T(o)).slides.filter(r=>$.some(l=>l.id===r.id)),v=[];if(e.out){let r=L(e.out)?e.out:z(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=I(r,f.name);O(B(k),{recursive:!0}),G(k,Buffer.from(C[1],"base64")),v.push(k)}}}let P=S.filter(r=>r.captureRef&&r.cleanRef),D={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(D,null,2));else{console.log(`
|
|
42
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(),j(b,{recursive:!0,force:!0})}}export{ge as runScreenshotsCapture};
|