@remotion/cli 3.1.6 → 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 (126) hide show
  1. package/dist/code-frame.js +3 -3
  2. package/dist/compositions.d.ts +1 -1
  3. package/dist/compositions.js +9 -3
  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 +4 -5
  73. package/dist/get-cli-options.js +35 -32
  74. package/dist/get-config-file-name.d.ts +1 -1
  75. package/dist/get-config-file-name.js +9 -6
  76. package/dist/get-env.js +6 -4
  77. package/dist/get-filename.d.ts +1 -1
  78. package/dist/get-final-output-codec.d.ts +6 -0
  79. package/dist/get-final-output-codec.js +63 -0
  80. package/dist/image-formats.d.ts +3 -3
  81. package/dist/image-formats.js +4 -3
  82. package/dist/index.d.ts +10 -8
  83. package/dist/index.js +17 -9
  84. package/dist/initialize-render-cli.d.ts +1 -1
  85. package/dist/initialize-render-cli.js +8 -3
  86. package/dist/lambda-command.d.ts +1 -1
  87. package/dist/lambda-command.js +4 -4
  88. package/dist/load-config.d.ts +1 -1
  89. package/dist/load-config.js +16 -5
  90. package/dist/log.js +7 -6
  91. package/dist/parse-command-line.d.ts +1 -1
  92. package/dist/parse-command-line.js +31 -30
  93. package/dist/preview-server/error-overlay/react-overlay/effects/map-error-to-react-stack.js +2 -2
  94. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.d.ts +1 -1
  95. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +3 -3
  96. package/dist/preview-server/get-package-manager.d.ts +1 -1
  97. package/dist/preview-server/get-package-manager.js +2 -2
  98. package/dist/preview-server/project-info.d.ts +1 -1
  99. package/dist/preview-server/project-info.js +3 -3
  100. package/dist/preview-server/routes.d.ts +2 -1
  101. package/dist/preview-server/routes.js +28 -17
  102. package/dist/preview-server/start-server.d.ts +1 -0
  103. package/dist/preview-server/start-server.js +4 -2
  104. package/dist/preview-server/update-available.d.ts +1 -1
  105. package/dist/preview-server/update-available.js +8 -5
  106. package/dist/preview.d.ts +1 -1
  107. package/dist/preview.js +5 -4
  108. package/dist/previewEntry.js +1 -0
  109. package/dist/progress-bar.d.ts +1 -2
  110. package/dist/progress-bar.js +5 -4
  111. package/dist/render.d.ts +1 -1
  112. package/dist/render.js +17 -10
  113. package/dist/setup-cache.d.ts +2 -1
  114. package/dist/setup-cache.js +16 -9
  115. package/dist/still.d.ts +1 -1
  116. package/dist/still.js +15 -10
  117. package/dist/truthy.d.ts +3 -0
  118. package/dist/truthy.js +7 -0
  119. package/dist/upgrade.d.ts +1 -1
  120. package/dist/upgrade.js +5 -10
  121. package/dist/user-passed-output-location.js +2 -2
  122. package/dist/versions.d.ts +2 -2
  123. package/dist/versions.js +13 -12
  124. package/dist/webpack-cache.d.ts +2 -2
  125. package/dist/webpack-cache.js +10 -10
  126. package/package.json +7 -7
@@ -7,14 +7,15 @@ 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
- const remotion_1 = require("remotion");
10
+ const config_1 = require("./config");
11
11
  const get_env_1 = require("./get-env");
12
+ const get_final_output_codec_1 = require("./get-final-output-codec");
12
13
  const get_input_props_1 = require("./get-input-props");
13
14
  const image_formats_1 = require("./image-formats");
14
15
  const log_1 = require("./log");
15
16
  const user_passed_output_location_1 = require("./user-passed-output-location");
