* Resolve --variables / --variables-file via the shared CLI parser (the same * one `hyperframes render` and `hyperframes lambda render` use), then validate * against the composition's `data-composition-variables` when an `index.html` * is on disk. `--strict-variables` turns mismatches into a hard
( args: Record<string, unknown>, projectDir: string, )
| 800 | * is on disk. `--strict-variables` turns mismatches into a hard failure. |
| 801 | */ |
| 802 | function resolveAndValidateVariables( |
| 803 | args: Record<string, unknown>, |
| 804 | projectDir: string, |
| 805 | ): Record<string, unknown> | undefined { |
| 806 | const variables = resolveVariablesArg( |
| 807 | args.variables as string | undefined, |
| 808 | args["variables-file"] as string | undefined, |
| 809 | ); |
| 810 | if (variables && Object.keys(variables).length > 0) { |
| 811 | const indexPath = join(projectDir, "index.html"); |
| 812 | if (existsSync(indexPath)) { |
| 813 | const issues = validateVariablesAgainstProject(indexPath, variables); |
| 814 | reportVariableIssues(issues, { |
| 815 | strict: Boolean(args["strict-variables"]), |
| 816 | quiet: Boolean(args.json), |
| 817 | }); |
| 818 | } |
| 819 | } |
| 820 | return variables; |
| 821 | } |
| 822 | |
| 823 | function parseOutputResolution(raw: unknown): CanvasResolution | undefined { |
| 824 | if (raw == null || raw === "") return undefined; |
no test coverage detected