@remotion/cli 3.1.3 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/compositions.js +4 -1
  2. package/dist/get-cli-options.d.ts +2 -2
  3. package/dist/get-cli-options.js +8 -16
  4. package/dist/get-composition-id.d.ts +1 -2
  5. package/dist/get-composition-id.js +2 -3
  6. package/dist/get-filename.d.ts +3 -2
  7. package/dist/get-filename.js +5 -5
  8. package/dist/index.d.ts +1 -2
  9. package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.d.ts +1 -1
  10. package/dist/preview-server/routes.js +2 -2
  11. package/dist/preview-server/start-server.js +1 -1
  12. package/dist/render.js +14 -5
  13. package/dist/setup-cache.js +26 -10
  14. package/dist/still.js +25 -15
  15. package/dist/upgrade.js +1 -0
  16. package/dist/user-passed-output-location.d.ts +5 -1
  17. package/dist/user-passed-output-location.js +14 -7
  18. package/dist/versions.js +1 -0
  19. package/package.json +7 -7
  20. package/dist/bundle-on-cli.d.ts +0 -2
  21. package/dist/bundle-on-cli.js +0 -41
  22. package/dist/bundle.d.ts +0 -1
  23. package/dist/bundle.js +0 -31
  24. package/dist/chalk/symbols.d.ts +0 -111
  25. package/dist/chalk/symbols.js +0 -75
  26. package/dist/chalk/utilities.d.ts +0 -2
  27. package/dist/chalk/utilities.js +0 -37
  28. package/dist/editor/components/CompositionManager.d.ts +0 -4
  29. package/dist/editor/components/CompositionManager.js +0 -60
  30. package/dist/editor/components/LoadingIndicator.d.ts +0 -2
  31. package/dist/editor/components/LoadingIndicator.js +0 -35
  32. package/dist/prepare-entry-point.d.ts +0 -11
  33. package/dist/prepare-entry-point.js +0 -36
  34. package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
  35. package/dist/preview-server/fast-refresh/helpers.js +0 -145
  36. package/dist/preview-server/fast-refresh/index.d.ts +0 -30
  37. package/dist/preview-server/fast-refresh/index.js +0 -86
  38. package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
  39. package/dist/preview-server/fast-refresh/loader.js +0 -81
  40. package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
  41. package/dist/preview-server/fast-refresh/runtime.js +0 -32
  42. package/dist/preview-server/static-preview.d.ts +0 -1
  43. package/dist/preview-server/static-preview.js +0 -40
  44. package/dist/preview-server/webpack-cache.d.ts +0 -12
  45. package/dist/preview-server/webpack-cache.js +0 -66
@@ -34,7 +34,10 @@ const listCompositionsCommand = async () => {
34
34
  }
35
35
  const fullPath = path_1.default.join(process.cwd(), file);
36
36
  await (0, get_config_file_name_1.loadConfig)();
37
- const { browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, puppeteerTimeout, port, } = await (0, get_cli_options_1.getCliOptions)({ isLambda: false, type: 'get-compositions' });
37
+ const { browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, puppeteerTimeout, port, } = await (0, get_cli_options_1.getCliOptions)({
38
+ isLambda: false,
39
+ type: 'get-compositions',
40
+ });
38
41
  const bundled = await (0, setup_cache_1.bundleOnCli)({ fullPath, steps: ['bundling'] });
