@remotion/cli 3.1.4 → 3.1.7

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 (156) hide show
  1. package/dist/code-frame.js +3 -3
  2. package/dist/compositions.d.ts +1 -1
  3. package/dist/compositions.js +13 -4
  4. package/dist/config/browser-executable.d.ts +3 -0
  5. package/dist/config/browser-executable.js +12 -0
  6. package/dist/config/browser.d.ts +3 -0
  7. package/dist/config/browser.js +18 -0
  8. package/dist/config/chromium-flags.d.ts +9 -0
  9. package/dist/config/chromium-flags.js +33 -0
  10. package/dist/config/codec.d.ts +7 -0
  11. package/dist/config/codec.js +40 -0
  12. package/dist/config/concurrency.d.ts +3 -0
  13. package/dist/config/concurrency.js +12 -0
  14. package/dist/config/crf.d.ts +4 -0
  15. package/dist/config/crf.js +23 -0
  16. package/dist/config/env-file.d.ts +2 -0
  17. package/dist/config/env-file.js +10 -0
  18. package/dist/config/every-nth-frame.d.ts +3 -0
  19. package/dist/config/every-nth-frame.js +20 -0
  20. package/dist/config/ffmpeg-executable.d.ts +5 -0
  21. package/dist/config/ffmpeg-executable.js +21 -0
  22. package/dist/config/frame-range.d.ts +4 -0
  23. package/dist/config/frame-range.js +35 -0
  24. package/dist/config/image-format.d.ts +3 -0
  25. package/dist/config/image-format.js +20 -0
  26. package/dist/config/image-sequence.d.ts +3 -0
  27. package/dist/config/image-sequence.js +15 -0
  28. package/dist/config/index.d.ts +43 -0
  29. package/dist/config/index.js +162 -0
  30. package/dist/config/log.d.ts +3 -0
  31. package/dist/config/log.js +12 -0
  32. package/dist/config/max-timeline-tracks.d.ts +2 -0
  33. package/dist/config/max-timeline-tracks.js +24 -0
  34. package/dist/config/number-of-gif-loops.d.ts +4 -0
  35. package/dist/config/number-of-gif-loops.js +21 -0
  36. package/dist/config/output-location.d.ts +2 -0
  37. package/dist/config/output-location.js +16 -0
  38. package/dist/config/override-webpack.d.ts +5 -0
  39. package/dist/config/override-webpack.js +14 -0
  40. package/dist/config/overwrite.d.ts +2 -0
  41. package/dist/config/overwrite.js +14 -0
  42. package/dist/config/pixel-format.d.ts +3 -0
  43. package/dist/config/pixel-format.js +16 -0
  44. package/dist/config/preview-server.d.ts +2 -0
  45. package/dist/config/preview-server.js +20 -0
  46. package/dist/config/prores-profile.d.ts +3 -0
  47. package/dist/config/prores-profile.js +12 -0
  48. package/dist/config/quality.d.ts +2 -0
  49. package/dist/config/quality.js +17 -0
  50. package/dist/config/scale.d.ts +3 -0
  51. package/dist/config/scale.js +15 -0
  52. package/dist/config/still-frame.d.ts +2 -0
  53. package/dist/config/still-frame.js +12 -0
  54. package/dist/config/timeout.d.ts +2 -0
  55. package/dist/config/timeout.js +17 -0
  56. package/dist/config/webpack-caching.d.ts +3 -0
  57. package/dist/config/webpack-caching.js +16 -0
  58. package/dist/editor/components/CompositionSelectorItem.d.ts +1 -1
  59. package/dist/editor/components/CompositionSelectorItem.js +2 -1
  60. package/dist/editor/components/Editor.js +2 -1
  61. package/dist/editor/components/InitialCompositionLoader.d.ts +1 -1
  62. package/dist/editor/components/InitialCompositionLoader.js +17 -4
  63. package/dist/editor/components/PlayPause.js +4 -0
  64. package/dist/editor/components/Timeline/TimelineDragHandler.js +3 -2
  65. package/dist/editor/components/Timeline/TimelineInOutPointer.js +2 -1
  66. package/dist/editor/components/Timeline/TimelineListItem.js +1 -0
  67. package/dist/editor/components/TimelineInOutToggle.js +3 -2
  68. package/dist/editor/state/in-out.d.ts +12 -0
  69. package/dist/editor/state/in-out.js +23 -0
  70. package/dist/find-closest-package-json.d.ts +2 -0
  71. package/dist/find-closest-package-json.js +35 -0
  72. package/dist/get-cli-options.d.ts +6 -7
  73. package/dist/get-cli-options.js +43 -48
  74. package/dist/get-composition-id.d.ts +1 -2
  75. package/dist/get-composition-id.js +2 -3
  76. package/dist/get-config-file-name.d.ts +1 -1
  77. package/dist/get-config-file-name.js +9 -6
  78. package/dist/get-env.js +6 -4
  79. package/dist/get-filename.d.ts +4 -3
  80. package/dist/get-filename.js +5 -5
  81. package/dist/get-final-output-codec.d.ts +6 -0
  82. package/dist/get-final-output-codec.js +63 -0
  83. package/dist/image-formats.d.ts +3 -3
  84. package/dist/image-formats.js +4 -3
  85. package/dist/index.d.ts +11 -10
  86. package/dist/index.js +17 -9
  87. package/dist/initialize-render-cli.d.ts +1 -1
  88. package/dist/initialize-render-cli.js +8 -3
  89. package/dist/lambda-command.d.ts +1 -1
  90. package/dist/lambda-command.js +4 -4
  91. package/dist/load-config.d.ts +1 -1
  92. package/dist/load-config.js +16 -5
  93. package/dist/log.js +7 -6
  94. package/dist/parse-command-line.d.ts +1 -1
  95. package/dist/parse-command-line.js +31 -30
  96. package/dist/preview-server/error-overlay/react-overlay/effects/map-error-to-react-stack.js +2 -2
  97. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.d.ts +1 -1
  98. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +3 -3
  99. package/dist/preview-server/get-package-manager.d.ts +1 -1
  100. package/dist/preview-server/get-package-manager.js +2 -2
  101. package/dist/preview-server/project-info.d.ts +1 -1
  102. package/dist/preview-server/project-info.js +3 -3
  103. package/dist/preview-server/routes.d.ts +2 -1
  104. package/dist/preview-server/routes.js +28 -17
  105. package/dist/preview-server/start-server.d.ts +1 -0
  106. package/dist/preview-server/start-server.js +4 -2
  107. package/dist/preview-server/update-available.d.ts +1 -1
  108. package/dist/preview-server/update-available.js +8 -5
  109. package/dist/preview.d.ts +1 -1
  110. package/dist/preview.js +5 -4
  111. package/dist/previewEntry.js +1 -0
  112. package/dist/progress-bar.d.ts +1 -2
  113. package/dist/progress-bar.js +5 -4
  114. package/dist/render.d.ts +1 -1
  115. package/dist/render.js +31 -15
  116. package/dist/setup-cache.d.ts +2 -1
  117. package/dist/setup-cache.js +16 -9
  118. package/dist/still.d.ts +1 -1
  119. package/dist/still.js +40 -25
  120. package/dist/truthy.d.ts +3 -0
  121. package/dist/truthy.js +7 -0
  122. package/dist/upgrade.d.ts +1 -1
  123. package/dist/upgrade.js +5 -10
  124. package/dist/user-passed-output-location.d.ts +5 -1
  125. package/dist/user-passed-output-location.js +14 -7
  126. package/dist/versions.d.ts +2 -2
  127. package/dist/versions.js +13 -12
  128. package/dist/webpack-cache.d.ts +2 -2
  129. package/dist/webpack-cache.js +10 -10
  130. package/package.json +7 -7
  131. package/dist/bundle-on-cli.d.ts +0 -2
  132. package/dist/bundle-on-cli.js +0 -41
  133. package/dist/bundle.d.ts +0 -1
  134. package/dist/bundle.js +0 -31
  135. package/dist/chalk/symbols.d.ts +0 -111
  136. package/dist/chalk/symbols.js +0 -75
  137. package/dist/chalk/utilities.d.ts +0 -2
  138. package/dist/chalk/utilities.js +0 -37
  139. package/dist/editor/components/CompositionManager.d.ts +0 -4
  140. package/dist/editor/components/CompositionManager.js +0 -60
  141. package/dist/editor/components/LoadingIndicator.d.ts +0 -2
  142. package/dist/editor/components/LoadingIndicator.js +0 -35
  143. package/dist/prepare-entry-point.d.ts +0 -11
  144. package/dist/prepare-entry-point.js +0 -36
  145. package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
  146. package/dist/preview-server/fast-refresh/helpers.js +0 -145
  147. package/dist/preview-server/fast-refresh/index.d.ts +0 -30
  148. package/dist/preview-server/fast-refresh/index.js +0 -86
  149. package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
  150. package/dist/preview-server/fast-refresh/loader.js +0 -81
  151. package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
  152. package/dist/preview-server/fast-refresh/runtime.js +0 -32
  153. package/dist/preview-server/static-preview.d.ts +0 -1
  154. package/dist/preview-server/static-preview.js +0 -40
  155. package/dist/preview-server/webpack-cache.d.ts +0 -12
  156. package/dist/preview-server/webpack-cache.js +0 -66