16
17
  const getAndValidateFrameRange = () => {
17
- const frameRange = remotion_1.Internals.getRange();
18
+ const frameRange = config_1.ConfigInternals.getRange();
18
19
  if (typeof frameRange === 'number') {
19
20
  log_1.Log.warn('Selected a single frame. Assuming you want to output an image.');
20
21
  log_1.Log.warn(`If you want to render a video, pass a range: '--frames=${frameRange}-${frameRange}'.`);
@@ -23,15 +24,15 @@ const getAndValidateFrameRange = () => {
23
24
  return frameRange;
24
25
  };
25
26
  const getFinalCodec = async (options) => {
26
- const userCodec = remotion_1.Internals.getOutputCodecOrUndefined();
27
- const codec = remotion_1.Internals.getFinalOutputCodec({
27
+ const userCodec = config_1.ConfigInternals.getOutputCodecOrUndefined();
28
+ const codec = (0, get_final_output_codec_1.getFinalOutputCodec)({
28
29
  codec: userCodec,
29
30
  fileExtension: options.isLambda
30
31
  ? null
31
32
  : renderer_1.RenderInternals.getExtensionOfFilename((0, user_passed_output_location_1.getUserPassedOutputLocation)()),
32
33
  emitWarning: true,
33
34
  });
34
- const ffmpegExecutable = remotion_1.Internals.getCustomFfmpegExecutable();
35
+ const ffmpegExecutable = config_1.ConfigInternals.getCustomFfmpegExecutable();
35
36
  if (codec === 'vp8' &&
36
37
  !(await renderer_1.RenderInternals.ffmpegHasFeature({
37
38
  feature: 'enable-libvpx',
@@ -61,7 +62,7 @@ const getFinalCodec = async (options) => {
61
62
  }
62
63
  return codec;
63
64
  };
64
- const getBrowser = () => { var _a; return (_a = remotion_1.Internals.getBrowser()) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_BROWSER; };
65
+ const getBrowser = () => { var _a; return (_a = config_1.ConfigInternals.getBrowser()) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.DEFAULT_BROWSER; };
65
66
  const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite) => {
66
67
  const absoluteOutputFile = path_1.default.resolve(process.cwd(), relativeOutputLocation);
67
68
  if (fs_1.default.existsSync(absoluteOutputFile) && !overwrite) {
@@ -72,33 +73,35 @@ const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite) =>
72
73
  };
73
74
  exports.getAndValidateAbsoluteOutputFile = getAndValidateAbsoluteOutputFile;
74
75
  const getAndValidateShouldOutputImageSequence = async ({ frameRange, isLambda, }) => {
75
- const shouldOutputImageSequence = remotion_1.Internals.getShouldOutputImageSequence(frameRange);
76
+ const shouldOutputImageSequence = config_1.ConfigInternals.getShouldOutputImageSequence(frameRange);
76
77
  // When parsing options locally, we don't need FFMPEG because the render will happen on Lambda
77
78
  if (!shouldOutputImageSequence && !isLambda) {
78
- await renderer_1.RenderInternals.validateFfmpeg(remotion_1.Internals.getCustomFfmpegExecutable());
79
+ await renderer_1.RenderInternals.validateFfmpeg(config_1.ConfigInternals.getCustomFfmpegExecutable());
79
80
  }
80
81
  return shouldOutputImageSequence;
81
82
  };
82
83
  const getAndValidateCrf = (shouldOutputImageSequence, codec) => {
83
- const crf = shouldOutputImageSequence ? null : remotion_1.Internals.getActualCrf(codec);
84
+ const crf = shouldOutputImageSequence
85
+ ? null
86
+ : config_1.ConfigInternals.getActualCrf(codec);
84
87
  if (crf !== null) {
85
- remotion_1.Internals.validateSelectedCrfAndCodecCombination(crf, codec);
88
+ renderer_1.RenderInternals.validateSelectedCrfAndCodecCombination(crf, codec);
86
89
  }
87
90
  return crf;
88
91
  };
89
92
  const getAndValidatePixelFormat = (codec) => {
90
- const pixelFormat = remotion_1.Internals.getPixelFormat();
91
- remotion_1.Internals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
93
+ const pixelFormat = config_1.ConfigInternals.getPixelFormat();
94
+ renderer_1.RenderInternals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
92
95
  return pixelFormat;
93
96
  };
94
97
  const getAndValidateProResProfile = (actualCodec) => {
95
- const proResProfile = remotion_1.Internals.getProResProfile();
96
- remotion_1.Internals.validateSelectedCodecAndProResCombination(actualCodec, proResProfile);
98
+ const proResProfile = config_1.ConfigInternals.getProResProfile();
99
+ renderer_1.RenderInternals.validateSelectedCodecAndProResCombination(actualCodec, proResProfile);
97
100
  return proResProfile;
98
101
  };
99
102
  const getAndValidateImageFormat = ({ shouldOutputImageSequence, codec, pixelFormat, }) => {
100
103
  const imageFormat = (0, image_formats_1.getImageFormat)(shouldOutputImageSequence ? undefined : codec);
101
- remotion_1.Internals.validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
104
+ renderer_1.RenderInternals.validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
102
105
  return imageFormat;
103
106
  };
104
107
  const getAndValidateBrowser = async (browserExecutable) => {
@@ -127,7 +130,7 @@ const getCliOptions = async (options) => {
127
130
  frameRange,
128
131
  isLambda: options.isLambda,
129
132
  });
130
- const overwrite = remotion_1.Internals.getShouldOverwrite();
133
+ const overwrite = config_1.ConfigInternals.getShouldOverwrite();
131
134
  const crf = getAndValidateCrf(shouldOutputImageSequence, codec);
132
135
  const pixelFormat = getAndValidatePixelFormat(codec);
133
136
  const imageFormat = getAndValidateImageFormat({
@@ -136,30 +139,30 @@ const getCliOptions = async (options) => {
136
139
  pixelFormat,
137
140
  });
138
141
  const proResProfile = getAndValidateProResProfile(codec);
139
- const browserExecutable = remotion_1.Internals.getBrowserExecutable();
140
- const ffmpegExecutable = remotion_1.Internals.getCustomFfmpegExecutable();
141
- const ffprobeExecutable = remotion_1.Internals.getCustomFfprobeExecutable();
142
- const scale = remotion_1.Internals.getScale();
143
- const port = remotion_1.Internals.getServerPort();
142
+ const browserExecutable = config_1.ConfigInternals.getBrowserExecutable();
143
+ const ffmpegExecutable = config_1.ConfigInternals.getCustomFfmpegExecutable();
144
+ const ffprobeExecutable = config_1.ConfigInternals.getCustomFfprobeExecutable();
145
+ const scale = config_1.ConfigInternals.getScale();
146
+ const port = config_1.ConfigInternals.getServerPort();
144
147
  const chromiumOptions = {
145
- disableWebSecurity: remotion_1.Internals.getChromiumDisableWebSecurity(),
146
- ignoreCertificateErrors: remotion_1.Internals.getIgnoreCertificateErrors(),
147
- headless: remotion_1.Internals.getChromiumHeadlessMode(),
148
- gl: (_a = remotion_1.Internals.getChromiumOpenGlRenderer()) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_OPENGL_RENDERER,
148
+ disableWebSecurity: config_1.ConfigInternals.getChromiumDisableWebSecurity(),
149
+ ignoreCertificateErrors: config_1.ConfigInternals.getIgnoreCertificateErrors(),
150
+ headless: config_1.ConfigInternals.getChromiumHeadlessMode(),
151
+ gl: (_a = config_1.ConfigInternals.getChromiumOpenGlRenderer()) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.DEFAULT_OPENGL_RENDERER,
149
152
  };
150
- const everyNthFrame = remotion_1.Internals.getAndValidateEveryNthFrame(codec);
151
- const numberOfGifLoops = remotion_1.Internals.getAndValidateNumberOfGifLoops(codec);
152
- const parallelism = remotion_1.Internals.getConcurrency();
153
+ const everyNthFrame = config_1.ConfigInternals.getAndValidateEveryNthFrame(codec);
154
+ const numberOfGifLoops = config_1.ConfigInternals.getAndValidateNumberOfGifLoops(codec);
155
+ const parallelism = config_1.ConfigInternals.getConcurrency();
153
156
  renderer_1.RenderInternals.validateConcurrency(parallelism, 'concurrency');
154
157
  return {
155
- puppeteerTimeout: remotion_1.Internals.getCurrentPuppeteerTimeout(),
158
+ puppeteerTimeout: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
156
159
  parallelism,
157
160
  frameRange,
158
161
  shouldOutputImageSequence,
159
162
  codec,
160
163
  inputProps: (0, get_input_props_1.getInputProps)(() => undefined),
161
164
  envVariables: await (0, get_env_1.getEnvironmentVariables)(),
162
- quality: remotion_1.Internals.getQuality(),
165
+ quality: config_1.ConfigInternals.getQuality(),
163
166
  browser: await getAndValidateBrowser(browserExecutable),
164
167
  crf,
165
168
  pixelFormat,
@@ -167,11 +170,11 @@ const getCliOptions = async (options) => {
167
170
  proResProfile,
168
171
  everyNthFrame,
169
172
  numberOfGifLoops,
170
- stillFrame: remotion_1.Internals.getStillFrame(),
173
+ stillFrame: config_1.ConfigInternals.getStillFrame(),
171
174
  browserExecutable,
172
175
  ffmpegExecutable,
173
176
  ffprobeExecutable,
174
- logLevel: remotion_1.Internals.Logging.getLogLevel(),
177
+ logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
175
178
  scale,
176
179
  chromiumOptions,
177
180
  overwrite,
@@ -1,3 +1,3 @@
1
1
  export declare const defaultConfigFileJavascript = "remotion.config.js";
2
2
  export declare const defaultConfigFileTypescript = "remotion.config.ts";
3
- export declare const loadConfig: () => Promise<string | null>;
3
+ export declare const loadConfig: (remotionRoot: string) => Promise<string | null>;
@@ -11,20 +11,23 @@ const log_1 = require("./log");
11
11
  const parse_command_line_1 = require("./parse-command-line");
12
12
  exports.defaultConfigFileJavascript = 'remotion.config.js';
13
13
  exports.defaultConfigFileTypescript = 'remotion.config.ts';
14
- const loadConfig = () => {
14
+ const loadConfig = (remotionRoot) => {
15
15
  if (parse_command_line_1.parsedCli.config) {
16
16
  const fullPath = path_1.default.resolve(process.cwd(), parse_command_line_1.parsedCli.config);
17
17
  if (!(0, fs_1.existsSync)(fullPath)) {
18
18
  log_1.Log.error(`You specified a config file location of "${parse_command_line_1.parsedCli.config}" but no file under ${fullPath} was found.`);
19
19
  process.exit(1);
20
20
  }
21
- return (0, load_config_1.loadConfigFile)(parse_command_line_1.parsedCli.config, fullPath.endsWith('.js'));
21
+ return (0, load_config_1.loadConfigFile)(remotionRoot, parse_command_line_1.parsedCli.config, fullPath.endsWith('.js'));
22
22
  }
23
- if ((0, fs_1.existsSync)(path_1.default.resolve(process.cwd(), exports.defaultConfigFileTypescript))) {
24
- return (0, load_config_1.loadConfigFile)(exports.defaultConfigFileTypescript, false);
23
+ if (remotionRoot === null) {
24
+ return Promise.resolve(null);
25
25
  }
26
- if ((0, fs_1.existsSync)(path_1.default.resolve(process.cwd(), exports.defaultConfigFileJavascript))) {
27
- return (0, load_config_1.loadConfigFile)(exports.defaultConfigFileJavascript, true);
26
+ if ((0, fs_1.existsSync)(path_1.default.resolve(remotionRoot, exports.defaultConfigFileTypescript))) {
27
+ return (0, load_config_1.loadConfigFile)(remotionRoot, exports.defaultConfigFileTypescript, false);
28
+ }
29
+ if ((0, fs_1.existsSync)(path_1.default.resolve(remotionRoot, exports.defaultConfigFileJavascript))) {
30
+ return (0, load_config_1.loadConfigFile)(remotionRoot, exports.defaultConfigFileJavascript, true);
28
31
  }
29
32
  return Promise.resolve(null);
30
33
  };
package/dist/get-env.js CHANGED
@@ -7,7 +7,8 @@ exports.getEnvironmentVariables = void 0;
7
7
  const dotenv_1 = __importDefault(require("dotenv"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
- const remotion_1 = require("remotion");
10
+ const config_1 = require("./config");
11
+ const find_closest_package_json_1 = require("./find-closest-package-json");
11
12
  const log_1 = require("./log");
12
13
  const parse_command_line_1 = require("./parse-command-line");
13
14
  function getProcessEnv() {
@@ -44,9 +45,10 @@ const getEnvironmentVariables = () => {
44
45
  }
45
46
  return getEnvForEnvFile(processEnv, envFile);
46
47
  }
47
- const configFileSetting = remotion_1.Internals.getDotEnvLocation();
48
+ const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
49
+ const configFileSetting = config_1.ConfigInternals.getDotEnvLocation();
48
50
  if (configFileSetting) {
49
- const envFile = path_1.default.resolve(process.cwd(), configFileSetting);
51
+ const envFile = path_1.default.resolve(remotionRoot, configFileSetting);
50
52
  if (!fs_1.default.existsSync(envFile)) {
51
53
  log_1.Log.error('You specifed a custom .env file using `Config.Rendering.setDotEnvLocation()` in the config file but it could not be found');
52
54
  log_1.Log.error('We looked for the file at:', envFile);
@@ -55,7 +57,7 @@ const getEnvironmentVariables = () => {
55
57
  }
56
58
  return getEnvForEnvFile(processEnv, envFile);
57
59
  }
58
- const defaultEnvFile = path_1.default.resolve(process.cwd(), '.env');
60
+ const defaultEnvFile = path_1.default.resolve(remotionRoot, '.env');
59
61
  if (!fs_1.default.existsSync(defaultEnvFile)) {
60
62
  return Promise.resolve(processEnv);
61
63
  }
@@ -1,4 +1,4 @@
1
- import type { Codec } from 'remotion';
1
+ import type { Codec } from '@remotion/renderer';
2
2
  export declare const getOutputFilename: ({ codec, imageSequence, compositionName, defaultExtension, }: {
3
3
  codec: Codec;
4
4
  imageSequence: boolean;
@@ -0,0 +1,6 @@
1
+ import type { Codec, CodecOrUndefined } from '@remotion/renderer';
2
+ export declare const getFinalOutputCodec: ({ codec: inputCodec, fileExtension, emitWarning, }: {
3
+ codec: CodecOrUndefined;
4
+ fileExtension: string | null;
5
+ emitWarning: boolean;
6
+ }) => Codec;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFinalOutputCodec = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const log_1 = require("./log");
6
+ const getFinalOutputCodec = ({ codec: inputCodec, fileExtension, emitWarning, }) => {
7
+ if (inputCodec === undefined && fileExtension === 'webm') {
8
+ if (emitWarning) {
9
+ log_1.Log.info('You have specified a .webm extension, using the VP8 encoder. Use --codec=vp9 to use the Vp9 encoder.');
10
+ }
11
+ return 'vp8';
12
+ }
13
+ if (inputCodec === undefined && fileExtension === 'hevc') {
14
+ if (emitWarning) {
15
+ log_1.Log.info('You have specified a .hevc extension, using the H265 encoder.');
16
+ }
17
+ return 'h265';
18
+ }
19
+ if (inputCodec === undefined && fileExtension === 'mp3') {
20
+ if (emitWarning) {
21
+ log_1.Log.info('You have specified a .mp3 extension, using the MP3 encoder.');
22
+ }
23
+ return 'mp3';
24
+ }
25
+ if (inputCodec === undefined && fileExtension === 'mov') {
26
+ if (emitWarning) {
27
+ log_1.Log.info('You have specified a .mov extension, using the Apple ProRes encoder.');
28
+ }
29
+ return 'prores';
30
+ }
31
+ if (inputCodec === undefined && fileExtension === 'wav') {
32
+ if (emitWarning) {
33
+ log_1.Log.info('You have specified a .wav extension, using the WAV encoder.');
34
+ }
35
+ return 'wav';
36
+ }
37
+ if (inputCodec === undefined && fileExtension === 'aac') {
38
+ if (emitWarning) {
39
+ log_1.Log.info('You have specified a .aac extension, using the AAC encoder.');
40
+ }
41
+ return 'aac';
42
+ }
43
+ if (inputCodec === undefined && fileExtension === 'm4a') {
44
+ if (emitWarning) {
45
+ log_1.Log.info('You have specified a .m4a extension, using the AAC encoder.');
46
+ }
47
+ return 'aac';
48
+ }
49
+ if (inputCodec === undefined && fileExtension === 'mkv') {
50
+ if (emitWarning) {
51
+ log_1.Log.info('You have specified a .mkv extension, using the H264 encoder and WAV audio format.');
52
+ }
53
+ return 'h264-mkv';
54
+ }
55
+ if (inputCodec === undefined && fileExtension === 'gif') {
56
+ if (emitWarning) {
57
+ log_1.Log.info('You have specified a .gif extension, rendering a GIF');
58
+ }
59
+ return 'gif';
60
+ }
61
+ return inputCodec !== null && inputCodec !== void 0 ? inputCodec : renderer_1.RenderInternals.DEFAULT_CODEC;
62
+ };
63
+ exports.getFinalOutputCodec = getFinalOutputCodec;
@@ -1,3 +1,3 @@
1
- import type { ImageFormat } from 'remotion';
2
- import { Internals } from 'remotion';
3
- export declare const getImageFormat: (codec: ReturnType<typeof Internals.getOutputCodecOrUndefined>) => ImageFormat;
1
+ import type { ImageFormat } from '@remotion/renderer';
2
+ import { ConfigInternals } from './config';
3
+ export declare const getImageFormat: (codec: ReturnType<typeof ConfigInternals.getOutputCodecOrUndefined>) => ImageFormat;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getImageFormat = void 0;
4
- const remotion_1 = require("remotion");
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const config_1 = require("./config");
5
6
  const getImageFormat = (codec) => {
6
- const userPreferred = remotion_1.Internals.getUserPreferredImageFormat();
7
+ const userPreferred = config_1.ConfigInternals.getUserPreferredImageFormat();
7
8
  if (typeof userPreferred !== 'undefined') {
8
9
  return userPreferred;
9
10
  }
10
- if (remotion_1.Internals.isAudioCodec(codec)) {
11
+ if (renderer_1.RenderInternals.isAudioCodec(codec)) {
11
12
  return 'none';
12
13
  }
13
14
  if (codec === 'h264' ||
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="minimist" />
2
2
  export declare const cli: () => Promise<void>;
3
+ export { ConfigInternals, overrideRemotion } from './config/index';
3
4
  export * from './render';
4
5
  export declare const CliInternals: {
5
6
  createOverwriteableCliOutput: (quiet: boolean) => {
@@ -65,20 +66,20 @@ export declare const CliInternals: {
65
66
  warn: (message?: any, ...optionalParams: any[]) => void;
66
67
  error: (message?: any, ...optionalParams: any[]) => void;
67
68
  };
68
- loadConfigFile: (configFileName: string, isJavascript: boolean) => Promise<string | null>;
69
+ loadConfigFile: (remotionRoot: string, configFileName: string, isJavascript: boolean) => Promise<string | null>;
69
70
  getCliOptions: (options: {
70
71
  isLambda: boolean;
71
72
  type: "still" | "series" | "get-compositions";
72
73
  }) => Promise<{
73
74
  puppeteerTimeout: number;
74
75
  parallelism: number | null;
75
- frameRange: import("remotion").FrameRange | null;
76
+ frameRange: import("@remotion/renderer").FrameRange | null;
76
77
  shouldOutputImageSequence: boolean;
77
78
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
78
79
  inputProps: object;
79
80
  envVariables: Record<string, string>;
80
81
  quality: number | undefined;
81
- browser: import("remotion").Browser;
82
+ browser: import("@remotion/renderer").Browser;
82
83
  crf: number | null;
83
84
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
84
85
  imageFormat: "png" | "jpeg" | "none";
@@ -86,9 +87,9 @@ export declare const CliInternals: {
86
87
  everyNthFrame: number;
87
88
  numberOfGifLoops: number | null;
88
89
  stillFrame: number;
89
- browserExecutable: import("remotion").BrowserExecutable;
90
- ffmpegExecutable: import("remotion").FfmpegExecutable;
91
- ffprobeExecutable: import("remotion").FfmpegExecutable;
90
+ browserExecutable: import("@remotion/renderer").BrowserExecutable;
91
+ ffmpegExecutable: import("@remotion/renderer").FfmpegExecutable;
92
+ ffprobeExecutable: import("@remotion/renderer").FfmpegExecutable;
92
93
  logLevel: "verbose" | "info" | "warn" | "error";
93
94
  scale: number;
94
95
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
@@ -96,8 +97,8 @@ export declare const CliInternals: {
96
97
  port: number | null;
97
98
  }>;
98
99
  parseCommandLine: (type: "sequence" | "still" | "lambda" | "preview" | "versions") => void;
99
- loadConfig: () => Promise<string | null>;
100
- initializeRenderCli: (type: "sequence" | "still" | "lambda" | "preview") => Promise<void>;
100
+ loadConfig: (remotionRoot: string) => Promise<string | null>;
101
+ initializeRenderCli: (remotionRoot: string, type: "sequence" | "still" | "lambda" | "preview") => Promise<void>;
101
102
  BooleanFlags: string[];
102
103
  quietFlagProvided: () => boolean;
103
104
  parsedCli: import("./parse-command-line").CommandLineOptions & import("minimist").ParsedArgs;
@@ -109,4 +110,5 @@ export declare const CliInternals: {
109
110
  signed: boolean;
110
111
  }) => string;
111
112
  getFileSizeDownloadBar: (downloaded: number) => string;
113
+ findRemotionRoot: () => string;
112
114
  };
package/dist/index.js CHANGED
@@ -14,12 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.CliInternals = exports.cli = void 0;
17
+ exports.CliInternals = exports.overrideRemotion = exports.ConfigInternals = exports.cli = void 0;
18
18
  const renderer_1 = require("@remotion/renderer");
19
19
  const chalk_1 = require("./chalk");
20
20
  const check_version_1 = require("./check-version");
21
21
  const compositions_1 = require("./compositions");
22
+ const index_1 = require("./config/index");
22
23
  const download_progress_1 = require("./download-progress");
24
+ const find_closest_package_json_1 = require("./find-closest-package-json");
23
25
  const format_bytes_1 = require("./format-bytes");
24
26
  const get_cli_options_1 = require("./get-cli-options");
25
27
  const get_config_file_name_1 = require("./get-config-file-name");
@@ -38,39 +40,41 @@ const still_1 = require("./still");
38
40
  const upgrade_1 = require("./upgrade");
39
41
  const versions_1 = require("./versions");
40
42
  const cli = async () => {
43
+ (0, index_1.overrideRemotion)();
41
44
  const args = process.argv;
42
45
  const command = args[2];
43
46
  if (parse_command_line_1.parsedCli.help) {
44
47
  (0, print_help_1.printHelp)();
45
48
  process.exit(0);
46
49
  }
50
+ const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
47
51
  // To check node version and to warn if node version is <12.10.0
48
52
  (0, check_version_1.checkNodeVersion)();
49
53
  if (command !== versions_1.VERSIONS_COMMAND) {
50
- await (0, versions_1.validateVersionsBeforeCommand)();
54
+ await (0, versions_1.validateVersionsBeforeCommand)(remotionRoot);
51
55
  }
52
56
  const errorSymbolicationLock = renderer_1.RenderInternals.registerErrorSymbolicationLock();
53
57
  try {
54
58
  if (command === 'compositions') {
55
- await (0, compositions_1.listCompositionsCommand)();
59
+ await (0, compositions_1.listCompositionsCommand)(remotionRoot);
56
60
  }
57
61
  else if (command === 'preview') {
58
- await (0, preview_1.previewCommand)();
62
+ await (0, preview_1.previewCommand)(remotionRoot);
59
63
  }
60
64
  else if (command === 'lambda') {
61
- await (0, lambda_command_1.lambdaCommand)();
65
+ await (0, lambda_command_1.lambdaCommand)(remotionRoot);
62
66
  }
63
67
  else if (command === 'render') {
64
- await (0, render_1.render)();
68
+ await (0, render_1.render)(remotionRoot);
65
69
  }
66
70
  else if (command === 'still') {
67
- await (0, still_1.still)();
71
+ await (0, still_1.still)(remotionRoot);
68
72
  }
69
73
  else if (command === 'upgrade') {
70
- await (0, upgrade_1.upgrade)();
74
+ await (0, upgrade_1.upgrade)(remotionRoot);
71
75
  }
72
76
  else if (command === versions_1.VERSIONS_COMMAND) {
73
- await (0, versions_1.versionsCommand)();
77
+ await (0, versions_1.versionsCommand)(remotionRoot);
74
78
  }
75
79
  else if (command === 'help') {
76
80
  (0, print_help_1.printHelp)();
@@ -92,6 +96,9 @@ const cli = async () => {
92
96
  }
93
97
  };
94
98
  exports.cli = cli;
99
+ var index_2 = require("./config/index");
100
+ Object.defineProperty(exports, "ConfigInternals", { enumerable: true, get: function () { return index_2.ConfigInternals; } });
101
+ Object.defineProperty(exports, "overrideRemotion", { enumerable: true, get: function () { return index_2.overrideRemotion; } });
95
102
  __exportStar(require("./render"), exports);
96
103
  exports.CliInternals = {
97
104
  createOverwriteableCliOutput: progress_bar_1.createOverwriteableCliOutput,
@@ -109,4 +116,5 @@ exports.CliInternals = {
109
116
  handleCommonError: handle_common_errors_1.handleCommonError,
110
117
  formatBytes: format_bytes_1.formatBytes,
111
118
  getFileSizeDownloadBar: download_progress_1.getFileSizeDownloadBar,
119
+ findRemotionRoot: find_closest_package_json_1.findRemotionRoot,
112
120
  };
@@ -1 +1 @@
1
- export declare const initializeRenderCli: (type: 'still' | 'sequence' | 'lambda' | 'preview') => Promise<void>;
1
+ export declare const initializeRenderCli: (remotionRoot: string, type: 'still' | 'sequence' | 'lambda' | 'preview') => Promise<void>;
@@ -4,14 +4,19 @@ exports.initializeRenderCli = void 0;
4
4
  const get_config_file_name_1 = require("./get-config-file-name");
5
5
  const log_1 = require("./log");
6
6
  const parse_command_line_1 = require("./parse-command-line");
7
- const initializeRenderCli = async (type) => {
8
- const appliedName = await (0, get_config_file_name_1.loadConfig)();
7
+ const initializeRenderCli = async (remotionRoot, type) => {
8
+ const appliedName = await (0, get_config_file_name_1.loadConfig)(remotionRoot);
9
+ (0, parse_command_line_1.parseCommandLine)(type);
10
+ // Only now Log.verbose is available
11
+ log_1.Log.verbose('Remotion root directory:', remotionRoot);
12
+ if (remotionRoot !== process.cwd()) {
13
+ log_1.Log.warn(`Warning: The root directory of your project is ${remotionRoot}, but you are executing this command from ${process.cwd()}. The recommendation is to execute commands from the root directory.`);
14
+ }
9
15
  if (appliedName) {
10
16
  log_1.Log.verbose(`Applied configuration from ${appliedName}.`);
11
17
  }
12
18
  else {
13
19
  log_1.Log.verbose('No config file loaded.');
14
20
  }
15
- (0, parse_command_line_1.parseCommandLine)(type);
16
21
  };
17
22
  exports.initializeRenderCli = initializeRenderCli;
@@ -1 +1 @@
1
- export declare const lambdaCommand: () => Promise<never>;
1
+ export declare const lambdaCommand: (remotionRoot: string) => Promise<never>;
@@ -6,18 +6,18 @@ const log_1 = require("./log");
6
6
  const parse_command_line_1 = require("./parse-command-line");
7
7
  const get_package_manager_1 = require("./preview-server/get-package-manager");
8
8
  const update_available_1 = require("./preview-server/update-available");
9
- const lambdaCommand = async () => {
9
+ const lambdaCommand = async (remotionRoot) => {
10
10
  try {
11
11
  const path = require.resolve('@remotion/lambda', {
12
- paths: [process.cwd()],
12
+ paths: [remotionRoot],
13
13
  });
14
14
  const { LambdaInternals } = require(path);
15
- await (0, initialize_render_cli_1.initializeRenderCli)('lambda');
15
+ await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'lambda');
16
16
  await LambdaInternals.executeCommand(parse_command_line_1.parsedCli._.slice(1));
17
17
  process.exit(0);
18
18
  }
19
19
  catch (err) {
20
- const manager = (0, get_package_manager_1.getPackageManager)();
20
+ const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot);
21
21
  const installCommand = manager === 'unknown' ? 'npm i' : manager.installCommand;
22
22
  log_1.Log.error(err);
23
23
  log_1.Log.error('Remotion Lambda is not installed.');
@@ -1 +1 @@
1
- export declare const loadConfigFile: (configFileName: string, isJavascript: boolean) => Promise<string | null>;
1
+ export declare const loadConfigFile: (remotionRoot: string, configFileName: string, isJavascript: boolean) => Promise<string | null>;
@@ -8,12 +8,14 @@ const bundler_1 = require("@remotion/bundler");
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
+ const worker_threads_1 = require("worker_threads");
11
12
  const log_1 = require("./log");
12
- const loadConfigFile = async (configFileName, isJavascript) => {
13
- const resolved = path_1.default.resolve(process.cwd(), configFileName);
14
- const tsconfigJson = path_1.default.join(process.cwd(), 'tsconfig.json');
13
+ const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
14
+ const resolved = path_1.default.resolve(remotionRoot, configFileName);
15
+ const tsconfigJson = path_1.default.join(remotionRoot, 'tsconfig.json');
15
16
  if (!isJavascript && !fs_1.default.existsSync(tsconfigJson)) {
16
- log_1.Log.error('Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template/blob/main/tsconfig.json.');
17
+ log_1.Log.error('Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template-helloworld/blob/main/tsconfig.json.');
18
+ log_1.Log.error('The root directory is:', remotionRoot);
17
19
  process.exit(1);
18
20
  }
19
21
  const out = path_1.default.join(await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'remotion-')), 'bundle.js');
@@ -23,7 +25,7 @@ const loadConfigFile = async (configFileName, isJavascript) => {
23
25
  bundle: true,
24
26
  entryPoints: [resolved],
25
27
  tsconfig: isJavascript ? undefined : tsconfigJson,
26
- absWorkingDir: process.cwd(),
28
+ absWorkingDir: remotionRoot,
27
29
  outfile: out,
28
30
  external: [
29
31
  'remotion',
@@ -44,8 +46,17 @@ const loadConfigFile = async (configFileName, isJavascript) => {
44
46
  process.exit(1);
45
47
  }
46
48
  const file = await fs_1.default.promises.readFile(out, 'utf8');
49
+ const currentCwd = process.cwd();
50
+ // The config file is always executed from the Remotion root, if `process.cwd()` is being used. We cannot enforce this in worker threads used for testing
51
+ if (worker_threads_1.isMainThread) {
52
+ process.chdir(remotionRoot);
53
+ }
54
+ // Exectute the contents of the config file
47
55
  // eslint-disable-next-line no-eval
48
56
  eval(file);
57
+ if (worker_threads_1.isMainThread) {
58
+ process.chdir(currentCwd);
59
+ }
49
60
  await fs_1.default.promises.unlink(out);
50
61
  return resolved;
51
62
  };
package/dist/log.js CHANGED
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
- /* eslint-disable no-console */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.Log = void 0;
5
- const remotion_1 = require("remotion");
4
+ /* eslint-disable no-console */
5
+ const renderer_1 = require("@remotion/renderer");
6
6
  const chalk_1 = require("./chalk");
7
+ const config_1 = require("./config");
7
8
  exports.Log = {
8
9
  verbose: (...args) => {
9
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose')) {
10
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose')) {
10
11
  return console.log(...args.map((a) => chalk_1.chalk.blueBright(a)));
11
12
  }
12
13
  },
13
14
  info: (...args) => {
14
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'info')) {
15
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'info')) {
15
16
  return console.log(...args);
16
17
  }
17
18
  },
18
19
  warn: (...args) => {
19
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'warn')) {
20
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'warn')) {
20
21
  return console.warn(...args.map((a) => chalk_1.chalk.yellow(a)));
21
22
  }
22
23
  },
23
24
  error: (...args) => {
24
- if (remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'error')) {
25
+ if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'error')) {
25
26
  return console.error(...args.map((a) => chalk_1.chalk.red(a)));
26
27
  }
27
28
  },
@@ -1,5 +1,5 @@
1
+ import type { BrowserExecutable, Codec, FfmpegExecutable, ImageFormat, OpenGlRenderer, PixelFormat, ProResProfile } from '@remotion/renderer';
1
2
  import minimist from 'minimist';
2
- import type { BrowserExecutable, Codec, FfmpegExecutable, ImageFormat, OpenGlRenderer, PixelFormat, ProResProfile } from 'remotion';
3
3
  export declare type CommandLineOptions = {
4
4
  ['browser-executable']: BrowserExecutable;
5
5
  ['ffmpeg-executable']: FfmpegExecutable;