import {CliInternals} from '@remotion/cli'; import { LambdaClientInternals, getCompositionsOnLambda, } from '@remotion/lambda-client'; import {BINARY_NAME} from '@remotion/lambda-client/constants'; import type {ChromiumOptions, LogLevel} from '@remotion/renderer'; import {BrowserSafeApis} from '@remotion/renderer/client'; import {parsedLambdaCli} from '../../args'; import {getAwsRegion} from '../../get-aws-region'; import {findFunctionName} from '../../helpers/find-function-name'; import {quit} from '../../helpers/quit'; import {Log} from '../../log'; import {COMPOSITIONS_COMMAND} from '../command-names'; export {COMPOSITIONS_COMMAND} from '../command-names'; const { enableMultiprocessOnLinuxOption, glOption, delayRenderTimeoutInMillisecondsOption, headlessOption, darkModeOption, userAgentOption, disableWebSecurityOption, ignoreCertificateErrorsOption, } = BrowserSafeApis.options; export const compositionsCommand = async ({ args, logLevel, }: { args: string[]; logLevel: LogLevel; }) => { const serveUrl = args[0]; if (!serveUrl) { Log.error({indent: false, logLevel}, 'No serve URL passed.'); Log.info( {indent: false, logLevel}, 'Pass an additional argument specifying a URL where your Remotion project is hosted.', ); Log.info({indent: false, logLevel}); Log.info( {indent: false, logLevel}, `${BINARY_NAME} ${COMPOSITIONS_COMMAND} `, ); quit(1); } const {envVariables, inputProps} = CliInternals.getCliOptions({ isStill: false, logLevel, indent: false, }); const userAgent = userAgentOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const disableWebSecurity = disableWebSecurityOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const gl = glOption.getValue({commandLine: CliInternals.parsedCli}).value; const puppeteerTimeout = delayRenderTimeoutInMillisecondsOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const headless = headlessOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const darkMode = darkModeOption.getValue({ commandLine: CliInternals.parsedCli, }).value; const chromiumOptions: Required = { flags: BrowserSafeApis.options.chromiumFlagsOption.getValue({ commandLine: CliInternals.parsedCli, }).value, features: BrowserSafeApis.options.chromiumFeaturesOption.getValue({ commandLine: CliInternals.parsedCli, }).value, blinkFeatures: BrowserSafeApis.options.chromiumBlinkFeaturesOption.getValue( {commandLine: CliInternals.parsedCli}, ).value, disableWebSecurity, enableMultiProcessOnLinux, gl, headless, ignoreCertificateErrors, userAgent, darkMode, }; const region = getAwsRegion(); LambdaClientInternals.validateServeUrl(serveUrl); const functionName = await findFunctionName({logLevel}); const comps = await getCompositionsOnLambda({ preferredEffectBackend: BrowserSafeApis.options.preferredEffectBackendOption.getValue({ commandLine: CliInternals.parsedCli, }).value, functionName, serveUrl, inputProps, region, chromiumOptions, envVariables, logLevel, timeoutInMilliseconds: puppeteerTimeout, forceBucketName: parsedLambdaCli['force-bucket-name'], requestHandler: null, }); CliInternals.printCompositions(comps, logLevel); };