package/dist/render.js CHANGED
@@ -8,17 +8,20 @@ const renderer_1 = require("@remotion/renderer");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const path_1 = __importDefault(require("path"));
11
+ // eslint-disable-next-line no-restricted-imports
11
12
  const remotion_1 = require("remotion");
12
13
  const chalk_1 = require("./chalk");
14
+ const config_1 = require("./config");
13
15
  const get_cli_options_1 = require("./get-cli-options");
14
16
  const get_composition_id_1 = require("./get-composition-id");
17
+ const get_filename_1 = require("./get-filename");
15
18
  const initialize_render_cli_1 = require("./initialize-render-cli");
16
19
  const log_1 = require("./log");
17
20
  const parse_command_line_1 = require("./parse-command-line");
18
21
  const progress_bar_1 = require("./progress-bar");
19
22
  const setup_cache_1 = require("./setup-cache");
20
23
  const validate_ffmpeg_version_1 = require("./validate-ffmpeg-version");
21
- const render = async () => {
24
+ const render = async (remotionRoot) => {
22
25
  const startTime = Date.now();
23
26
  const file = parse_command_line_1.parsedCli._[1];
24
27
  if (!file) {
@@ -30,18 +33,28 @@ const render = async () => {
30
33
  const fullPath = renderer_1.RenderInternals.isServeUrl(file)
31
34
  ? file
32
35
  : path_1.default.join(process.cwd(), file);
33
- 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
- }
36
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
37
+ await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'sequence');
38
+ 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)({
39
+ isLambda: false,
40
+ type: 'series',
41
+ });
42
+ const relativeOutputLocation = (0, get_filename_1.getOutputFilename)({
43
+ codec,
44
+ imageSequence: shouldOutputImageSequence,
45
+ compositionName: (0, get_composition_id_1.getCompositionId)(),
46
+ defaultExtension: renderer_1.RenderInternals.getFileExtensionFromCodec(codec, 'final'),
47
+ });
48
+ const absoluteOutputFile = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
49
+ const compositionId = (0, get_composition_id_1.getCompositionId)();
50
+ log_1.Log.info(chalk_1.chalk.gray(`Composition = ${compositionId}, Codec = ${codec}, Output = ${relativeOutputLocation}`));
38
51
  log_1.Log.verbose('Browser executable: ', browserExecutable);
39
52
  await (0, validate_ffmpeg_version_1.checkAndValidateFfmpegVersion)({
40
53
  ffmpegExecutable,
41
54
  });
42
55
  const browserInstance = (0, renderer_1.openBrowser)(browser, {
43
56
  browserExecutable,
44
- shouldDumpIo: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
57
+ shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
45
58
  chromiumOptions,
46
59
  forceDeviceScaleFactor: scale,
47
60
  });
@@ -52,7 +65,7 @@ const render = async () => {
52
65
  ].filter(remotion_1.Internals.truthy);
53
66
  const urlOrBundle = renderer_1.RenderInternals.isServeUrl(fullPath)
54
67
  ? fullPath
55
- : await (0, setup_cache_1.bundleOnCli)({ fullPath, steps });
68
+ : await (0, setup_cache_1.bundleOnCli)({ fullPath, remotionRoot, steps });
56
69
  const onDownload = (src) => {
57
70
  const id = Math.random();
58
71
  const download = {
@@ -76,11 +89,11 @@ const render = async () => {
76
89
  inputProps,
77
90
  puppeteerInstance,
78
91
  envVariables,
79
- timeoutInMilliseconds: remotion_1.Internals.getCurrentPuppeteerTimeout(),
92
+ timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
80
93
  chromiumOptions,
81
94
  browserExecutable,
95
+ downloadMap,
82
96
  });
83
- const compositionId = (0, get_composition_id_1.getCompositionId)(comps);
84
97
  const config = comps.find((c) => c.id === compositionId);
85
98
  if (!config) {
86
99
  throw new Error(`Cannot find composition with ID ${compositionId}`);
@@ -157,7 +170,7 @@ const render = async () => {
157
170
  },
158
171
  outputDir,
159
172
  serveUrl: urlOrBundle,
160
- dumpBrowserLogs: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
173
+ dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
161
174
  everyNthFrame,
162
175
  envVariables,
163
176
  frameRange,
@@ -171,6 +184,7 @@ const render = async () => {
171
184
  ffprobeExecutable,
172
185
  browserExecutable,
173
186
  port,
187
+ downloadMap,
174
188
  });
175
189
  renderedDoneIn = Date.now() - startTime;
176
190
  updateRenderProgress();
@@ -206,13 +220,15 @@ const render = async () => {
206
220
  quality,
207
221
  serveUrl: urlOrBundle,
208
222
  onDownload,
209
- dumpBrowserLogs: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
223
+ dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
210
224
  chromiumOptions,
211
- timeoutInMilliseconds: remotion_1.Internals.getCurrentPuppeteerTimeout(),
225
+ timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
212
226
  scale,
213
227
  port,
214
228
  numberOfGifLoops,
215
229
  everyNthFrame,
230
+ verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
231
+ downloadMap,
216
232
  });
217
233
  log_1.Log.info();
218
234
  log_1.Log.info();
@@ -234,8 +250,8 @@ const render = async () => {
234
250
  log_1.Log.warn('Do you have minimum required Node.js version?');
235
251
  }
236
252
  log_1.Log.info(chalk_1.chalk.green(`\nYour ${codec === 'gif' ? 'GIF' : 'video'} is ready!`));
237
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose')) {
238
- remotion_1.Internals.perf.logPerf();
253
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose')) {
254
+ renderer_1.RenderInternals.perf.logPerf();
239
255
  }
