(args: RenderArgs)
| 71 | |
| 72 | // fallow-ignore-next-line complexity |
| 73 | export async function runRender(args: RenderArgs): Promise<void> { |
| 74 | const stack = requireStack(args.stackName); |
| 75 | const projectDir = resolvePath(args.projectDir); |
| 76 | |
| 77 | warnOnDimensionMismatch({ |
| 78 | projectDir, |
| 79 | cliWidth: args.width, |
| 80 | cliHeight: args.height, |
| 81 | outputResolution: args.outputResolution, |
| 82 | quiet: args.json, |
| 83 | }); |
| 84 | |
| 85 | // Resolve --variables / --variables-file using the same parser the local |
| 86 | // `hyperframes render` uses. `resolveVariablesArg` exits(1) with a friendly |
| 87 | // errorBox on parse errors so callers don't have to. |
| 88 | const variables = resolveVariablesArg(args.variables, args.variablesFile); |
| 89 | |
| 90 | // Validate against the composition's `data-composition-variables` |
| 91 | // declaration when present. The local CLI silently treats unreadable |
| 92 | // index.html as "no declarations" — mirror that. Skip validation |
| 93 | // entirely when the project dir is missing on disk (e.g. `--site-id` |
| 94 | // pointing at a pre-uploaded site that was packaged on another machine). |
| 95 | if (variables && Object.keys(variables).length > 0) { |
| 96 | const indexPath = join(projectDir, "index.html"); |
| 97 | if (existsSync(indexPath)) { |
| 98 | const issues = validateVariablesAgainstProject(indexPath, variables); |
| 99 | // Suppress the warning block when --json is set; stdout is reserved |
| 100 | // for the manifest. The strict-mode errorBox still prints to stderr |
| 101 | // and exits, so machine consumers still get a non-zero exit. |
| 102 | reportVariableIssues(issues, { strict: args.strictVariables ?? false, quiet: args.json }); |
| 103 | } else if (args.strictVariables && !args.json) { |
| 104 | // --strict-variables asks for typed checking but there's no |
| 105 | // index.html to check against (typical with --site-id pointing at a |
| 106 | // pre-uploaded site). Make that silent skip visible so the flag |
| 107 | // doesn't quietly become a no-op. |
| 108 | console.warn( |
| 109 | c.warn( |
| 110 | `--strict-variables: no ${indexPath} on disk — schema validation skipped. ` + |
| 111 | "Variables flow through unchecked. To enable strict checking, run from a project dir that contains the composition.", |
| 112 | ), |
| 113 | ); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | const config: SerializableDistributedRenderConfig = { |
| 118 | fps: args.fps, |
| 119 | width: args.width, |
| 120 | height: args.height, |
| 121 | outputResolution: args.outputResolution, |
| 122 | format: args.format, |
| 123 | codec: args.codec, |
| 124 | quality: args.quality, |
| 125 | chunkSize: args.chunkSize, |
| 126 | maxParallelChunks: args.maxParallelChunks, |
| 127 | targetChunkFrames: args.targetChunkFrames, |
| 128 | runtimeCap: "lambda", |
| 129 | variables, |
| 130 | }; |
nothing calls this directly
no test coverage detected