rnxsim 0.1.334 → 0.1.336
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-XB27DMQ6.js → agent-PZLF36FY.js} +14 -14
- package/dist-cli/chunks/{agent-wrapper-B3HNORTW.js → agent-wrapper-6TA43SJ2.js} +3 -3
- package/dist-cli/chunks/app-fonts-MTZTCJUY.js +4 -0
- package/dist-cli/chunks/{assert-6CUEOSSO.js → assert-2CVO2TYX.js} +12 -12
- package/dist-cli/chunks/auth-LKXFRFOT.js +12 -0
- package/dist-cli/chunks/{beta-H5SAI4RD.js → beta-OATC5IPA.js} +2 -2
- package/dist-cli/chunks/camera-VX65VO5N.js +33 -0
- package/dist-cli/chunks/{chunk-R3JUSXCG.js → chunk-262YA5CJ.js} +2 -2
- package/dist-cli/chunks/{chunk-2W7J4B3D.js → chunk-2J4OBR7W.js} +18 -18
- package/dist-cli/chunks/{chunk-GO7WTRY4.js → chunk-2PFDFGOG.js} +1 -1
- package/dist-cli/chunks/{chunk-BH3NYOFU.js → chunk-2Q6S7X5O.js} +4 -4
- package/dist-cli/chunks/{chunk-JZFZ7NGF.js → chunk-2VOFUIKQ.js} +9 -9
- package/dist-cli/chunks/chunk-3QCSDI3B.js +5 -0
- package/dist-cli/chunks/{chunk-IZITFEO5.js → chunk-4532OPNZ.js} +3 -3
- package/dist-cli/chunks/{chunk-S5Q2TACY.js → chunk-5YCVNKD7.js} +23 -23
- package/dist-cli/chunks/{chunk-R5KHC7VZ.js → chunk-6ALTVOXE.js} +6 -6
- package/dist-cli/chunks/chunk-6TN3YWA6.js +124 -0
- package/dist-cli/chunks/{chunk-KSJTW5ZW.js → chunk-7FHAHI5V.js} +2 -2
- package/dist-cli/chunks/{chunk-TKTAVBKB.js → chunk-7PMNRG53.js} +4 -4
- package/dist-cli/chunks/{chunk-752UYKC6.js → chunk-ARFQOYRO.js} +1 -1
- package/dist-cli/chunks/chunk-BHXQ7MUW.js +5 -0
- package/dist-cli/chunks/{chunk-HMZS7LD4.js → chunk-BIZE6NBI.js} +1 -1
- package/dist-cli/chunks/{chunk-INV6BZQY.js → chunk-BOZARB6P.js} +2 -2
- package/dist-cli/chunks/chunk-BVGUTE2T.js +74 -0
- package/dist-cli/chunks/{chunk-K2NYE3XT.js → chunk-BYOFHYKS.js} +1 -1
- package/dist-cli/chunks/{chunk-TLAYQHXB.js → chunk-DMD24WAG.js} +1 -1
- package/dist-cli/chunks/{chunk-PSVQUW3M.js → chunk-EAPHUH2R.js} +2 -2
- package/dist-cli/chunks/{chunk-ELFSL6AX.js → chunk-FMWEQNK2.js} +2 -2
- package/dist-cli/chunks/{chunk-OJJUPWLY.js → chunk-FWGDP2J4.js} +2 -2
- package/dist-cli/chunks/{chunk-VCBH7RDB.js → chunk-G3FVXFPF.js} +2 -2
- package/dist-cli/chunks/{chunk-U5JW25P3.js → chunk-GI3GZ54J.js} +1 -1
- package/dist-cli/chunks/{chunk-AH7KCTAP.js → chunk-HDHHEWEA.js} +2 -2
- package/dist-cli/chunks/{chunk-G2UNJ4TN.js → chunk-JIWE66VU.js} +1 -1
- package/dist-cli/chunks/{chunk-7HXPSUI6.js → chunk-KDRDDPNN.js} +1 -1
- package/dist-cli/chunks/{chunk-ANO5CHPQ.js → chunk-KPL344LX.js} +2 -2
- package/dist-cli/chunks/{chunk-3OGSYYLZ.js → chunk-M2OWBYUG.js} +1 -1
- package/dist-cli/chunks/{chunk-7D2P57SZ.js → chunk-M2XGXP7G.js} +1 -1
- package/dist-cli/chunks/{chunk-KV653SVK.js → chunk-MARPC3GM.js} +2 -2
- package/dist-cli/chunks/{chunk-ZYWOBHVL.js → chunk-MQES3MTN.js} +2 -2
- package/dist-cli/chunks/{chunk-ZVBWTXV6.js → chunk-NDLRQH7U.js} +5 -5
- package/dist-cli/chunks/{chunk-DECDURI3.js → chunk-NJMBQLAU.js} +2 -2
- package/dist-cli/chunks/{chunk-X6LGVNYE.js → chunk-NL2HXO7U.js} +1 -1
- package/dist-cli/chunks/{chunk-XCI6HRMH.js → chunk-NVPZLIMW.js} +1 -1
- package/dist-cli/chunks/{chunk-CYXIDSTO.js → chunk-NWVH2X7F.js} +2 -2
- package/dist-cli/chunks/{chunk-PFOKFWHU.js → chunk-OUAYBJ4G.js} +2 -2
- package/dist-cli/chunks/{chunk-WJJYIBVW.js → chunk-OXRDTNVL.js} +2 -2
- package/dist-cli/chunks/{chunk-Q2KHHFU3.js → chunk-QIVOOERS.js} +2 -2
- package/dist-cli/chunks/{chunk-WXUWD5JK.js → chunk-RZ2PXHA7.js} +11 -11
- package/dist-cli/chunks/{chunk-32AHRTE2.js → chunk-S33NCWJV.js} +2 -2
- package/dist-cli/chunks/{chunk-YX7RESF2.js → chunk-STMCT3G3.js} +2 -2
- package/dist-cli/chunks/{chunk-25BPBDWK.js → chunk-SV6NVD7P.js} +1 -1
- package/dist-cli/chunks/{chunk-62GN45A4.js → chunk-TA4GBBGC.js} +2 -2
- package/dist-cli/chunks/{chunk-MCX66YUZ.js → chunk-TV457FWW.js} +2 -2
- package/dist-cli/chunks/chunk-UB3JHBDW.js +4 -0
- package/dist-cli/chunks/{chunk-CLJ5KDZQ.js → chunk-UU2KMAIA.js} +1 -1
- package/dist-cli/chunks/chunk-UZCNKUSS.js +15 -0
- package/dist-cli/chunks/{chunk-R7XQX7CV.js → chunk-V4OZDPTA.js} +1 -1
- package/dist-cli/chunks/{chunk-UBZ7VUVM.js → chunk-WBTT5WIO.js} +1 -1
- package/dist-cli/chunks/chunk-YYBC6VB2.js +30 -0
- package/dist-cli/chunks/{chunk-PPTUVZET.js → chunk-ZI6YQKD6.js} +2 -2
- package/dist-cli/chunks/{cleanup-L5RZFZHK.js → cleanup-ZC5OVBIM.js} +10 -10
- package/dist-cli/chunks/cli-version-NOYHDN6P.js +4 -0
- package/dist-cli/chunks/{compat-6UV3RZBK.js → compat-BS2E7XDD.js} +9 -9
- package/dist-cli/chunks/{config-PCDG3T44.js → config-VDCDUYMZ.js} +5 -5
- package/dist-cli/chunks/{control-3F5UWGSP.js → control-IKS3CUP4.js} +2 -2
- package/dist-cli/chunks/daemon-MM3C4O2B.js +4 -0
- package/dist-cli/chunks/{debug-U3AW3DE7.js → debug-BKMZ5SRR.js} +17 -17
- package/dist-cli/chunks/desktop-FZQHSNF7.js +31 -0
- package/dist-cli/chunks/detox-52AM3DKY.js +52 -0
- package/dist-cli/chunks/{device-Z7QIRPK3.js → device-7FL5Y542.js} +11 -11
- package/dist-cli/chunks/{diagnose-XTLKRGK4.js → diagnose-YT4BKJ7I.js} +12 -12
- package/dist-cli/chunks/{disk-cleanup-EGA7FHY2.js → disk-cleanup-O6ICYLAC.js} +2 -2
- package/dist-cli/chunks/drivers-YY3YRD2L.js +4 -0
- package/dist-cli/chunks/{film-VCD3LX7E.js → film-7YBOFSOZ.js} +9 -9
- package/dist-cli/chunks/flow-I4PVS52A.js +4 -0
- package/dist-cli/chunks/help-35ESSWJH.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-WIG4O25J.js → hidden-runtime-alias-M3UFKZB6.js} +2 -2
- package/dist-cli/chunks/{home-paths-35K3WNLQ.js → home-paths-VW7G7LVZ.js} +2 -2
- package/dist-cli/chunks/inspect-PCJ6C2BN.js +4 -0
- package/dist-cli/chunks/install-desktop-NGQWMGQO.js +4 -0
- package/dist-cli/chunks/{login-JMQOKJS4.js → login-5VAHTGHC.js} +6 -6
- package/dist-cli/chunks/{logout-SBZ42HSW.js → logout-CXZFNMYF.js} +2 -2
- package/dist-cli/chunks/{maestro-3ZOPLMLN.js → maestro-THMBR6L3.js} +25 -25
- package/dist-cli/chunks/{maestro-generate-UZ75KHE6.js → maestro-generate-R73J53KE.js} +3 -3
- package/dist-cli/chunks/mode-5RJYFW76.js +26 -0
- package/dist-cli/chunks/{optional-demo-registry-B5RN64RF.js → optional-demo-registry-U7SCVX5U.js} +2 -2
- package/dist-cli/chunks/{perf-HDAR6QCJ.js → perf-AW6LG6FW.js} +28 -28
- package/dist-cli/chunks/permissions-6JWNMXYT.js +13 -0
- package/dist-cli/chunks/record-LLPM3BJT.js +72 -0
- package/dist-cli/chunks/{report-issue-45ECETI7.js → report-issue-YO2NAMJS.js} +4 -4
- package/dist-cli/chunks/reset-5LDPRL3W.js +4 -0
- package/dist-cli/chunks/runtime-IAICY2UL.js +4 -0
- package/dist-cli/chunks/{screenshot-command-ZTTTH5DS.js → screenshot-command-X7ECU2SK.js} +34 -34
- package/dist-cli/chunks/{screenshot-layers-NBYY3W7W.js → screenshot-layers-E7GLIOHG.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-EPPIKH5Q.js → screenshots-capture-TKR2YV6U.js} +11 -11
- package/dist-cli/chunks/{serve-4I2GY23Q.js → serve-HFNYO3YS.js} +16 -16
- package/dist-cli/chunks/setup-2HQHROP3.js +32 -0
- package/dist-cli/chunks/{skills-FBQ52ZMO.js → skills-PFCCKOPW.js} +16 -16
- package/dist-cli/chunks/{state-LQEZWXEX.js → state-NOCC6IGB.js} +5 -5
- package/dist-cli/chunks/storage-4SYN4ZWP.js +37 -0
- package/dist-cli/chunks/store-7QDSVAZ4.js +4 -0
- package/dist-cli/chunks/telemetry-LGTXJEJC.js +4 -0
- package/dist-cli/chunks/{timeline-3AIKN2SF.js → timeline-E2SFUV76.js} +6 -6
- package/dist-cli/chunks/{upgrade-HYPCBXGF.js → upgrade-KD76JQCK.js} +2 -2
- package/dist-cli/chunks/upload-FI2TS5S7.js +4 -0
- package/dist-cli/chunks/version-B23A4BFH.js +6 -0
- package/dist-cli/chunks/{web-Q6TI7YFH.js → web-6OAWYV5Z.js} +2 -2
- package/dist-cli/chunks/{what-happened-4PNRFBVS.js → what-happened-IYXUFM72.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-R3Z7ZW4A.js +0 -4
- package/dist-cli/chunks/auth-LAGALWLO.js +0 -12
- package/dist-cli/chunks/camera-QN6WUAYK.js +0 -33
- package/dist-cli/chunks/chunk-2A4XQAO5.js +0 -5
- package/dist-cli/chunks/chunk-CFRBWE4I.js +0 -124
- package/dist-cli/chunks/chunk-FSS73GUP.js +0 -4
- package/dist-cli/chunks/chunk-KKLCABLJ.js +0 -15
- package/dist-cli/chunks/chunk-L4JC72JR.js +0 -5
- package/dist-cli/chunks/chunk-LGO27KAL.js +0 -30
- package/dist-cli/chunks/chunk-ZS3IA2TO.js +0 -74
- package/dist-cli/chunks/cli-version-YLZLS2WD.js +0 -4
- package/dist-cli/chunks/daemon-7KWRXNTD.js +0 -4
- package/dist-cli/chunks/desktop-NXZL7FFL.js +0 -31
- package/dist-cli/chunks/detox-ZVCZR6RI.js +0 -52
- package/dist-cli/chunks/drivers-NCRG3DPA.js +0 -4
- package/dist-cli/chunks/flow-XTAZ54NO.js +0 -4
- package/dist-cli/chunks/help-HXJS23VT.js +0 -4
- package/dist-cli/chunks/inspect-FGQNWT3J.js +0 -4
- package/dist-cli/chunks/install-desktop-PRZH7KML.js +0 -4
- package/dist-cli/chunks/mode-PUJBFJV2.js +0 -26
- package/dist-cli/chunks/permissions-FG2BLOZH.js +0 -13
- package/dist-cli/chunks/record-2733FYSQ.js +0 -72
- package/dist-cli/chunks/reset-7RTBJQT7.js +0 -4
- package/dist-cli/chunks/runtime-FWAZCY6A.js +0 -4
- package/dist-cli/chunks/setup-FAQDSB56.js +0 -32
- package/dist-cli/chunks/storage-6CRLZNEX.js +0 -37
- package/dist-cli/chunks/store-PNV6NRDU.js +0 -4
- package/dist-cli/chunks/telemetry-ZS6SFANV.js +0 -4
- package/dist-cli/chunks/upload-EMRR47KT.js +0 -4
- package/dist-cli/chunks/version-P4NCNAW7.js +0 -6
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*! rnx v0.1.336 | (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 W}from"./chunk-4532OPNZ.js";import{a as oe}from"./chunk-RZ2PXHA7.js";import{a as Z,c as ee}from"./chunk-OUAYBJ4G.js";import{d as Y}from"./chunk-NJMBQLAU.js";import"./chunk-MARPC3GM.js";import"./chunk-DMD24WAG.js";import"./chunk-NVPZLIMW.js";import"./chunk-MQES3MTN.js";import"./chunk-7FHAHI5V.js";import{e as X,q as v,s as y,t as Q}from"./chunk-6ALTVOXE.js";import"./chunk-ARFQOYRO.js";import"./chunk-V4OZDPTA.js";import"./chunk-QIVOOERS.js";import"./chunk-GI3GZ54J.js";import{existsSync as he,mkdirSync as E,readdirSync as be,readFileSync as ve,rmSync as q,writeFileSync as I}from"fs";import{homedir as ye,tmpdir as Se}from"os";import{dirname as z,extname as re,join as F,resolve as $e}from"path";var J=24e4,Re=9e4,xe=3e4;async function D(e,r,o,i){let t=Math.max(2e4,i+xe);try{return await e.send({type:"evaluate",code:r},{timeoutMs:t})}catch(n){let s=n instanceof Error?n.message:String(n);/^command timed out after \d+s$/.test(s)&&(console.error(` ${o} stalled \u2014 the render host did not finish within ${Math.round(t/1e3)}s; it is likely contended or wedged.
|
|
5
|
+
the capture lock auto-releases, so simply retry the recording.
|
|
6
|
+
if it persists, recover the sim with \`rnx close --sim <id>\`.`),process.exit(1)),/render host not available|already streaming|already recording|lock already held/i.test(s)&&(console.error(` ${o} failed: ${s}
|
|
7
|
+
a prior recording was abandoned and its capture is still
|
|
8
|
+
releasing. the lock self-heals in ~${Math.round((i+2e4)/1e3)}s \u2014 retry then, or recover now with
|
|
9
|
+
\`rnx close --sim <id>\` and reopen the sim.`),process.exit(1)),console.error(` ${o} failed: ${s}`),process.exit(1)}}var _e=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin","--owner","--repo"]),ke=new Set(["start","stop","cancel","status","prelude-start","upload"]);function Oe(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){_e.has(o)&&r++;continue}return ke.has(o)?{name:o,index:r}:null}return null}function te(e){let r=u(e,"--owner")?.trim(),o=u(e,"--repo")?.trim();return(r&&!o||!r&&o)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),r&&o?{owner:r,repo:o}:null}async function He(e,r){let o=Oe(e);if(o){let d=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await Te(d,r);return}if(o.name==="prelude-start"){await Ie(d,r);return}if(o.name==="upload"){let{runUpload:S}=await import("./upload-FI2TS5S7.js");await S(d,r);return}if(o.name==="stop"){await Pe(d,r);return}if(o.name==="cancel"){await Ne(d,r);return}await Ae(d,r);return}let i=v(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open","--lockstep"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin","--owner","--repo"]}),t=se(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let c=u(e,"--output"),a=Number(u(e,"--duration")??"10");(!Number.isFinite(a)||a<=0)&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let l=600;a>l&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 exceeds the ${l}s (10m) maximum`),process.exit(1));let m=Number(u(e,"--fps")??"30"),p=u(e,"--frames");if(p!==void 0){let d=Number(p);(!Number.isInteger(d)||d<=0)&&(console.error(` invalid --frames "${p}" \u2014 expected a positive integer count`),process.exit(1))}let _=e.includes("--open"),k=u(e,"--max-width")?Number(u(e,"--max-width")):void 0;e.includes("--lockstep")&&(console.error(" --lockstep works with `record start` / `record stop` (stateful mode) \u2014 atomic --duration is wall-clock and cannot bound a virtual-time capture"),process.exit(1));let w=Math.max(100,Math.round(a*1e3)),K=u(e,"--origin"),fe=te(e);if(t==="live"||t==="combined"){c&&console.log(` note: --output is ignored for --mode ${t} \u2014 the recording uploads to /preview/<id>`),n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await W("record",{originOverride:K,allowGitHubAuth:!0});let d=y({...i,commandTimeoutMs:6e4});try{await H(d),await de(d,t),t==="combined"&&await B(d),await ce(d,K,fe);let S=await le(d,t,t==="combined"?n:void 0);S.ok||(console.error(` start failed: recording store refused to start (${t})`+(S.error?`: ${S.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(f=>setTimeout(f,w)),await ue(d);let O=await me(d);pe(O,_,t)}finally{d.close()}return}let A=p?Number(p):null,R=Be(s,c,A);_&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let b=y({...i,commandTimeoutMs:6e4});try{if(await ne(b),await B(b),R==="png"){let x=A??10,h=T(c,`sootsim-frames-${C()}`);c&&re(c)&&console.log(` note: --frames writes multiple pngs, so --output "${c}" is a directory \u2014 frame-NNN.png files land inside it`),E(h,{recursive:!0});for(let g of be(h))/^frame-\d+\.png$/.test(g)&&q(F(h,g),{force:!0});console.log(` sampling ${x} frames over ${a}s \u2192 ${h}`);let $=await b.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${x}, durationMs: ${w}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!$.ok||!$.requestId)&&(console.error(` frame capture start failed: ${$.error??"unknown error"}`),process.exit(1)),await new Promise(g=>setTimeout(g,w));let ge=Date.now()+Math.max(5e3,w),N=null;for(;;){let g=await b.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${$.requestId})`});if(g||(console.error(" frame capture result missing"),process.exit(1)),g.done){g.ok||(console.error(` frame capture failed: ${g.error??"unknown error"}`),process.exit(1)),N=g.frames??[];break}Date.now()>=ge&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(P=>setTimeout(P,100))}N.forEach((g,P)=>{let we=`${h}/frame-${String(P+1).padStart(3,"0")}.png`;I(we,Buffer.from(g.data,"base64"))}),console.log(` saved ${N.length} frames`);return}if(R==="gif"){let x=A??Math.max(10,Math.round(a*m/3)),h=T(c,`sootsim-${C()}.gif`);E(z(h),{recursive:!0}),console.log(` encoding gif: ${x} frames over ${a}s \u2192 ${h}`);let $=await D(b,`window.__sootsimRecorder.captureGif({ frames: ${x}, durationMs: ${w}${k?`, maxWidth: ${k}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",w);$||(console.error(" gif capture returned no frames"),process.exit(1)),I(h,Buffer.from($.data,"base64")),console.log(` saved: ${h} (${L($.size)})`);return}let d=T(c,`sootsim-${C()}.${R}`);E(z(d),{recursive:!0});let S={format:R,fps:m,durationMs:w};n&&(S.layers=n);let O=await D(b,`window.__sootsimRecorder.start(${JSON.stringify(S)})`,`${R} start`,w);O.ok||(console.error(` start failed: ${O.error??"unknown error"}`),/render host not available|already streaming|already recording|lock already held/i.test(O.error??"")&&console.error(" a prior recording was abandoned and its capture is still\n releasing. retry in ~20s, or recover now with\n `rnx close --sim <id>` then reopen the sim."),process.exit(1)),console.log(` recording ${R} for ${a}s \u2192 ${d}`),await new Promise(x=>setTimeout(x,w));let f=await D(b,"window.__sootsimRecorder.stop()",`${R} encode/flush`,w);f.ok||(console.error(` stop failed: ${f.error??"unknown error"}`),process.exit(1)),f.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ie(b,d),console.log(` saved: ${d} (${L(f.size)})`),f.durationMs&&f.frameCount!==void 0&&console.log(` source frames: ${f.frameCount} over ${(f.durationMs/1e3).toFixed(2)}s (${(f.frameCount/(f.durationMs/1e3)).toFixed(1)}fps)`)}finally{b.close()}}var Me=6e3;async function V(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:Me})}catch(o){let i=o instanceof Error?o.message:String(o);throw/^command timed out after \d+s$/.test(i)&&(console.error(" sim did not respond \u2014 it is connected to the bridge but has not\n loaded an app (or its page is unresponsive). run `rnx list`\n and target a sim with a loaded app via --sim <id>."),process.exit(1)),o}}async function ne(e){await V(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is rnx engine running in this sim?"),process.exit(1))}async function B(e){let{hidden:r}=await Q(e);r&&(console.error(` refusing to record: the rnx tab is hidden, so frame capture
|
|
10
|
+
would be throttled to ~1fps and produce a frozen-looking file.
|
|
11
|
+
bring the chrome window to the foreground (un-minimize / switch to
|
|
12
|
+
its tab) or run the recording in headless playwright, then retry.`),process.exit(1))}async function ie(e,r){let o=[],i=0;for(;;){let t=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${i}, chunk: 2097152 })`});if(!t)throw new Error("no blob available on recorder");if(o.push(Buffer.from(t.data,"base64")),i=t.offset,t.done)break}I(r,Buffer.concat(o))}function u(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function Ee(e){if(!e)return;let r=re(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function Be(e,r,o){return e||(o!=null?"png":Ee(r)??"webm")}function C(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function Ue(){let e=F(ye(),".sootsim","recordings");return E(e,{recursive:!0}),e}function T(e,r){return e?$e(process.cwd(),e):F(Ue(),r)}function L(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function se(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function G(){return F(Se(),`sootsim-recording-${X()}.json`)}function U(){let e=G();if(!he(e))return null;try{return{mode:"video",...JSON.parse(ve(e,"utf8"))}}catch{return q(e,{force:!0}),null}}function Ce(e){I(G(),JSON.stringify(e,null,2))}function M(){q(G(),{force:!0})}function j(e,r){e&&r.simId&&e!==r.simId&&console.log(` note: the tracked recording session is on sim ${r.simId}, not the
|
|
13
|
+
requested sim ${e}. record state is global (not per-sim);
|
|
14
|
+
this command acts on that session regardless of --sim.`)}async function Te(e,r){let o=U();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`rnx record stop\` first, or \`rnx record cancel\` to discard.`),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--lockstep"],stripValueFlags:["--mode","--fps","--format","--max-width","--origin","--owner","--repo"]}),t=se(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format"),c=s==="mp4"?"mp4":"webm";s&&c!==s&&(console.error(` record start only supports webm or mp4 (got: ${s}). for gif/png use atomic mode: rnx record --format ${s} --duration <s>`),process.exit(1));let a=Number(u(e,"--fps")??"30"),l=te(e),m=y({...i,commandTimeoutMs:t==="live"||t==="combined"?Re:15e3});try{if(t==="live"||t==="combined"){n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await W("record",{originOverride:u(e,"--origin"),allowGitHubAuth:!0}),await H(m),await de(m,t),t==="combined"&&await B(m),await ce(m,u(e,"--origin"),l);let p=await le(m,t,t==="combined"?n:void 0);p.ok||(console.error(` start failed: recording store refused to start (${t})`+(p.error?`: ${p.error}`:"")),process.exit(1))}else{await ne(m),await B(m);let p=e.includes("--lockstep");p&&c!=="mp4"&&(console.error(" --lockstep requires --format mp4 (webm is realtime-clocked)"),process.exit(1));let _={format:c,fps:a};n&&(_.layers=n),p&&(_.lockstep=!0);let k=await m.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(_)})`});k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),process.exit(1))}Ce({simId:i.simId??null,mode:t,format:c,fps:a,layers:n,startedAt:new Date().toISOString()}),console.log(t==="video"?` recording ${c} @ ${a}fps${n?` (${n})`:""} \u2014 run \`rnx record stop --output <path>\` when done`:` recording ${t} \u2014 run \`rnx record stop\` when done (add --open to launch the preview URL)`)}finally{m.close()}}async function Ie(e,r){let o=U();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`rnx record stop\` first, or \`rnx record cancel\` to discard.`),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:[],stripValueFlags:["--origin"]}),t=y({...i,commandTimeoutMs:15e3});try{if(await H(t),await B(t),!await t.send({type:"evaluate",code:`(() => {
|
|
15
|
+
const start = window.SootSim?.bridges?.startRecordingPrelude
|
|
16
|
+
if (typeof start !== 'function') return false
|
|
17
|
+
return Promise.resolve(start()).then((value) => value === true)
|
|
18
|
+
})()`})){let s=await t.send({type:"evaluate",code:`(() => {
|
|
19
|
+
const getError = window.SootSim?.bridges?.getRecordingStartError
|
|
20
|
+
return typeof getError === 'function' ? getError() : null
|
|
21
|
+
})()`}).catch(()=>null);console.error(` prelude start failed: recording store refused to start${typeof s=="string"&&s?` (${s})`:""}`),process.exit(1)}console.log(" recording preview prelude \u2014 run `rnx record start --mode combined` when the visible proof segment is ready")}finally{t.close()}}async function ae(e){try{let r=await e.send({type:"evaluate",code:`(() => {
|
|
22
|
+
const store = window.SootSim?.bridges?.getRecordingState?.();
|
|
23
|
+
const headless = window.__sootsimRecorder?.state?.();
|
|
24
|
+
const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
|
|
25
|
+
const eventRecording =
|
|
26
|
+
typeof eventRecorder?.isRecording === 'function'
|
|
27
|
+
? eventRecorder.isRecording() === true
|
|
28
|
+
: false;
|
|
29
|
+
return { store: store ? store.state : undefined, headless, eventRecording };
|
|
30
|
+
})()`});return r?r.store==="recording"||r.headless==="recording"?"recording":r.store==="processing"?"processing":r.eventRecording?"prelude":r.store==="idle"||r.headless==="idle"?"idle":null:null}catch{return null}}async function Fe(e){let r=await e.send({type:"evaluate",code:`(() => {
|
|
31
|
+
const store = window.SootSim?.bridges?.getRecordingState?.();
|
|
32
|
+
const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
|
|
33
|
+
const hadStoreRecording = store && store.state !== 'idle';
|
|
34
|
+
const hadEventRecording =
|
|
35
|
+
typeof eventRecorder?.isRecording === 'function'
|
|
36
|
+
? eventRecorder.isRecording() === true
|
|
37
|
+
: false;
|
|
38
|
+
const cancel = window.SootSim?.bridges?.cancelRecording;
|
|
39
|
+
if (typeof cancel === 'function') cancel();
|
|
40
|
+
return Boolean(hadStoreRecording || hadEventRecording);
|
|
41
|
+
})()`}).catch(()=>!1),o=await e.send({type:"evaluate",code:`(async () => {
|
|
42
|
+
const r = window.__sootsimRecorder;
|
|
43
|
+
if (r && typeof r.forceRelease === 'function') return await r.forceRelease();
|
|
44
|
+
return false;
|
|
45
|
+
})()`}).catch(()=>!1);return{store:r,headless:o}}async function Ae(e,r){let o=U();if(o){j(v(e,{port:r.port}).simId,o),o.mode==="video"?console.log(` recording ${o.mode} (${o.format} @ ${o.fps}fps) on sim ${o.simId??"?"} since ${o.startedAt}`):console.log(` recording ${o.mode} on sim ${o.simId??"?"} since ${o.startedAt}`);return}let i=v(e,{port:r.port}),t=y({...i,commandTimeoutMs:8e3});try{let n=await ae(t);if(n==="recording"||n==="processing"||n==="prelude"){if(n==="prelude"){console.log(" a recording preview prelude is active. hidden setup is being\n captured for the next live/combined preview recording. finish\n it with `rnx record start --mode combined`, or discard it\n with `rnx record cancel`.");return}console.log(` a recording is in progress (engine state: ${n}), but not via
|
|
46
|
+
\`record start\` \u2014 it was started by an atomic \`record --duration\`
|
|
47
|
+
run or the in-browser record button, which own their own lifecycle.
|
|
48
|
+
if that controlling run is still alive it will finish on its own
|
|
49
|
+
(atomic \`--mode video/gif/png\` writes a local file from that
|
|
50
|
+
process; live/combined upload to /preview/<id>). if the run was
|
|
51
|
+
killed, the recording is abandoned and will NOT finish \u2014 reclaim
|
|
52
|
+
it now with \`rnx record cancel\`, or it auto-reclaims when the
|
|
53
|
+
abandoned capture's deadline lapses.`)}else console.log(" no recording in progress")}finally{t.close()}}async function Ne(e,r){let o=U();if(!o){let s=v(e,{port:r.port}),c=y({...s,commandTimeoutMs:8e3});try{let a=await ae(c);if(a==="recording"||a==="processing"||a==="prelude"){let l=await Fe(c);l.store&&a==="prelude"?console.log(" recording preview prelude cancelled"):l.store||l.headless?console.log(" reclaimed an abandoned recording (started by an atomic\n `record --duration` run or the record button whose owner is\n gone). the recorder is idle again \u2014 live/combined can start."):console.log(" a recording is in progress and still owned by a live atomic\n `record --duration` run or the in-browser record button \u2014 it\n will finish on its own and nothing was reclaimed.")}else console.log(" no recording in progress")}finally{c.close()}return}let i=v(e,{port:r.port});j(i.simId,o);let t=o.simId??i.simId??void 0,n=y({...i,simId:t,commandTimeoutMs:15e3});try{o.mode==="live"||o.mode==="combined"?await n.send({type:"evaluate",code:"void window.SootSim?.bridges?.cancelRecording?.()"}):await n.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"})}catch{}finally{M(),n.close()}console.log(" recording cancelled")}async function Pe(e,r){let o=U();o||(console.error(" no recording in progress. start one with `rnx record start`."),process.exit(1));let i=v(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]});j(i.simId,o);let t=o.simId??i.simId??void 0,n=e.includes("--open"),s=y({...i,simId:t,commandTimeoutMs:o.mode==="live"||o.mode==="combined"?J:6e4});try{if(o.mode==="live"||o.mode==="combined"){await ue(s);let m=await me(s);M(),pe(m,n,o.mode);return}let c=u(e,"--output"),a=T(c,`sootsim-${C()}.${o.format}`);E(z(a),{recursive:!0});let l=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});l.ok||(console.error(` stop failed: ${l.error??"unknown error"}`),M(),process.exit(1)),l.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),M(),process.exit(1)),await ie(s,a),M(),console.log(` saved: ${a} (${L(l.size)})`),l.durationMs&&l.frameCount!==void 0&&console.log(` source frames: ${l.frameCount} over ${(l.durationMs/1e3).toFixed(2)}s (${(l.frameCount/(l.durationMs/1e3)).toFixed(1)}fps)`)}finally{s.close()}}async function H(e){await V(e,'typeof window.SootSim?.bridges?.startRecording === "function" && typeof window.SootSim?.bridges?.stopRecording === "function"')||(console.error(" SootSim.bridges.startRecording missing \u2014 is rnx engine running in this sim?"),process.exit(1))}async function de(e,r){await V(e,`(() => {
|
|
54
|
+
const fn = window.__sootsimCaptureBundle
|
|
55
|
+
if (typeof fn !== 'function') return false
|
|
56
|
+
const snap = fn()
|
|
57
|
+
return !!(snap && snap.bundleUrl)
|
|
58
|
+
})()`)||(console.error(` --mode ${r} needs a guest app bundle to upload to /preview/<id>,
|
|
59
|
+
but this sim has no bundle loaded (a built-in shell screen like
|
|
60
|
+
photos/settings/home has none). open a metro/guest app first, or
|
|
61
|
+
use \`--mode video\` for a local screen recording with no upload.`),process.exit(1))}async function ce(e,r,o){let i=Z();if(!i)return;let t=i.kind==="api-key"?i.secret:i.token,n=oe(),s={branch:n.branch??void 0,commitSha:n.commitSha??void 0,githubUsername:n.githubUsername??void 0,pullRequestNumber:n.pullRequestNumber??void 0,pullRequestTitle:n.pullRequestTitle??void 0},c=i.kind==="github"?{...ee(i),owner:o?.owner,repo:o?.repo,...s}:o?{owner:o.owner,repo:o.repo,...s}:null,a=r?r.replace(/\/$/,""):null;await e.send({type:"evaluate",code:`(() => {
|
|
62
|
+
const set = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.setSession
|
|
63
|
+
if (typeof set !== 'function') return false
|
|
64
|
+
set({ token: ${JSON.stringify(t)}, user: null })
|
|
65
|
+
window.__sootsimPreviewUploadIdentity = ${JSON.stringify(c)}
|
|
66
|
+
window.__sootsimPreviewUseInjectedBearer = true
|
|
67
|
+
${a?`window.__sootsimUploadOrigin = ${JSON.stringify(a)}`:"delete window.__sootsimUploadOrigin"}
|
|
68
|
+
return true
|
|
69
|
+
})()`})||(console.error(" SootSim.bridges.setSession missing \u2014 this sim is running an engine\n build without CLI-injected preview auth. reload the sim or open a\n fresh one (`rnx open --new`); if it persists, update rnx."),process.exit(1))}async function le(e,r,o){let i=o?JSON.stringify(o):"undefined";return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)}, ${i}, { skipEntitlement: true })`})===!0?{ok:!0,error:null}:{ok:!1,error:await e.send({type:"evaluate",code:"(window.SootSim?.bridges?.getRecordingStartError?.() ?? null)"}).catch(()=>null)??null}}async function ue(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function me(e){let r=Date.now()+J;for(;Date.now()<r;){let o=await e.send({type:"evaluate",code:"(() => { const s = window.SootSim?.bridges?.getRecordingState?.(); return s ? { state: s.state, lastUpload: s.lastUpload, uploadError: s.uploadError } : null })()"});if(o&&o.state==="idle"){if(o.uploadError)return{uploadError:o.uploadError};if(o.lastUpload?.previewUrl)return{previewUrl:o.lastUpload.previewUrl,eventCount:o.lastUpload.eventCount}}await new Promise(i=>setTimeout(i,300))}return{uploadError:`upload did not settle within ${J/1e3}s`}}function pe(e,r,o){e.uploadError&&(console.error(` upload failed: ${e.uploadError}`),process.exit(1)),e.previewUrl||(console.error(" upload returned no preview URL"),process.exit(1)),console.log(` preview: ${e.previewUrl}`),console.log(` note: this URL is content-addressed \u2014 re-recording the same bundle
|
|
70
|
+
replaces this capture at the same /preview/<id>.`),(o==="live"||o==="combined")&&typeof e.eventCount=="number"&&console.log(` captured ${e.eventCount} event${e.eventCount===1?"":"s"}`),(o==="live"||o==="combined")&&e.eventCount===0&&console.log(o==="combined"?` note: this combined recording captured no events \u2014 the Live tab has
|
|
71
|
+
nothing to replay. Video will play the captured screen recording.`:` note: this live recording captured no events \u2014 the preview has nothing
|
|
72
|
+
to replay and will boot a fresh interactive session instead.`),r&&Y(e.previewUrl)}export{Ee as extToFormat,Be as resolveFormat,He as runRecord,u as valueOf};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.336 | (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 m,b as f}from"./chunk-
|
|
5
|
-
usage:
|
|
4
|
+
import{a as m,b as f}from"./chunk-OUAYBJ4G.js";import{a as d}from"./chunk-WBTT5WIO.js";import"./chunk-7FHAHI5V.js";import{J as p}from"./chunk-V4OZDPTA.js";import{a as l}from"./chunk-EAPHUH2R.js";import"./chunk-QIVOOERS.js";import"./chunk-GI3GZ54J.js";import{existsSync as h,readFileSync as w}from"node:fs";import{resolve as b}from"node:path";var R="https://contrast.dev",g=8e3;function v(){return{request:(t,e)=>fetch(t,e),confirmSubmission:d,isInteractive:process.stdin.isTTY===!0,now:()=>new Date,stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t)}}function I(t,e){let n=t.indexOf(e);if(n===-1)return null;let r=t[n+1];if(!r||r.startsWith("-"))throw new Error(`${e} requires a value`);return r}function D(t,e=process.cwd()){let n=I(t,"--app"),r=new Set,s=t.indexOf("--app");s!==-1&&(r.add(s),r.add(s+1));let a=[];for(let c=0;c<t.length;c+=1){if(r.has(c))continue;let u=t[c];if(!(u==="--yes"||u==="-y"||u==="--dry-run")){if(u.startsWith("-"))throw new Error(`unknown flag: ${u}`);a.push(u)}}let i=a.join(" ").trim();if(!i)throw new Error("describe the missing or broken compatibility behavior");if(i.length>g)throw new Error(`description is too long (maximum ${g} characters)`);return{appDir:b(e,n??"."),description:i,dryRun:t.includes("--dry-run"),yes:t.includes("--yes")||t.includes("-y")}}function y(t){if(!t||typeof t!="object")return;let e={};for(let n of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,n)?.value;typeof r=="string"&&(e[n]=r)}return e}function O(t){let e=b(t,"package.json");if(!h(e))return null;let n;try{n=JSON.parse(w(e,"utf8"))}catch{throw new Error(`could not parse ${e}`)}if(!n||typeof n!="object")throw new Error(`${e} must contain a JSON object`);let r=Object.getOwnPropertyDescriptor(n,"name")?.value,s=Object.getOwnPropertyDescriptor(n,"dependencies")?.value,a=Object.getOwnPropertyDescriptor(n,"devDependencies")?.value,i=y(s),c=y(a);return{...typeof r=="string"?{name:r}:{},...i?{dependencies:i}:{},...c?{devDependencies:c}:{}}}async function S(t,e=new Date){let n=O(t.appDir),r=n?(await import("./web-6OAWYV5Z.js")).scanDeps(n):null,s=l(),a=p();return{note:t.description,timestamp:e.toISOString(),sootsim_version:a,cli_version:s,bundle:{activeApp:r&&r.projectName!=="unknown"?{appName:r.projectName}:null,reportSource:"cli",runtimeVersion:a,cliVersion:s,platform:process.platform,arch:process.arch,compatibility:r}}}function $(){let t=m(),e=t?.kind==="session"?t.origin.replace(/\/+$/,""):R,n=t&&t.kind!=="github"?f(t):null;return{url:`${e}/api/sootsim/report-issue`,authorization:n}}function k(t){if(!t)return"no package.json found; no compatibility scan attached";let e=t.packages.filter(n=>n.status!=="full"&&n.status!=="not-relevant").length;return`${t.packages.length} React Native ecosystem packages, ${e} needing attention`}function P(t){if(!t||typeof t!="object")return null;let e=Object.getOwnPropertyDescriptor(t,"id")?.value;return typeof e=="string"&&e?e:null}async function V(t,e=v()){let n;try{n=D(t)}catch(o){return e.stderr(` ${o instanceof Error?o.message:String(o)}
|
|
5
|
+
usage: rnx report-issue [--app <dir>] [--dry-run] [--yes] "<description>"
|
|
6
6
|
`),1}if(!h(n.appDir))return e.stderr(` directory not found: ${n.appDir}
|
|
7
7
|
`),1;let r;try{r=await S(n,e.now())}catch(o){return e.stderr(` could not prepare the issue report: ${o instanceof Error?o.message:String(o)}
|
|
8
8
|
`),1}if(e.stdout(`
|
|
9
|
-
|
|
9
|
+
rnx issue report preview
|
|
10
10
|
|
|
11
11
|
description: ${r.note}
|
|
12
12
|
compatibility: ${k(r.bundle.compatibility)}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.336 | (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}from"./chunk-NDLRQH7U.js";import"./chunk-G3FVXFPF.js";import"./chunk-7PMNRG53.js";import"./chunk-6ALTVOXE.js";import"./chunk-ARFQOYRO.js";import"./chunk-V4OZDPTA.js";import"./chunk-GI3GZ54J.js";export{a as runReset};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.336 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{c as a}from"./chunk-YYBC6VB2.js";import"./chunk-S33NCWJV.js";import"./chunk-DMD24WAG.js";import"./chunk-FMWEQNK2.js";import"./chunk-6ALTVOXE.js";import"./chunk-ARFQOYRO.js";import"./chunk-V4OZDPTA.js";import"./chunk-QIVOOERS.js";import"./chunk-GI3GZ54J.js";export{a as runRuntime};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.336 | (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-2Q6S7X5O.js";import{a as v}from"./chunk-SV6NVD7P.js";import"./chunk-4532OPNZ.js";import"./chunk-2J4OBR7W.js";import"./chunk-UB3JHBDW.js";import{a as ee}from"./chunk-NL2HXO7U.js";import{a as te}from"./chunk-OXRDTNVL.js";import"./chunk-UZCNKUSS.js";import"./chunk-TV457FWW.js";import"./chunk-M2XGXP7G.js";import"./chunk-S33NCWJV.js";import"./chunk-ZI6YQKD6.js";import"./chunk-BYOFHYKS.js";import"./chunk-HDHHEWEA.js";import"./chunk-RZ2PXHA7.js";import{a as re,b as oe}from"./chunk-OUAYBJ4G.js";import"./chunk-NJMBQLAU.js";import"./chunk-MARPC3GM.js";import"./chunk-DMD24WAG.js";import"./chunk-262YA5CJ.js";import"./chunk-G3FVXFPF.js";import{r as Z,s as Q}from"./chunk-7PMNRG53.js";import"./chunk-NVPZLIMW.js";import"./chunk-BIZE6NBI.js";import"./chunk-STMCT3G3.js";import"./chunk-MQES3MTN.js";import"./chunk-7FHAHI5V.js";import"./chunk-KDRDDPNN.js";import"./chunk-FMWEQNK2.js";import"./chunk-3QCSDI3B.js";import"./chunk-BOZARB6P.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-BHXQ7MUW.js";import{q as A,r as K,s as B,t as X,u as J,v as M,w as $}from"./chunk-6ALTVOXE.js";import"./chunk-ARFQOYRO.js";import"./chunk-6TN3YWA6.js";import"./chunk-V4OZDPTA.js";import"./chunk-QIVOOERS.js";import"./chunk-GI3GZ54J.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-E7GLIOHG.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-TKR2YV6U.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.336 | (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-NL2HXO7U.js";import"./chunk-M2XGXP7G.js";import"./chunk-262YA5CJ.js";import{r as b,s as I}from"./chunk-7PMNRG53.js";import"./chunk-BOZARB6P.js";import{b as m}from"./chunk-BHXQ7MUW.js";import{q as y,s as v,v as w}from"./chunk-6ALTVOXE.js";import"./chunk-ARFQOYRO.js";import"./chunk-V4OZDPTA.js";import"./chunk-GI3GZ54J.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.336 | (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-SV6NVD7P.js";import{a as M}from"./chunk-OUAYBJ4G.js";import"./chunk-7FHAHI5V.js";import"./chunk-V4OZDPTA.js";import{a as F}from"./chunk-QIVOOERS.js";import"./chunk-GI3GZ54J.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};
|