39
42
  const compositions = await (0, renderer_1.getCompositions)(bundled, {
40
43
  browserExecutable,
@@ -1,5 +1,6 @@
1
1
  import type { ChromiumOptions } from '@remotion/renderer';
2
2
  import type { BrowserExecutable, FrameRange } from 'remotion';
3
+ export declare const getAndValidateAbsoluteOutputFile: (relativeOutputLocation: string, overwrite: boolean) => string;
3
4
  export declare const getCliOptions: (options: {
4
5
  isLambda: boolean;
5
6
  type: 'still' | 'series' | 'get-compositions';
@@ -9,11 +10,9 @@ export declare const getCliOptions: (options: {
9
10
  frameRange: FrameRange | null;
10
11
  shouldOutputImageSequence: boolean;
11
12
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
12
- overwrite: boolean;
13
13
  inputProps: object;
14
14
  envVariables: Record<string, string>;
15
15
  quality: number | undefined;
16
- absoluteOutputFile: string | null;
17
16
  browser: import("remotion").Browser;
18
17
  crf: number | null;
19
18
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
@@ -28,5 +27,6 @@ export declare const getCliOptions: (options: {
28
27
  logLevel: "verbose" | "info" | "warn" | "error";
29
28
  scale: number;
30
29
  chromiumOptions: ChromiumOptions;
30
+ overwrite: boolean;
31
31
  port: number | null;
32
32
  }>;
@@ -3,13 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCliOptions = void 0;
6
+ exports.getCliOptions = exports.getAndValidateAbsoluteOutputFile = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const remotion_1 = require("remotion");
11
11
  const get_env_1 = require("./get-env");
12
- const get_filename_1 = require("./get-filename");
13
12
  const get_input_props_1 = require("./get-input-props");
14
13
  const image_formats_1 = require("./image-formats");
15
14
  const log_1 = require("./log");
@@ -63,14 +62,15 @@ const getFinalCodec = async (options) => {
63
62
  return codec;
64
63
  };
65
64
  const getBrowser = () => { var _a; return (_a = remotion_1.Internals.getBrowser()) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_BROWSER; };
66
- const getAndValidateAbsoluteOutputFile = (outputFile, overwrite) => {
67
- const absoluteOutputFile = path_1.default.resolve(process.cwd(), outputFile);
65
+ const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite) => {
66
+ const absoluteOutputFile = path_1.default.resolve(process.cwd(), relativeOutputLocation);
68
67
  if (fs_1.default.existsSync(absoluteOutputFile) && !overwrite) {
69
68
  log_1.Log.error(`File at ${absoluteOutputFile} already exists. Use --overwrite to overwrite.`);
70
69
  process.exit(1);
71
70
  }
72
71
  return absoluteOutputFile;
73
72
  };
73
+ exports.getAndValidateAbsoluteOutputFile = getAndValidateAbsoluteOutputFile;
74
74
  const getAndValidateShouldOutputImageSequence = async ({ frameRange, isLambda, }) => {
75
75
  const shouldOutputImageSequence = remotion_1.Internals.getShouldOutputImageSequence(frameRange);
76
76
  // When parsing options locally, we don't need FFMPEG because the render will happen on Lambda
@@ -118,20 +118,15 @@ const getCliOptions = async (options) => {
118
118
  const frameRange = getAndValidateFrameRange();
119
119
  const codec = options.type === 'get-compositions'
120
120
  ? 'h264'
121
- : await getFinalCodec({ isLambda: options.isLambda });
121
+ : await getFinalCodec({
122
+ isLambda: options.isLambda,
123
+ });
122
124
  const shouldOutputImageSequence = options.type === 'still'
123
125
  ? true
124
126
  : await getAndValidateShouldOutputImageSequence({
125
127
  frameRange,
126
128
  isLambda: options.isLambda,
127
129
  });
128
- const outputFile = options.isLambda || options.type === 'get-compositions'
129
- ? null
130
- : (0, get_filename_1.getOutputFilename)({
131
- codec,
132
- imageSequence: shouldOutputImageSequence,
133
- type: options.type,
134
- });
135
130
  const overwrite = remotion_1.Internals.getShouldOverwrite();
136
131
  const crf = getAndValidateCrf(shouldOutputImageSequence, codec);
137
132
  const pixelFormat = getAndValidatePixelFormat(codec);
@@ -162,13 +157,9 @@ const getCliOptions = async (options) => {
162
157
  frameRange,
163
158
  shouldOutputImageSequence,
164
159
  codec,
165
- overwrite: remotion_1.Internals.getShouldOverwrite(),
166
160
  inputProps: (0, get_input_props_1.getInputProps)(() => undefined),
167
161
  envVariables: await (0, get_env_1.getEnvironmentVariables)(),
168
162
  quality: remotion_1.Internals.getQuality(),
169
- absoluteOutputFile: outputFile
170
- ? getAndValidateAbsoluteOutputFile(outputFile, overwrite)
171
- : null,
172
163
  browser: await getAndValidateBrowser(browserExecutable),
173
164
  crf,
174
165
  pixelFormat,
@@ -183,6 +174,7 @@ const getCliOptions = async (options) => {
183
174
  logLevel: remotion_1.Internals.Logging.getLogLevel(),
184
175
  scale,
185
176
  chromiumOptions,
177
+ overwrite,
186
178
  port: port !== null && port !== void 0 ? port : null,
187
179
  };
188
180
  };
@@ -1,2 +1 @@
1
- import type { TCompMetadata } from 'remotion';
2
- export declare const getCompositionId: (comps: TCompMetadata[]) => string;
1
+ export declare const getCompositionId: () => string;
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCompositionId = void 0;
4
4
  const log_1 = require("./log");
5
5
  const parse_command_line_1 = require("./parse-command-line");
6
- const getCompositionId = (comps) => {
6
+ const getCompositionId = () => {
7
7
  if (!parse_command_line_1.parsedCli._[2]) {
8
8
  log_1.Log.error('Composition ID not passed.');
9
- log_1.Log.error('Pass an extra argument <composition-id>. The following video names are available:');
10
- log_1.Log.error(`${comps.map((c) => c.id).join(', ')}`);
9
+ log_1.Log.error('Pass an extra argument <composition-id>.');
11
10
  process.exit(1);
12
11
  }
13
12
  return parse_command_line_1.parsedCli._[2];
@@ -1,6 +1,7 @@
1
1
  import type { Codec } from 'remotion';
2
- export declare const getOutputFilename: ({ codec, imageSequence, type, }: {
2
+ export declare const getOutputFilename: ({ codec, imageSequence, compositionName, defaultExtension, }: {
3
3
  codec: Codec;
4
4
  imageSequence: boolean;
5
- type: 'still' | 'series';
5
+ compositionName: string;
6
+ defaultExtension: string;
6
7
  }) => string;
@@ -4,11 +4,11 @@ exports.getOutputFilename = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const log_1 = require("./log");
6
6
  const user_passed_output_location_1 = require("./user-passed-output-location");
7
- const getOutputFilename = ({ codec, imageSequence, type, }) => {
8
- let filename = (0, user_passed_output_location_1.getUserPassedOutputLocation)();
9
- if (type === 'still') {
10
- return filename;
11
- }
7
+ const getOutputFilename = ({ codec, imageSequence, compositionName, defaultExtension, }) => {
8
+ let filename = (0, user_passed_output_location_1.getOutputLocation)({
9
+ compositionId: compositionName,
10
+ defaultExtension,
11
+ });
12
12
  let extension = renderer_1.RenderInternals.getExtensionOfFilename(filename);
13
13
  if (imageSequence) {
14
14
  if (extension !== null) {
package/dist/index.d.ts CHANGED
@@ -75,11 +75,9 @@ export declare const CliInternals: {
75
75
  frameRange: import("remotion").FrameRange | null;
76
76
  shouldOutputImageSequence: boolean;
77
77
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
78
- overwrite: boolean;
79
78
  inputProps: object;
80
79
  envVariables: Record<string, string>;
81
80
  quality: number | undefined;
82
- absoluteOutputFile: string | null;
83
81
  browser: import("remotion").Browser;
84
82
  crf: number | null;
85
83
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
@@ -94,6 +92,7 @@ export declare const CliInternals: {
94
92
  logLevel: "verbose" | "info" | "warn" | "error";
95
93
  scale: number;
96
94
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
95
+ overwrite: boolean;
97
96
  port: number | null;
98
97
  }>;
99
98
  parseCommandLine: (type: "sequence" | "still" | "lambda" | "preview" | "versions") => void;
@@ -1,5 +1,5 @@
1
1
  declare const editorNames: readonly ["atom", "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta", "brackets", "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl", "code", "code-insiders", "vscodium", "/Applications/AppCode.app/Contents/MacOS/appcode", "/Applications/CLion.app/Contents/MacOS/clion", "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea", "/Applications/PhpStorm.app/Contents/MacOS/phpstorm", "/Applications/PyCharm.app/Contents/MacOS/pycharm", "/Applications/PyCharm CE.app/Contents/MacOS/pycharm", "/Applications/RubyMine.app/Contents/MacOS/rubymine", "/Applications/WebStorm.app/Contents/MacOS/webstorm", "/Applications/GoLand.app/Contents/MacOS/goland", "/Applications/Rider.app/Contents/MacOS/rider", "mvim", "emacs", "gvim", "idea", "phpstorm", "pycharm", "rubymine", "sublime_text", "vim", "webstorm", "goland", "rider", "Brackets.exe", "Code.exe", "Code - Insiders.exe", "VSCodium.exe", "atom.exe", "sublime_text.exe", "notepad++.exe", "clion.exe", "clion64.exe", "idea.exe", "idea64.exe", "phpstorm.exe", "phpstorm64.exe", "pycharm.exe", "pycharm64.exe", "rubymine.exe", "rubymine64.exe", "webstorm.exe", "webstorm64.exe", "goland.exe", "goland64.exe", "rider.exe", "rider64.exe", "nano"];
2
- export declare const getDisplayNameForEditor: (editor: Editor | undefined) => string | null;
2
+ export declare const getDisplayNameForEditor: (editor: Editor | null) => string | null;
3
3
  declare type Editor = typeof editorNames[number];
4
4
  declare type ProcessAndCommand = {
5
5
  process: string;
@@ -25,8 +25,8 @@ const static404 = (response) => {
25
25
  response.end('The static/ prefix has been changed, this URL is no longer valid.');
26
26
  };
27
27
  const handleFallback = async (hash, _, response, getCurrentInputProps) => {
28
- const edit = await editorGuess;
29
- const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit[0].command);
28
+ const [edit] = await editorGuess;
29
+ const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit ? edit.command : null);
30
30
  response.setHeader('content-type', 'text/html');
31
31
  response.writeHead(200);
32
32
  response.end(bundler_1.BundlerInternals.indexHtml(hash, '/', displayName, getCurrentInputProps()));
@@ -19,7 +19,7 @@ const routes_1 = require("./routes");
19
19
  const startServer = async (entry, userDefinedComponent, options) => {
20
20
  var _a, _b, _c, _d;
21
21
  const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
22
- const config = bundler_1.BundlerInternals.webpackConfig({
22
+ const [, config] = bundler_1.BundlerInternals.webpackConfig({
23
23
  entry,
24
24
  userDefinedComponent,
25
25
  outDir: tmpDir,
package/dist/render.js CHANGED
@@ -12,6 +12,7 @@ const remotion_1 = require("remotion");
12
12
  const chalk_1 = require("./chalk");
13
13
  const get_cli_options_1 = require("./get-cli-options");
14
14
  const get_composition_id_1 = require("./get-composition-id");
15
+ const get_filename_1 = require("./get-filename");
15
16
  const initialize_render_cli_1 = require("./initialize-render-cli");
16
17
  const log_1 = require("./log");
17
18
  const parse_command_line_1 = require("./parse-command-line");
@@ -31,10 +32,19 @@ const render = async () => {
31
32
  ? file
32
33
  : path_1.default.join(process.cwd(), file);
33
34
  await (0, initialize_render_cli_1.initializeRenderCli)('sequence');
34
- const { codec, proResProfile, parallelism, frameRange, shouldOutputImageSequence, absoluteOutputFile, overwrite, inputProps, envVariables, quality, browser, crf, pixelFormat, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, numberOfGifLoops, everyNthFrame, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({ isLambda: false, type: 'series' });
35
- if (!absoluteOutputFile) {
36
- throw new Error('assertion error - expected absoluteOutputFile to not be null');
37
- }
35
+ const { codec, proResProfile, parallelism, frameRange, shouldOutputImageSequence, overwrite, inputProps, envVariables, quality, browser, crf, pixelFormat, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, numberOfGifLoops, everyNthFrame, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({
36
+ isLambda: false,
37
+ type: 'series',
38
+ });
39
+ const relativeOutputLocation = (0, get_filename_1.getOutputFilename)({
40
+ codec,
41
+ imageSequence: shouldOutputImageSequence,
42
+ compositionName: (0, get_composition_id_1.getCompositionId)(),
43
+ defaultExtension: renderer_1.RenderInternals.getFileExtensionFromCodec(codec, 'final'),
44
+ });
45
+ const absoluteOutputFile = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
46
+ const compositionId = (0, get_composition_id_1.getCompositionId)();
47
+ log_1.Log.info(chalk_1.chalk.gray(`Composition = ${compositionId}, Codec = ${codec}, Output = ${relativeOutputLocation}`));
38
48
  log_1.Log.verbose('Browser executable: ', browserExecutable);
39
49
  await (0, validate_ffmpeg_version_1.checkAndValidateFfmpegVersion)({
40
50
  ffmpegExecutable,
@@ -80,7 +90,6 @@ const render = async () => {
80
90
  chromiumOptions,
81
91
  browserExecutable,
82
92
  });
83
- const compositionId = (0, get_composition_id_1.getCompositionId)(comps);
84
93
  const config = comps.find((c) => c.id === compositionId);
85
94
  if (!config) {
86
95
  throw new Error(`Cannot find composition with ID ${compositionId}`);
@@ -9,10 +9,26 @@ const progress_bar_1 = require("./progress-bar");
9
9
  const bundleOnCli = async ({ fullPath, steps, }) => {
10
10
  var _a;
11
11
  const shouldCache = remotion_1.Internals.getWebpackCaching();
12
- const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production');
13
- if (cacheExistedBefore && !shouldCache) {
12
+ const onProgress = (progress) => {
13
+ bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
14
+ progress: progress / 100,
15
+ steps,
16
+ doneIn: null,
17
+ }));
18
+ };
19
+ const options = {
20
+ enableCaching: shouldCache,
21
+ webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
22
+ };
23
+ const [hash] = bundler_1.BundlerInternals.getConfig('', fullPath, onProgress, options);
24
+ const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production', hash);
25
+ if (cacheExistedBefore !== 'does-not-exist' && !shouldCache) {
14
26
  log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
15
- await bundler_1.BundlerInternals.clearCache('production');
27
+ await bundler_1.BundlerInternals.clearCache();
28
+ }
29
+ if (cacheExistedBefore === 'other-exists' && shouldCache) {
30
+ log_1.Log.info('🧹 Webpack config change detected. Clearing cache... ');
31
+ await bundler_1.BundlerInternals.clearCache();
16
32
  }
17
33
  const bundleStartTime = Date.now();
18
34
  const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
@@ -22,19 +38,19 @@ const bundleOnCli = async ({ fullPath, steps, }) => {
22
38
  steps,
23
39
  doneIn: null,
24
40
  }));
25
- }, {
26
- enableCaching: shouldCache,
27
- webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
28
- });
41
+ }, options);
29
42
  bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
30
43
  progress: 1,
31
44
  steps,
32
45
  doneIn: Date.now() - bundleStartTime,
33
46
  }) + '\n');
34
47
  log_1.Log.verbose('Bundled under', bundled);
35
- const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production');
36
- if (cacheExistedAfter && !cacheExistedBefore) {
37
- log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
48
+ const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production', hash) === 'exists';
49
+ if (cacheExistedAfter) {
50
+ if (cacheExistedBefore === 'does-not-exist' ||
51
+ cacheExistedBefore === 'other-exists') {
52
+ log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
53
+ }
38
54
  }
39
55
  return bundled;
40
56
  };
package/dist/still.js CHANGED
@@ -24,28 +24,39 @@ const still = async () => {
24
24
  ? file
25
25
  : path_1.default.join(process.cwd(), file);
26
26
  await (0, initialize_render_cli_1.initializeRenderCli)('still');
27
- const userOutput = path_1.default.resolve(process.cwd(), (0, user_passed_output_location_1.getUserPassedOutputLocation)());
28
- if (userOutput.endsWith('.jpeg') || userOutput.endsWith('.jpg')) {
29
- log_1.Log.verbose('Output file has a JPEG extension, therefore setting the image format to JPEG.');
27
+ const userPassedOutput = (0, user_passed_output_location_1.getUserPassedOutputLocation)();
28
+ if ((userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpeg')) ||
29
+ (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpg'))) {
30
+ log_1.Log.verbose('Output file has a JPEG extension, setting the image format to JPEG.');
30
31
  remotion_1.Config.Rendering.setImageFormat('jpeg');
31
32
  }
32
- if (userOutput.endsWith('.png')) {
33
- log_1.Log.verbose('Output file has a PNG extension, therefore setting the image format to PNG.');
33
+ if (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.png')) {
34
+ log_1.Log.verbose('Output file has a PNG extension, setting the image format to PNG.');
34
35
  remotion_1.Config.Rendering.setImageFormat('png');
35
36
  }
36
- const { inputProps, envVariables, quality, browser, imageFormat, stillFrame, browserExecutable, chromiumOptions, scale, ffmpegExecutable, ffprobeExecutable, overwrite, puppeteerTimeout, port, } = await (0, get_cli_options_1.getCliOptions)({ isLambda: false, type: 'still' });
37
+ const { inputProps, envVariables, quality, browser, imageFormat, stillFrame, browserExecutable, chromiumOptions, scale, ffmpegExecutable, ffprobeExecutable, overwrite, puppeteerTimeout, port, } = await (0, get_cli_options_1.getCliOptions)({
38
+ isLambda: false,
39
+ type: 'still',
40
+ });
37
41
  log_1.Log.verbose('Browser executable: ', browserExecutable);
42
+ const compositionId = (0, get_composition_id_1.getCompositionId)();
43
+ const relativeOutputLocation = (0, user_passed_output_location_1.getOutputLocation)({
44
+ compositionId,
45
+ defaultExtension: imageFormat,
46
+ });
47
+ const absoluteOutputLocation = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
48
+ log_1.Log.info(chalk_1.chalk.gray(`Output = ${relativeOutputLocation}, Format = ${imageFormat}, Composition = ${compositionId}`));
38
49
  if (imageFormat === 'none') {
39
50
  log_1.Log.error('No image format was selected - this is probably an error in Remotion - please post your command on Github Issues for help.');
40
51
  process.exit(1);
41
52
  }
42
- if (imageFormat === 'png' && !userOutput.endsWith('.png')) {
43
- log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${userOutput}`);
53
+ if (imageFormat === 'png' && !absoluteOutputLocation.endsWith('.png')) {
54
+ log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${absoluteOutputLocation}`);
44
55
  }
45
56
  if (imageFormat === 'jpeg' &&
46
- !userOutput.endsWith('.jpg') &&
47
- !userOutput.endsWith('.jpeg')) {
48
- log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${userOutput}`);
57
+ !absoluteOutputLocation.endsWith('.jpg') &&
58
+ !absoluteOutputLocation.endsWith('.jpeg')) {
59
+ log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${absoluteOutputLocation}`);
49
60
  }
50
61
  const browserInstance = (0, renderer_1.openBrowser)(browser, {
51
62
  browserExecutable,
@@ -53,7 +64,7 @@ const still = async () => {
53
64
  shouldDumpIo: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
54
65
  forceDeviceScaleFactor: scale,
55
66
  });
56
- (0, fs_1.mkdirSync)(path_1.default.join(userOutput, '..'), {
67
+ (0, fs_1.mkdirSync)(path_1.default.join(absoluteOutputLocation, '..'), {
57
68
  recursive: true,
58
69
  });
59
70
  const steps = [
@@ -75,7 +86,6 @@ const still = async () => {
75
86
  ffmpegExecutable,
76
87
  ffprobeExecutable,
77
88
  });
78
- const compositionId = (0, get_composition_id_1.getCompositionId)(comps);
79
89
  const composition = comps.find((c) => c.id === compositionId);
80
90
  if (!composition) {
81
91
  throw new Error(`Cannot find composition with ID ${compositionId}`);
@@ -118,7 +128,7 @@ const still = async () => {
118
128
  await (0, renderer_1.renderStill)({
119
129
  composition,
120
130
  frame: stillFrame,
121
- output: userOutput,
131
+ output: absoluteOutputLocation,
122
132
  serveUrl: await urlOrBundle,
123
133
  quality,
124
134
  dumpBrowserLogs: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
@@ -145,7 +155,7 @@ const still = async () => {
145
155
  seconds === 1 ? 'second' : 'seconds',
146
156
  ].join(' '));
147
157
  log_1.Log.info('-', 'Output can be found at:');
148
- log_1.Log.info(chalk_1.chalk.cyan(`▶️ ${userOutput}`));
158
+ log_1.Log.info(chalk_1.chalk.cyan(`▶️ ${absoluteOutputLocation}`));
149
159
  await closeBrowserPromise;
150
160
  };
151
161
  exports.still = still;
package/dist/upgrade.js CHANGED
@@ -41,6 +41,7 @@ const upgrade = async () => {
41
41
  '@remotion/cli',
42
42
  '@remotion/eslint-config',
43
43
  '@remotion/renderer',
44
+ '@remotion/skia',
44
45
  '@remotion/media-utils',
45
46
  '@remotion/babel-loader',
46
47
  '@remotion/lambda',
@@ -1 +1,5 @@
1
- export declare const getUserPassedOutputLocation: () => string;
1
+ export declare const getUserPassedOutputLocation: () => string | null;
2
+ export declare const getOutputLocation: ({ compositionId, defaultExtension, }: {
3
+ compositionId: string;
4
+ defaultExtension: string;
5
+ }) => string;
@@ -1,14 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUserPassedOutputLocation = void 0;
4
- const log_1 = require("./log");
3
+ exports.getOutputLocation = exports.getUserPassedOutputLocation = void 0;
4
+ const remotion_1 = require("remotion");
5
5
  const parse_command_line_1 = require("./parse-command-line");
6
6
  const getUserPassedOutputLocation = () => {
7
- if (!parse_command_line_1.parsedCli._[3]) {
8
- log_1.Log.error('Pass an extra argument <output-filename>.');
9
- process.exit(1);
10
- }
11
- const filename = parse_command_line_1.parsedCli._[3];
7
+ const filename = parse_command_line_1.parsedCli._[3]
8
+ ? parse_command_line_1.parsedCli._[3]
9
+ : remotion_1.Internals.getOutputLocation();
12
10
  return filename;
13
11
  };
14
12
  exports.getUserPassedOutputLocation = getUserPassedOutputLocation;
13
+ const getDefaultOutLocation = ({ compositionName, defaultExtension, }) => {
14
+ const defaultName = `out/${compositionName}.${defaultExtension}`;
15
+ return defaultName;
16
+ };
17
+ const getOutputLocation = ({ compositionId, defaultExtension, }) => {
18
+ var _a;
19
+ return ((_a = (0, exports.getUserPassedOutputLocation)()) !== null && _a !== void 0 ? _a : getDefaultOutLocation({ compositionName: compositionId, defaultExtension }));
20
+ };
21
+ exports.getOutputLocation = getOutputLocation;
package/dist/versions.js CHANGED
@@ -14,6 +14,7 @@ const packages = [
14
14
  '@remotion/cli',
15
15
  '@remotion/eslint-config',
16
16
  '@remotion/renderer',
17
+ '@remotion/skia',
17
18
  '@remotion/media-utils',
18
19
  '@remotion/babel-loader',
19
20
  '@remotion/lambda',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.1.3",
3
+ "version": "3.1.6",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -23,15 +23,15 @@
23
23
  "author": "Jonny Burger <jonny@remotion.dev>",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@remotion/bundler": "3.1.3",
27
- "@remotion/media-utils": "3.1.3",
28
- "@remotion/player": "3.1.3",
29
- "@remotion/renderer": "3.1.3",
26
+ "@remotion/bundler": "3.1.6",
27
+ "@remotion/media-utils": "3.1.6",
28
+ "@remotion/player": "3.1.6",
29
+ "@remotion/renderer": "3.1.6",
30
30
  "better-opn": "2.1.1",
31
31
  "dotenv": "9.0.2",
32
32
  "memfs": "3.4.3",
33
33
  "minimist": "1.2.6",
34
- "remotion": "3.1.3",
34
+ "remotion": "3.1.6",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1",
37
37
  "vitest": "^0.18.0"
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "d57ec16eaf33280c89b0974997946ab9ea155372"
74
+ "gitHead": "188460243a533e1511b3f83fa8c77cd4c445553d"
75
75
  }
@@ -1,2 +0,0 @@
1
- import { RenderStep } from './step';
2
- export declare const bundleOnCli: (fullPath: string, steps: RenderStep[]) => Promise<string>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleOnCli = void 0;
4
- const bundler_1 = require("@remotion/bundler");
5
- const remotion_1 = require("remotion");
6
- const log_1 = require("./log");
7
- const parse_command_line_1 = require("./parse-command-line");
8
- const progress_bar_1 = require("./progress-bar");
9
- const bundleOnCli = async (fullPath, steps) => {
10
- var _a;
11
- const shouldCache = remotion_1.Internals.getWebpackCaching();
12
- const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production', null);
13
- if (cacheExistedBefore && !shouldCache) {
14
- log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
15
- await bundler_1.BundlerInternals.clearCache('production', null);
16
- }
17
- const bundleStartTime = Date.now();
18
- const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
19
- const bundled = await (0, bundler_1.bundle)(fullPath, (progress) => {
20
- bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
21
- progress: progress / 100,
22
- steps,
23
- doneIn: null,
24
- }));
25
- }, {
26
- enableCaching: shouldCache,
27
- webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
28
- });
29
- bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
30
- progress: 1,
31
- steps,
32
- doneIn: Date.now() - bundleStartTime,
33
- }) + '\n');
34
- log_1.Log.verbose('Bundled under', bundled);
35
- const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production', null);
36
- if (cacheExistedAfter && !cacheExistedBefore) {
37
- log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
38
- }
39
- return bundled;
40
- };
41
- exports.bundleOnCli = bundleOnCli;
package/dist/bundle.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const bundleCommand: () => Promise<void>;
package/dist/bundle.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleCommand = void 0;
4
- const get_cli_options_1 = require("./get-cli-options");
5
- const initialize_render_cli_1 = require("./initialize-render-cli");
6
- const log_1 = require("./log");
7
- const parse_command_line_1 = require("./parse-command-line");
8
- const prepare_entry_point_1 = require("./prepare-entry-point");
9
- const bundleCommand = async () => {
10
- const file = parse_command_line_1.parsedCli._[1];
11
- if (!file) {
12
- log_1.Log.error('No entry point specified. Pass more arguments:');
13
- log_1.Log.error(' npx remotion bundle [entry-point]');
14
- log_1.Log.error('Documentation: https://www.remotion.dev/docs/render');
15
- process.exit(1);
16
- }
17
- await (0, initialize_render_cli_1.initializeRenderCli)('bundle');
18
- const { publicPath, bundleOutDir } = await (0, get_cli_options_1.getCliOptions)({
19
- isLambda: false,
20
- type: 'get-compositions-or-bundle',
21
- });
22
- const { urlOrBundle } = await (0, prepare_entry_point_1.prepareEntryPoint)({
23
- file,
24
- otherSteps: [],
25
- outDir: bundleOutDir,
26
- publicPath,
27
- });
28
- log_1.Log.info();
29
- log_1.Log.info(urlOrBundle);
30
- };
31
- exports.bundleCommand = bundleCommand;