nezuhub's picture
download
raw
11.5 kB
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CliInternals = exports.cli = void 0;
const renderer_1 = require("@remotion/renderer");
const client_1 = require("@remotion/renderer/client");
const studio_server_1 = require("@remotion/studio-server");
const minimist_1 = __importDefault(require("minimist"));
const add_1 = require("./add");
const benchmark_1 = require("./benchmark");
const browser_1 = require("./browser");
const browser_download_bar_1 = require("./browser-download-bar");
const bundle_1 = require("./bundle");
const chalk_1 = require("./chalk");
const check_for_npm_run_flag_pass_1 = require("./check-for-npm-run-flag-pass");
const cleanup_before_quit_1 = require("./cleanup-before-quit");
const cloudrun_command_1 = require("./cloudrun-command");
const command_help_1 = require("./command-help");
const compositions_1 = require("./compositions");
const determine_image_format_1 = require("./determine-image-format");
const download_progress_1 = require("./download-progress");
const entry_point_1 = require("./entry-point");
const experimental_codemod_1 = require("./experimental-codemod");
const ffmpeg_1 = require("./ffmpeg");
const get_cli_options_1 = require("./get-cli-options");
const get_composition_with_dimension_override_1 = require("./get-composition-with-dimension-override");
const get_config_file_name_1 = require("./get-config-file-name");
const get_crf_for_codec_1 = require("./get-crf-for-codec");
const get_github_repository_1 = require("./get-github-repository");
const gpu_1 = require("./gpu");
const is_supported_1 = require("./hyperlinks/is-supported");
const make_link_1 = require("./hyperlinks/make-link");
const import_canvas_capture_1 = require("./import-canvas-capture");
const initialize_cli_1 = require("./initialize-cli");
const lambda_command_1 = require("./lambda-command");
const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
const log_1 = require("./log");
const make_progress_bar_1 = require("./make-progress-bar");
const parsed_cli_1 = require("./parsed-cli");
const print_compositions_1 = require("./print-compositions");
const print_error_1 = require("./print-error");
const print_help_1 = require("./print-help");
const progress_bar_1 = require("./progress-bar");
const render_1 = require("./render");
const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
const skills_1 = require("./skills");
const still_1 = require("./still");
const studio_1 = require("./studio");
const upgrade_1 = require("./upgrade");
const versions_1 = require("./versions");
const { packageManagerOption, skipSkillsOption, versionFlagOption } = client_1.BrowserSafeApis.options;
const cli = async () => {
var _a;
const [command, ...args] = parsed_cli_1.parsedCli._;
const helpPath = command === 'help' && (args.length > 0 || !parsed_cli_1.parsedCli.help)
? args
: parsed_cli_1.parsedCli._;
if (parsed_cli_1.parsedCli.help || command === 'help') {
const [helpCommand, ...helpArgs] = helpPath;
if (helpCommand === 'experimental-codemod') {
(0, experimental_codemod_1.printExperimentalCodemodHelp)('info');
return;
}
if (helpCommand === 'lambda' || helpCommand === 'cloudrun') {
const helpRemotionRoot = renderer_1.RenderInternals.findRemotionRoot();
const printed = helpCommand === 'lambda'
? (0, lambda_command_1.tryPrintLambdaHelp)(helpRemotionRoot, helpArgs, 'info')
: (0, cloudrun_command_1.tryPrintCloudrunHelp)(helpRemotionRoot, helpArgs, 'info');
if (printed) {
return;
}
}
(0, print_help_1.printHelp)('info', helpPath);
return;
}
const packageManager = packageManagerOption.getValue({
commandLine: parsed_cli_1.parsedCli,
}).value;
const remotionRoot = renderer_1.RenderInternals.findRemotionRoot();
if (command !== versions_1.VERSIONS_COMMAND && !parsed_cli_1.parsedCli.help) {
await (0, versions_1.validateVersionsBeforeCommand)(remotionRoot, 'info');
}
const logLevel = await (0, initialize_cli_1.initializeCli)(remotionRoot);
const isBun = typeof Bun !== 'undefined';
if (isBun) {
const version = Bun.version.split('.');
if (version.length === 3) {
if (Number(version[0]) < 1) {
throw new Error('Please upgrade to at least Bun 1.0.3');
}
if (Number(version[1]) === 0 && Number(version[2]) < 3) {
throw new Error('Please upgrade to at least Bun 1.0.3');
}
}
log_1.Log.info({ indent: false, logLevel }, 'You are running Remotion with Bun, which is mostly supported. Visit https://remotion.dev/bun for more information.');
}
const isStudio = command === 'studio' || command === 'preview';
const errorSymbolicationLock = isStudio
? 0
: renderer_1.RenderInternals.registerErrorSymbolicationLock();
(0, cleanup_before_quit_1.handleCtrlC)({ indent: false, logLevel });
(0, check_for_npm_run_flag_pass_1.checkForNpmRunFlagPass)({ indent: false, logLevel });
try {
if (command === 'bundle') {
await (0, bundle_1.bundleCommand)(remotionRoot, args, logLevel);
}
else if (command === 'compositions') {
await (0, compositions_1.listCompositionsCommand)(remotionRoot, args, logLevel);
}
else if (isStudio) {
await (0, studio_1.studioCommand)(remotionRoot, args, logLevel);
}
else if (command === 'lambda') {
await (0, lambda_command_1.lambdaCommand)(remotionRoot, args, logLevel);
}
else if (command === 'cloudrun') {
await (0, cloudrun_command_1.cloudrunCommand)(remotionRoot, args, logLevel);
}
else if (command === 'render') {
await (0, render_1.render)(remotionRoot, args, logLevel);
}
else if (command === 'still') {
await (0, still_1.still)(remotionRoot, args, logLevel);
}
else if (command === 'ffmpeg') {
(0, ffmpeg_1.ffmpegCommand)(process.argv.slice(3), logLevel);
}
else if (command === 'gpu') {
await (0, gpu_1.gpuCommand)(logLevel);
}
else if (command === 'ffprobe') {
(0, ffmpeg_1.ffprobeCommand)(process.argv.slice(3), logLevel);
}
else if (command === 'upgrade') {
await (0, upgrade_1.upgradeCommand)({
remotionRoot,
packageManager: packageManager !== null && packageManager !== void 0 ? packageManager : undefined,
version: (_a = versionFlagOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value) !== null && _a !== void 0 ? _a : undefined,
skipSkills: skipSkillsOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value,
logLevel,
args,
});
}
else if (command === 'add') {
if (args.length === 0) {
throw new Error('Please specify at least one package name. Example: npx remotion add @remotion/transitions');
}
// Find where additional flags start (arguments starting with -)
const flagIndex = args.findIndex((arg) => arg.startsWith('-'));
const packageNames = flagIndex === -1 ? args : args.slice(0, flagIndex);
const additionalArgs = flagIndex === -1 ? [] : args.slice(flagIndex);
await (0, add_1.addCommand)({
remotionRoot,
packageManager: packageManager !== null && packageManager !== void 0 ? packageManager : undefined,
packageNames,
logLevel,
args: additionalArgs,
});
}
else if (command === 'skills') {
await (0, skills_1.skillsCommand)(args, logLevel, {
cwd: process.cwd(),
environment: process.env,
});
}
else if (command === 'experimental-codemod') {
await (0, experimental_codemod_1.experimentalCodemodCommand)(remotionRoot, process.argv.slice(2), logLevel);
}
else if (command === versions_1.VERSIONS_COMMAND) {
await (0, versions_1.versionsCommand)(remotionRoot, logLevel);
}
else if (command === browser_1.BROWSER_COMMAND) {
await (0, browser_1.browserCommand)(args, logLevel);
}
else if (command === 'benchmark') {
await (0, benchmark_1.benchmarkCommand)(remotionRoot, args, logLevel);
}
else {
if (command) {
log_1.Log.error({ indent: false, logLevel }, `Command ${command} not found.`);
}
(0, print_help_1.printHelp)(logLevel, []);
process.exit(1);
}
}
catch (err) {
log_1.Log.info({ indent: false, logLevel });
await (0, print_error_1.printError)(err, logLevel);
(0, cleanup_before_quit_1.cleanupBeforeQuit)({ indent: false, logLevel });
process.exit(1);
}
finally {
renderer_1.RenderInternals.unlockErrorSymbolicationLock(errorSymbolicationLock);
(0, cleanup_before_quit_1.cleanupBeforeQuit)({ indent: false, logLevel });
}
};
exports.cli = cli;
exports.CliInternals = {
importCanvasCapture: import_canvas_capture_1.importCanvasCapture,
createOverwriteableCliOutput: progress_bar_1.createOverwriteableCliOutput,
chalk: chalk_1.chalk,
makeProgressBar: make_progress_bar_1.makeProgressBar,
Log: log_1.Log,
getCliOptions: get_cli_options_1.getCliOptions,
loadConfig: get_config_file_name_1.loadConfig,
formatBytes: studio_server_1.StudioServerInternals.formatBytes,
initializeCli: initialize_cli_1.initializeCli,
BooleanFlags: parsed_cli_1.BooleanFlags,
quietFlagProvided: parsed_cli_1.quietFlagProvided,
parsedCli: parsed_cli_1.parsedCli,
printError: print_error_1.printError,
getFileSizeDownloadBar: download_progress_1.getFileSizeDownloadBar,
determineFinalStillImageFormat: determine_image_format_1.determineFinalStillImageFormat,
minimist: minimist_1.default,
findEntryPoint: entry_point_1.findEntryPoint,
printCompositions: print_compositions_1.printCompositions,
listOfRemotionPackages: list_of_remotion_packages_1.listOfRemotionPackages,
shouldUseNonOverlayingLogger: should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger,
getCompositionWithDimensionOverride: get_composition_with_dimension_override_1.getCompositionWithDimensionOverride,
defaultBrowserDownloadProgress: browser_download_bar_1.defaultBrowserDownloadProgress,
LABEL_WIDTH: progress_bar_1.LABEL_WIDTH,
printFact: progress_bar_1.printFact,
makeHyperlink: make_link_1.makeHyperlink,
supportsHyperlink: is_supported_1.supportsHyperlink,
getGitSource: get_github_repository_1.getGitSource,
getCommandHelp: command_help_1.getCommandHelp,
makeCommandHelpOption: command_help_1.makeCommandHelpOption,
handleCtrlC: cleanup_before_quit_1.handleCtrlC,
registerCtrlCHandler: cleanup_before_quit_1.registerCtrlCHandler,
getCrfForCodec: get_crf_for_codec_1.getCrfForCodec,
};

Xet Storage Details

Size:
11.5 kB
·
Xet hash:
22fbaa50c66e0dbac21bb805ffc2ac208304bdc5a2c0b3e6f646e6d738a4f0bf

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.