240
256
  };
241
257
  exports.render = render;
@@ -1,5 +1,6 @@
1
1
  import type { RenderStep } from './step';
2
- export declare const bundleOnCli: ({ fullPath, steps, }: {
2
+ export declare const bundleOnCli: ({ fullPath, steps, remotionRoot, }: {
3
3
  fullPath: string;
4
4
  steps: RenderStep[];
5
+ remotionRoot: string;
5
6
  }) => Promise<string>;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bundleOnCli = void 0;
4
4
  const bundler_1 = require("@remotion/bundler");
5
- const remotion_1 = require("remotion");
5
+ const config_1 = require("./config");
6
6
  const log_1 = require("./log");
7
7
  const parse_command_line_1 = require("./parse-command-line");
8
8
  const progress_bar_1 = require("./progress-bar");
9
- const bundleOnCli = async ({ fullPath, steps, }) => {
9
+ const bundleOnCli = async ({ fullPath, steps, remotionRoot, }) => {
10
10
  var _a;
11
- const shouldCache = remotion_1.Internals.getWebpackCaching();
11
+ const shouldCache = config_1.ConfigInternals.getWebpackCaching();
12
12
  const onProgress = (progress) => {
13
13
  bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
14
14
  progress: progress / 100,
@@ -18,17 +18,24 @@ const bundleOnCli = async ({ fullPath, steps, }) => {
18
18
  };
19
19
  const options = {
20
20
  enableCaching: shouldCache,
21
- webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
21
+ webpackOverride: (_a = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : ((f) => f),
22
+ rootDir: remotionRoot,
22
23
  };
23
- const [hash] = bundler_1.BundlerInternals.getConfig('', fullPath, onProgress, options);
24
- const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production', hash);
24
+ const [hash] = bundler_1.BundlerInternals.getConfig({
25
+ outDir: '',
26
+ entryPoint: fullPath,
27
+ onProgressUpdate: onProgress,
28
+ options,
29
+ resolvedRemotionRoot: remotionRoot,
30
+ });
31
+ const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists(remotionRoot, 'production', hash);
25
32
  if (cacheExistedBefore !== 'does-not-exist' && !shouldCache) {
26
33
  log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
27
- await bundler_1.BundlerInternals.clearCache();
34
+ await bundler_1.BundlerInternals.clearCache(remotionRoot);
28
35
  }
29
36
  if (cacheExistedBefore === 'other-exists' && shouldCache) {
30
37
  log_1.Log.info('🧹 Webpack config change detected. Clearing cache... ');
31
- await bundler_1.BundlerInternals.clearCache();
38
+ await bundler_1.BundlerInternals.clearCache(remotionRoot);
32
39
  }
33
40
  const bundleStartTime = Date.now();
34
41
  const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
@@ -45,7 +52,7 @@ const bundleOnCli = async ({ fullPath, steps, }) => {
45
52
  doneIn: Date.now() - bundleStartTime,
46
53
  }) + '\n');
47
54
  log_1.Log.verbose('Bundled under', bundled);
48
- const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production', hash) === 'exists';
55
+ const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists(remotionRoot, 'production', hash) === 'exists';
49
56
  if (cacheExistedAfter) {
50
57
  if (cacheExistedBefore === 'does-not-exist' ||
51
58
  cacheExistedBefore === 'other-exists') {
package/dist/still.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const still: () => Promise<void>;
1
+ export declare const still: (remotionRoot: string) => Promise<void>;
package/dist/still.js CHANGED
@@ -7,8 +7,8 @@ exports.still = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
8
  const fs_1 = require("fs");
9
9
  const path_1 = __importDefault(require("path"));
10
- const remotion_1 = require("remotion");
11
10
  const chalk_1 = require("./chalk");
11
+ const config_1 = require("./config");
12
12
  const get_cli_options_1 = require("./get-cli-options");
13
13
  const get_composition_id_1 = require("./get-composition-id");
14
14
  const initialize_render_cli_1 = require("./initialize-render-cli");
@@ -16,54 +16,67 @@ const log_1 = require("./log");
16
16
  const parse_command_line_1 = require("./parse-command-line");
17
17
  const progress_bar_1 = require("./progress-bar");
18
18
  const setup_cache_1 = require("./setup-cache");
19
+ const truthy_1 = require("./truthy");
19
20
  const user_passed_output_location_1 = require("./user-passed-output-location");
20
- const still = async () => {
21
+ const still = async (remotionRoot) => {
21
22
  const startTime = Date.now();
22
23
  const file = parse_command_line_1.parsedCli._[1];
23
24
  const fullPath = renderer_1.RenderInternals.isServeUrl(file)
24
25
  ? file
25
26
  : path_1.default.join(process.cwd(), file);
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.');
30
- remotion_1.Config.Rendering.setImageFormat('jpeg');
27
+ await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'still');
28
+ const userPassedOutput = (0, user_passed_output_location_1.getUserPassedOutputLocation)();
29
+ if ((userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpeg')) ||
30
+ (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpg'))) {
31
+ log_1.Log.verbose('Output file has a JPEG extension, setting the image format to JPEG.');
32
+ config_1.Config.Rendering.setImageFormat('jpeg');
31
33
  }
32
- if (userOutput.endsWith('.png')) {
33
- log_1.Log.verbose('Output file has a PNG extension, therefore setting the image format to PNG.');
34
- remotion_1.Config.Rendering.setImageFormat('png');
34
+ if (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.png')) {
35
+ log_1.Log.verbose('Output file has a PNG extension, setting the image format to PNG.');
36
+ config_1.Config.Rendering.setImageFormat('png');
35
37
  }
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' });
38
+ const { inputProps, envVariables, quality, browser, imageFormat, stillFrame, browserExecutable, chromiumOptions, scale, ffmpegExecutable, ffprobeExecutable, overwrite, puppeteerTimeout, port, } = await (0, get_cli_options_1.getCliOptions)({
39
+ isLambda: false,
40
+ type: 'still',
41
+ });
37
42
  log_1.Log.verbose('Browser executable: ', browserExecutable);
43
+ const compositionId = (0, get_composition_id_1.getCompositionId)();
44
+ const relativeOutputLocation = (0, user_passed_output_location_1.getOutputLocation)({
45
+ compositionId,
46
+ defaultExtension: imageFormat,
47
+ });
48
+ const absoluteOutputLocation = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
49
+ log_1.Log.info(chalk_1.chalk.gray(`Output = ${relativeOutputLocation}, Format = ${imageFormat}, Composition = ${compositionId}`));
38
50
  if (imageFormat === 'none') {
39
51
  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
52
  process.exit(1);
41
53
  }
42
- if (imageFormat === 'png' && !userOutput.endsWith('.png')) {
43
- log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${userOutput}`);
54
+ if (imageFormat === 'png' && !absoluteOutputLocation.endsWith('.png')) {
55
+ log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${absoluteOutputLocation}`);
44
56
  }
45
57
  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}`);
58
+ !absoluteOutputLocation.endsWith('.jpg') &&
59
+ !absoluteOutputLocation.endsWith('.jpeg')) {
60
+ log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${absoluteOutputLocation}`);
49
61
  }
50
62
  const browserInstance = (0, renderer_1.openBrowser)(browser, {
51
63
  browserExecutable,
52
64
  chromiumOptions,
53
- shouldDumpIo: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
65
+ shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
54
66
  forceDeviceScaleFactor: scale,
55
67
  });
56
- (0, fs_1.mkdirSync)(path_1.default.join(userOutput, '..'), {
68
+ (0, fs_1.mkdirSync)(path_1.default.join(absoluteOutputLocation, '..'), {
57
69
  recursive: true,
58
70
  });
59
71
  const steps = [
60
72
  renderer_1.RenderInternals.isServeUrl(fullPath) ? null : 'bundling',
61
73
  'rendering',
62
- ].filter(remotion_1.Internals.truthy);
74
+ ].filter(truthy_1.truthy);
63
75
  const urlOrBundle = renderer_1.RenderInternals.isServeUrl(fullPath)
64
76
  ? Promise.resolve(fullPath)
65
- : await (0, setup_cache_1.bundleOnCli)({ fullPath, steps });
77
+ : await (0, setup_cache_1.bundleOnCli)({ fullPath, remotionRoot, steps });
66
78
  const puppeteerInstance = await browserInstance;
79
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
67
80
  const comps = await (0, renderer_1.getCompositions)(await urlOrBundle, {
68
81
  inputProps,
69
82
  puppeteerInstance,
@@ -74,8 +87,8 @@ const still = async () => {
74
87
  browserExecutable,
75
88
  ffmpegExecutable,
76
89
  ffprobeExecutable,
90
+ downloadMap,
77
91
  });
78
- const compositionId = (0, get_composition_id_1.getCompositionId)(comps);
79
92
  const composition = comps.find((c) => c.id === compositionId);
80
93
  if (!composition) {
81
94
  throw new Error(`Cannot find composition with ID ${compositionId}`);
@@ -118,20 +131,22 @@ const still = async () => {
118
131
  await (0, renderer_1.renderStill)({
119
132
  composition,
120
133
  frame: stillFrame,
121
- output: userOutput,
134
+ output: absoluteOutputLocation,
122
135
  serveUrl: await urlOrBundle,
123
136
  quality,
124
- dumpBrowserLogs: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'),
137
+ dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
125
138
  envVariables,
126
139
  imageFormat,
127
140
  inputProps,
128
141
  chromiumOptions,
129
- timeoutInMilliseconds: remotion_1.Internals.getCurrentPuppeteerTimeout(),
142
+ timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
130
143
  scale,
131
144
  ffmpegExecutable,
132
145
  browserExecutable,
133
146
  overwrite,
134
147
  onDownload,
148
+ port,
149
+ downloadMap,
135
150
  });
136
151
  frames = 1;
137
152
  updateProgress();
@@ -145,7 +160,7 @@ const still = async () => {
145
160
  seconds === 1 ? 'second' : 'seconds',
146
161
  ].join(' '));
147
162
  log_1.Log.info('-', 'Output can be found at:');
148
- log_1.Log.info(chalk_1.chalk.cyan(`▶️ ${userOutput}`));
163
+ log_1.Log.info(chalk_1.chalk.cyan(`▶️ ${absoluteOutputLocation}`));
149
164
  await closeBrowserPromise;
150
165
  };
151
166
  exports.still = still;
@@ -0,0 +1,3 @@
1
+ declare type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
2
+ export declare function truthy<T>(value: T): value is Truthy<T>;
3
+ export {};
package/dist/truthy.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.truthy = void 0;
4
+ function truthy(value) {
5
+ return Boolean(value);
6
+ }
7
+ exports.truthy = truthy;
package/dist/upgrade.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const upgrade: () => Promise<void>;
1
+ export declare const upgrade: (remotionRoot: string) => Promise<void>;
package/dist/upgrade.js CHANGED
@@ -5,9 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.upgrade = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
- const fs_1 = __importDefault(require("fs"));
9
8
  const path_1 = __importDefault(require("path"));
10
- const remotion_1 = require("remotion");
9
+ const config_1 = require("./config");
11
10
  const get_latest_remotion_version_1 = require("./get-latest-remotion-version");
12
11
  const log_1 = require("./log");
13
12
  const get_package_manager_1 = require("./preview-server/get-package-manager");
@@ -20,17 +19,13 @@ const getUpgradeCommand = ({ manager, packages, version, }) => {
20
19
  };
21
20
  return commands[manager];
22
21
  };
23
- const upgrade = async () => {
22
+ const upgrade = async (remotionRoot) => {
24
23
  var _a;
25
- const packageJsonFilePath = path_1.default.join(process.cwd(), 'package.json');
26
- if (!fs_1.default.existsSync(packageJsonFilePath)) {
27
- log_1.Log.error('Could not upgrade because no package.json could be found in your project.');
28
- process.exit(1);
29
- }
24
+ const packageJsonFilePath = path_1.default.join(remotionRoot, 'package.json');
30
25
  const packageJson = require(packageJsonFilePath);
31
26
  const dependencies = Object.keys(packageJson.dependencies);
32
27
  const latestRemotionVersion = await (0, get_latest_remotion_version_1.getLatestRemotionVersion)();
33
- const manager = (0, get_package_manager_1.getPackageManager)();
28
+ const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot);
34
29
  if (manager === 'unknown') {
35
30
  throw new Error(`No lockfile was found in your project (one of ${get_package_manager_1.lockFilePaths
36
31
  .map((p) => p.path)
@@ -57,7 +52,7 @@ const upgrade = async () => {
57
52
  }), {
58
53
  stdio: 'inherit',
59
54
  });
60
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'info')) {
55
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'info')) {
61
56
  (_a = prom.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout);
62
57
  }
63
58
  await prom;
@@ -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 config_1 = require("./config");
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
+ : config_1.ConfigInternals.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;
@@ -1,3 +1,3 @@
1
1
  export declare const VERSIONS_COMMAND = "versions";
2
- export declare const validateVersionsBeforeCommand: () => Promise<void>;
3
- export declare const versionsCommand: () => Promise<void>;
2
+ export declare const validateVersionsBeforeCommand: (remotionRoot: string) => Promise<void>;
3
+ export declare const versionsCommand: (remotionRoot: string) => Promise<void>;
package/dist/versions.js CHANGED
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.versionsCommand = exports.validateVersionsBeforeCommand = exports.VERSIONS_COMMAND = void 0;
7
+ const renderer_1 = require("@remotion/renderer");
7
8
  const fs_1 = __importDefault(require("fs"));
8
- const remotion_1 = require("remotion");
9
+ const config_1 = require("./config");
9
10
  const log_1 = require("./log");
10
11
  const parse_command_line_1 = require("./parse-command-line");
11
12
  const resolve_from_1 = require("./resolve-from");
@@ -23,9 +24,9 @@ const packages = [
23
24
  '@remotion/gif',
24
25
  'remotion',
25
26
  ];
26
- const getVersion = async (p) => {
27
+ const getVersion = async (remotionRoot, p) => {
27
28
  try {
28
- const remotionPkgJson = (0, resolve_from_1.resolveFrom)(process.cwd(), `${p}/package.json`);
29
+ const remotionPkgJson = (0, resolve_from_1.resolveFrom)(remotionRoot, `${p}/package.json`);
29
30
  const file = await fs_1.default.promises.readFile(remotionPkgJson, 'utf-8');
30
31
  const packageJson = JSON.parse(file);
31
32
  return packageJson.version;
@@ -44,12 +45,12 @@ const groupBy = (vals) => {
44
45
  }
45
46
  return groups;
46
47
  };
47
- const getAllVersions = async () => {
48
- return (await Promise.all(packages.map(async (p) => [p, await getVersion(p)]))).filter(([, version]) => version);
48
+ const getAllVersions = async (remotionRoot) => {
49
+ return (await Promise.all(packages.map(async (p) => [p, await getVersion(remotionRoot, p)]))).filter(([, version]) => version);
49
50
  };
50
51
  exports.VERSIONS_COMMAND = 'versions';
51
- const validateVersionsBeforeCommand = async () => {
52
- const versions = await getAllVersions();
52
+ const validateVersionsBeforeCommand = async (remotionRoot) => {
53
+ const versions = await getAllVersions(remotionRoot);
53
54
  const grouped = groupBy(versions);
54
55
  const installedVersions = Object.keys(grouped);
55
56
  if (installedVersions.length === 1) {
@@ -72,16 +73,16 @@ const validateVersionsBeforeCommand = async () => {
72
73
  log_1.Log.warn('To resolve:');
73
74
  log_1.Log.warn('- Make sure your package.json has all Remotion packages pointing to the same version.');
74
75
  log_1.Log.warn('- Remove the `^` character in front of a version to pin a package.');
75
- if (!remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose')) {
76
+ if (!renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose')) {
76
77
  log_1.Log.warn('- Run `npx remotion versions --log=verbose` to see the path of the modules resolved.');
77
78
  }
78
79
  log_1.Log.warn('-------------');
79
80
  log_1.Log.info();
80
81
  };
81
82
  exports.validateVersionsBeforeCommand = validateVersionsBeforeCommand;
82
- const versionsCommand = async () => {
83
+ const versionsCommand = async (remotionRoot) => {
83
84
  (0, parse_command_line_1.parseCommandLine)('versions');
84
- const versions = await getAllVersions();
85
+ const versions = await getAllVersions(remotionRoot);
85
86
  const grouped = groupBy(versions);
86
87
  const installedVersions = Object.keys(grouped);
87
88
  log_1.Log.info(`Node.JS = ${process.version}, OS = ${process.platform}`);
@@ -90,7 +91,7 @@ const versionsCommand = async () => {
90
91
  log_1.Log.info(`On version: ${version}`);
91
92
  for (const pkg of grouped[version]) {
92
93
  log_1.Log.info(`- ${pkg}`);
93
- log_1.Log.verbose(` ${(0, resolve_from_1.resolveFrom)(process.cwd(), `${pkg}/package.json`)}`);
94
+ log_1.Log.verbose(` ${(0, resolve_from_1.resolveFrom)(remotionRoot, `${pkg}/package.json`)}`);
94
95
  }
95
96
  log_1.Log.info();
96
97
  }
@@ -101,7 +102,7 @@ const versionsCommand = async () => {
101
102
  log_1.Log.error('Version mismatch: Not all Remotion packages have the same version.');
102
103
  log_1.Log.info('- Make sure your package.json has all Remotion packages pointing to the same version.');
103
104
  log_1.Log.info('- Remove the `^` character in front of a version to pin a package.');
104
- if (!remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose')) {
105
+ if (!renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose')) {
105
106
  log_1.Log.info('- Rerun this command with --log=verbose to see the path of the modules resolved.');
106
107
  }
107
108
  process.exit(1);
@@ -6,7 +6,7 @@ declare global {
6
6
  }
7
7
  }
8
8
  }
9
- export declare const clearCache: (environment: Environment, inputProps: object | null) => Promise<void>;
9
+ export declare const clearCache: (remotionRoot: string, environment: Environment, inputProps: object | null) => Promise<void>;
10
10
  export declare const getWebpackCacheName: (environment: Environment, inputProps: object | null) => string;
11
- export declare const cacheExists: (environment: Environment, inputProps: object | null) => boolean;
11
+ export declare const cacheExists: (remotionRoot: string, environment: Environment, inputProps: object | null) => boolean;
12
12
  export {};
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ // eslint-disable-next-line no-restricted-imports
9
10
  const remotion_1 = require("remotion");
10
11
  // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
11
12
  // An algorithm to determine where Webpack will cache the depencies
12
- const getWebpackCacheDir = () => {
13
- const cwd = process.cwd();
14
- let dir = cwd;
13
+ const getWebpackCacheDir = (remotionRoot) => {
14
+ let dir = remotionRoot;
15
15
  for (;;) {
16
16
  try {
17
17
  if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
@@ -28,7 +28,7 @@ const getWebpackCacheDir = () => {
28
28
  dir = parent;
29
29
  }
30
30
  if (!dir) {
31
- return path_1.default.resolve(cwd, '.cache/webpack');
31
+ return path_1.default.resolve(remotionRoot, '.cache/webpack');
32
32
  }
33
33
  if (process.versions.pnp === '1') {
34
34
  return path_1.default.resolve(dir, '.pnp/.cache/webpack');
@@ -38,12 +38,12 @@ const getWebpackCacheDir = () => {
38
38
  }
39
39
  return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
40
40
  };
41
- const remotionCacheLocation = (environment, inputProps) => {
42
- return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
41
+ const remotionCacheLocation = (remotionRoot, environment, inputProps) => {
42
+ return path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheName)(environment, inputProps));
43
43
  };
44
- const clearCache = (environment, inputProps) => {
44
+ const clearCache = (remotionRoot, environment, inputProps) => {
45
45
  var _a;
46
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
46
+ return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(remotionRoot, environment, inputProps), {
47
47
  recursive: true,
48
48
  });
49
49
  };
@@ -60,7 +60,7 @@ const getWebpackCacheName = (environment, inputProps) => {
60
60
  return `remotion-v3-${environment}`;
61
61
  };
62
62
  exports.getWebpackCacheName = getWebpackCacheName;
63
- const cacheExists = (environment, inputProps) => {
64
- return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
63
+ const cacheExists = (remotionRoot, environment, inputProps) => {
64
+ return fs_1.default.existsSync(remotionCacheLocation(remotionRoot, environment, inputProps));
65
65
  };
66
66
  exports.cacheExists = cacheExists;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.1.4",
3
+ "version": "3.1.7",
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.4",
27
- "@remotion/media-utils": "3.1.4",
28
- "@remotion/player": "3.1.4",
29
- "@remotion/renderer": "3.1.4",
26
+ "@remotion/bundler": "3.1.7",
27
+ "@remotion/media-utils": "3.1.7",
28
+ "@remotion/player": "3.1.7",
29
+ "@remotion/renderer": "3.1.7",
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.4",
34
+ "remotion": "3.1.7",
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": "cb662e72c635e5e70c5541d85e276ce2f4075099"
74
+ "gitHead": "599379fef6043a7125d1979766f915580ec1cf77"
75
75
  }
@@ -1,2 +0,0 @@
1
- import { RenderStep } from './step';
2
- export declare const bundleOnCli: (fullPath: string, steps: RenderStep[]) => Promise<string>;