({ args })
| 181 | }, |
| 182 | // fallow-ignore-next-line complexity |
| 183 | async run({ args }) { |
| 184 | const asJson = Boolean(args.json); |
| 185 | const fps = parseIntFlag(args.fps, { flag: "--fps", min: 1, max: 240 }); |
| 186 | const quality = parseEnumFlag(args.quality, VALID_QUALITY, { flag: "--quality" }); |
| 187 | const format = parseEnumFlag(args.format, VALID_FORMAT, { flag: "--format" }); |
| 188 | const resolution = parseEnumFlag(args.resolution, VALID_RESOLUTION, { |
| 189 | flag: "--resolution", |
| 190 | }); |
| 191 | const explicitAspectRatio = parseEnumFlag(args["aspect-ratio"], VALID_ASPECT_RATIO, { |
| 192 | flag: "--aspect-ratio", |
| 193 | }); |
| 194 | const pollIntervalMs = parsePollIntervalMs(args["poll-interval"]); |
| 195 | const maxWaitMs = parseMaxWaitMs(args["max-wait"]); |
| 196 | validateIdempotencyKey(args["idempotency-key"]); |
| 197 | |
| 198 | // Project resolution runs BEFORE variables resolution so a user |
| 199 | // passing conflicting inputs (`dir + --asset-id`) sees the |
| 200 | // structural error before any variable parsing errors. |
| 201 | const project = resolveProjectInput({ |
| 202 | dir: args.dir, |
| 203 | assetId: args["asset-id"], |
| 204 | url: args.url, |
| 205 | }); |
| 206 | |
| 207 | // 4k supersampling runs through the alpha-incompatible screenshot path; |
| 208 | // reject the combination client-side instead of failing mid-render. |
| 209 | validateResolutionFormatCombo(resolution, format); |
| 210 | |
| 211 | // Aspect ratio is derived from the composition's authored dimensions: for |
| 212 | // a local dir we parse the entry HTML and auto-detect, so the user rarely |
| 213 | // needs --aspect-ratio at all. When they DO pass it, we validate it |
| 214 | // matches the composition (the renderer can't reshape, only supersample to |
| 215 | // a matching ratio) and fail fast on a mismatch. This also fails fast when |
| 216 | // the --composition entry file is missing, rather than uploading a zip the |
| 217 | // render rejects with a generic server-side error. |
| 218 | const aspectRatio = resolveAspectRatioForSubmit( |
| 219 | project, |
| 220 | args.composition, |
| 221 | explicitAspectRatio, |
| 222 | asJson, |
| 223 | ); |
| 224 | |
| 225 | const variables = resolveVariablesAndValidateIfLocal( |
| 226 | args.variables, |
| 227 | args["variables-file"], |
| 228 | args["strict-variables"] ?? false, |
| 229 | project, |
| 230 | ); |
| 231 | |
| 232 | const client = await createCloudClient(); |
| 233 | |
| 234 | const upload = await maybeUploadProject(client, project, asJson, args["idempotency-key"]); |
| 235 | const submitted = await submitRender(client, { |
| 236 | projectInput: upload.projectInput, |
| 237 | fps, |
| 238 | quality, |
| 239 | format, |
| 240 | resolution, |
nothing calls this directly
no test coverage detected