138 lines
6.5 KiB
JavaScript
138 lines
6.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.listCompositionsCommand = void 0;
|
|
const renderer_1 = require("@remotion/renderer");
|
|
const client_1 = require("@remotion/renderer/client");
|
|
const no_react_1 = require("remotion/no-react");
|
|
const browser_download_bar_1 = require("./browser-download-bar");
|
|
const cleanup_before_quit_1 = require("./cleanup-before-quit");
|
|
const preview_server_1 = require("./config/preview-server");
|
|
const entry_point_1 = require("./entry-point");
|
|
const get_cli_options_1 = require("./get-cli-options");
|
|
const log_1 = require("./log");
|
|
const parsed_cli_1 = require("./parsed-cli");
|
|
const print_compositions_1 = require("./print-compositions");
|
|
const setup_cache_1 = require("./setup-cache");
|
|
const { enableMultiprocessOnLinuxOption, offthreadVideoCacheSizeInBytesOption, offthreadVideoThreadsOption, glOption, headlessOption, delayRenderTimeoutInMillisecondsOption, binariesDirectoryOption, publicPathOption, publicDirOption, chromeModeOption, audioLatencyHintOption, mediaCacheSizeInBytesOption, darkModeOption, askAIOption, experimentalClientSideRenderingOption, keyboardShortcutsOption, } = client_1.BrowserSafeApis.options;
|
|
const listCompositionsCommand = async (remotionRoot, args, logLevel) => {
|
|
const { file, reason } = (0, entry_point_1.findEntryPoint)({
|
|
args,
|
|
remotionRoot,
|
|
logLevel,
|
|
allowDirectory: true,
|
|
});
|
|
if (!file) {
|
|
log_1.Log.error({ indent: false, logLevel }, 'The `compositions` command requires you to specify a entry point. For example');
|
|
log_1.Log.error({ indent: false, logLevel }, ' npx remotion compositions src/index.ts');
|
|
log_1.Log.error({ indent: false, logLevel }, 'See https://www.remotion.dev/docs/register-root for more information.');
|
|
process.exit(1);
|
|
}
|
|
log_1.Log.verbose({ indent: false, logLevel }, 'Entry point:', file, 'reason:', reason);
|
|
const { browserExecutable, envVariables, inputProps, ignoreCertificateErrors, userAgent, disableWebSecurity, } = (0, get_cli_options_1.getCliOptions)({
|
|
isStill: false,
|
|
logLevel,
|
|
indent: false,
|
|
});
|
|
const publicPath = publicPathOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const timeoutInMilliseconds = delayRenderTimeoutInMillisecondsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const binariesDirectory = binariesDirectoryOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const darkMode = darkModeOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const offthreadVideoCacheSizeInBytes = offthreadVideoCacheSizeInBytesOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const publicDir = publicDirOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const chromeMode = chromeModeOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const audioLatencyHint = audioLatencyHintOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const askAIEnabled = askAIOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const chromiumOptions = {
|
|
disableWebSecurity,
|
|
enableMultiProcessOnLinux: enableMultiprocessOnLinuxOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value,
|
|
gl: glOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value,
|
|
headless: headlessOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value,
|
|
ignoreCertificateErrors,
|
|
userAgent,
|
|
darkMode,
|
|
};
|
|
const experimentalClientSideRenderingEnabled = experimentalClientSideRenderingOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const keyboardShortcutsEnabled = keyboardShortcutsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
if (experimentalClientSideRenderingEnabled) {
|
|
log_1.Log.warn({ indent: false, logLevel }, 'Enabling WIP client-side rendering. Please see caveats on https://www.remotion.dev/docs/client-side-rendering/.');
|
|
}
|
|
const { urlOrBundle: bundled, cleanup: cleanupBundle } = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
|
|
remotionRoot,
|
|
fullPath: file,
|
|
publicDir,
|
|
onProgress: () => undefined,
|
|
indentOutput: false,
|
|
logLevel,
|
|
onDirectoryCreated: (dir) => {
|
|
(0, cleanup_before_quit_1.registerCleanupJob)(`Delete ${dir}`, () => renderer_1.RenderInternals.deleteDirectory(dir));
|
|
},
|
|
quietProgress: false,
|
|
quietFlag: (0, parsed_cli_1.quietFlagProvided)(),
|
|
outDir: null,
|
|
// Not needed for compositions
|
|
gitSource: null,
|
|
bufferStateDelayInMilliseconds: null,
|
|
maxTimelineTracks: null,
|
|
publicPath,
|
|
audioLatencyHint,
|
|
experimentalClientSideRenderingEnabled,
|
|
askAIEnabled,
|
|
keyboardShortcutsEnabled,
|
|
});
|
|
(0, cleanup_before_quit_1.registerCleanupJob)(`Cleanup bundle`, () => cleanupBundle());
|
|
const compositions = await renderer_1.RenderInternals.internalGetCompositions({
|
|
serveUrlOrWebpackUrl: bundled,
|
|
browserExecutable,
|
|
chromiumOptions,
|
|
envVariables,
|
|
serializedInputPropsWithCustomSchema: no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({
|
|
data: inputProps,
|
|
staticBase: null,
|
|
indent: undefined,
|
|
}).serializedString,
|
|
timeoutInMilliseconds,
|
|
port: (0, preview_server_1.getRendererPortFromConfigFileAndCliFlag)(),
|
|
indent: false,
|
|
onBrowserLog: null,
|
|
puppeteerInstance: undefined,
|
|
logLevel,
|
|
server: undefined,
|
|
offthreadVideoCacheSizeInBytes,
|
|
offthreadVideoThreads,
|
|
binariesDirectory,
|
|
onBrowserDownload: (0, browser_download_bar_1.defaultBrowserDownloadProgress)({
|
|
indent: false,
|
|
logLevel,
|
|
quiet: (0, parsed_cli_1.quietFlagProvided)(),
|
|
onProgress: () => undefined,
|
|
}),
|
|
chromeMode,
|
|
mediaCacheSizeInBytes,
|
|
onLog: renderer_1.RenderInternals.defaultOnLog,
|
|
});
|
|
(0, print_compositions_1.printCompositions)(compositions, logLevel);
|
|
};
|
|
exports.listCompositionsCommand = listCompositionsCommand;
|