@remotion/cli 4.0.494 → 4.0.495

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 (38) hide show
  1. package/dist/config/buffer-state-delay-in-milliseconds.d.ts +1 -0
  2. package/dist/config/buffer-state-delay-in-milliseconds.js +5 -1
  3. package/dist/config/entry-point.d.ts +1 -0
  4. package/dist/config/entry-point.js +5 -1
  5. package/dist/config/ffmpeg-override.d.ts +1 -0
  6. package/dist/config/ffmpeg-override.js +7 -2
  7. package/dist/config/index.d.ts +1 -0
  8. package/dist/config/index.js +47 -8
  9. package/dist/config/metadata.d.ts +1 -0
  10. package/dist/config/metadata.js +5 -1
  11. package/dist/config/output-location.d.ts +1 -0
  12. package/dist/config/output-location.js +5 -1
  13. package/dist/config/override-webpack.d.ts +1 -0
  14. package/dist/config/override-webpack.js +5 -1
  15. package/dist/config/preview-server.d.ts +1 -0
  16. package/dist/config/preview-server.js +6 -1
  17. package/dist/config/still-frame.d.ts +1 -0
  18. package/dist/config/still-frame.js +5 -1
  19. package/dist/get-config-file-name.d.ts +4 -0
  20. package/dist/get-config-file-name.js +54 -7
  21. package/dist/get-render-defaults.d.ts +1 -1
  22. package/dist/get-render-defaults.js +2 -3
  23. package/dist/load-config.d.ts +8 -1
  24. package/dist/load-config.js +28 -20
  25. package/dist/parsed-cli.d.ts +9 -0
  26. package/dist/render-queue/process-still.d.ts +3 -1
  27. package/dist/render-queue/process-still.js +5 -10
  28. package/dist/render-queue/process-video.d.ts +3 -1
  29. package/dist/render-queue/process-video.js +5 -10
  30. package/dist/render-queue/queue.d.ts +3 -1
  31. package/dist/render-queue/queue.js +8 -5
  32. package/dist/render-queue/studio-render-job-fixed-config.d.ts +5 -0
  33. package/dist/render-queue/studio-render-job-fixed-config.js +2 -0
  34. package/dist/setup-cache.js +1 -1
  35. package/dist/studio.js +49 -11
  36. package/dist/upgrade.d.ts +1 -0
  37. package/dist/upgrade.js +17 -10
  38. package/package.json +14 -14
@@ -1,2 +1,3 @@
1
1
  export declare const getBufferStateDelayInMilliseconds: () => number | null;
2
2
  export declare const setBufferStateDelayInMilliseconds: (val: number | null) => void;
3
+ export declare const resetBufferStateDelayInMilliseconds: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setBufferStateDelayInMilliseconds = exports.getBufferStateDelayInMilliseconds = void 0;
3
+ exports.resetBufferStateDelayInMilliseconds = exports.setBufferStateDelayInMilliseconds = exports.getBufferStateDelayInMilliseconds = void 0;
4
4
  let value = null;
5
5
  const getBufferStateDelayInMilliseconds = () => {
6
6
  return value;
@@ -10,3 +10,7 @@ const setBufferStateDelayInMilliseconds = (val) => {
10
10
  value = val;
11
11
  };
12
12
  exports.setBufferStateDelayInMilliseconds = setBufferStateDelayInMilliseconds;
13
+ const resetBufferStateDelayInMilliseconds = () => {
14
+ value = null;
15
+ };
16
+ exports.resetBufferStateDelayInMilliseconds = resetBufferStateDelayInMilliseconds;
@@ -1,2 +1,3 @@
1
1
  export declare const setEntryPoint: (ep: string) => void;
2
2
  export declare const getEntryPoint: () => string | null;
3
+ export declare const resetEntryPoint: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEntryPoint = exports.setEntryPoint = void 0;
3
+ exports.resetEntryPoint = exports.getEntryPoint = exports.setEntryPoint = void 0;
4
4
  let entryPoint = null;
5
5
  const setEntryPoint = (ep) => {
6
6
  entryPoint = ep;
@@ -10,3 +10,7 @@ const getEntryPoint = () => {
10
10
  return entryPoint;
11
11
  };
12
12
  exports.getEntryPoint = getEntryPoint;
13
+ const resetEntryPoint = () => {
14
+ entryPoint = null;
15
+ };
16
+ exports.resetEntryPoint = resetEntryPoint;
@@ -1,3 +1,4 @@
1
1
  import type { FfmpegOverrideFn } from '@remotion/renderer';
2
2
  export declare const setFfmpegOverrideFunction: (fn: FfmpegOverrideFn) => void;
3
3
  export declare const getFfmpegOverrideFunction: () => FfmpegOverrideFn;
4
+ export declare const resetFfmpegOverrideFunction: () => void;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFfmpegOverrideFunction = exports.setFfmpegOverrideFunction = void 0;
4
- let ffmpegOverrideFn = ({ args }) => args;
3
+ exports.resetFfmpegOverrideFunction = exports.getFfmpegOverrideFunction = exports.setFfmpegOverrideFunction = void 0;
4
+ const defaultFfmpegOverrideFn = ({ args }) => args;
5
+ let ffmpegOverrideFn = defaultFfmpegOverrideFn;
5
6
  const setFfmpegOverrideFunction = (fn) => {
6
7
  ffmpegOverrideFn = fn;
7
8
  };
@@ -10,3 +11,7 @@ const getFfmpegOverrideFunction = () => {
10
11
  return ffmpegOverrideFn;
11
12
  };
12
13
  exports.getFfmpegOverrideFunction = getFfmpegOverrideFunction;
14
+ const resetFfmpegOverrideFunction = () => {
15
+ ffmpegOverrideFn = defaultFfmpegOverrideFn;
16
+ };
17
+ exports.resetFfmpegOverrideFunction = resetFfmpegOverrideFunction;
@@ -482,4 +482,5 @@ export declare const ConfigInternals: {
482
482
  getWebpackPolling: () => number | null;
483
483
  getBufferStateDelayInMilliseconds: () => number | null;
484
484
  getOutputCodecOrUndefined: () => CodecOrUndefined;
485
+ resetConfigOptions: () => void;
485
486
  };
@@ -13,11 +13,8 @@ const ffmpeg_override_1 = require("./ffmpeg-override");
13
13
  const image_sequence_1 = require("./image-sequence");
14
14
  const metadata_1 = require("./metadata");
15
15
  const output_location_1 = require("./output-location");
16
- const output_location_2 = require("./output-location");
17
16
  const override_webpack_1 = require("./override-webpack");
18
- const override_webpack_2 = require("./override-webpack");
19
17
  const preview_server_1 = require("./preview-server");
20
- const preview_server_2 = require("./preview-server");
21
18
  const still_frame_1 = require("./still-frame");
22
19
  const webpack_caching_1 = require("./webpack-caching");
23
20
  const webpack_poll_1 = require("./webpack-poll");
@@ -53,11 +50,11 @@ exports.Config = {
53
50
  setWebpackPollingInMilliseconds: webpackPollOption.setConfig,
54
51
  setShouldOpenBrowser: noOpenOption.setConfig,
55
52
  setBufferStateDelayInMilliseconds: buffer_state_delay_in_milliseconds_1.setBufferStateDelayInMilliseconds,
56
- overrideWebpackConfig: override_webpack_2.overrideWebpackConfig,
53
+ overrideWebpackConfig: override_webpack_1.overrideWebpackConfig,
57
54
  setCachingEnabled: bundleCacheOption.setConfig,
58
- setPort: preview_server_2.setPort,
59
- setStudioPort: preview_server_2.setStudioPort,
60
- setRendererPort: preview_server_2.setRendererPort,
55
+ setPort: preview_server_1.setPort,
56
+ setStudioPort: preview_server_1.setStudioPort,
57
+ setRendererPort: preview_server_1.setRendererPort,
61
58
  setPublicDir: publicDirOption.setConfig,
62
59
  setEntryPoint: entry_point_1.setEntryPoint,
63
60
  setLogLevel: logLevelOption.setConfig,
@@ -92,7 +89,7 @@ exports.Config = {
92
89
  setNumberOfGifLoops: numberOfGifLoopsOption.setConfig,
93
90
  setMuted: mutedOption.setConfig,
94
91
  setEnforceAudioTrack: enforceAudioOption.setConfig,
95
- setOutputLocation: output_location_2.setOutputLocation,
92
+ setOutputLocation: output_location_1.setOutputLocation,
96
93
  setOverwriteOutput: overwriteOption.setConfig,
97
94
  setChromeMode: chromeModeOption.setConfig,
98
95
  setPixelFormat: pixelFormatOption.setConfig,
@@ -136,6 +133,47 @@ exports.Config = {
136
133
  setSampleRate: sampleRateOption.setConfig,
137
134
  setPreviewSampleRate: previewSampleRateOption.setConfig,
138
135
  };
136
+ const getDefaultConfigValue = (option) => {
137
+ for (const cliValue of [undefined, null]) {
138
+ const result = option.getValue({
139
+ commandLine: { [option.cliFlag]: cliValue },
140
+ });
141
+ if (result.source !== 'cli') {
142
+ return result.value;
143
+ }
144
+ }
145
+ throw new Error(`Could not determine the default for --${option.cliFlag}`);
146
+ };
147
+ const configSetters = new Set(Object.values(Object.getOwnPropertyDescriptors(exports.Config))
148
+ .map((descriptor) => descriptor.value)
149
+ .filter((value) => typeof value === 'function'));
150
+ const browserSafeConfigOptionResets = Object.values(client_1.BrowserSafeApis.options)
151
+ .filter((option) => configSetters.has(option.setConfig))
152
+ .map((untypedOption) => {
153
+ const option = untypedOption;
154
+ if (option.reset) {
155
+ return option.reset;
156
+ }
157
+ const defaultValue = getDefaultConfigValue(option);
158
+ return () => option.setConfig(defaultValue);
159
+ });
160
+ const resetBrowserSafeConfigOptions = () => {
161
+ for (const reset of browserSafeConfigOptionResets) {
162
+ reset();
163
+ }
164
+ };
165
+ const resetConfigOptions = () => {
166
+ resetBrowserSafeConfigOptions();
167
+ studio_server_1.StudioServerInternals.resetMaxTimelineTracks();
168
+ (0, buffer_state_delay_in_milliseconds_1.resetBufferStateDelayInMilliseconds)();
169
+ (0, entry_point_1.resetEntryPoint)();
170
+ (0, ffmpeg_override_1.resetFfmpegOverrideFunction)();
171
+ (0, metadata_1.resetMetadata)();
172
+ (0, output_location_1.resetOutputLocation)();
173
+ (0, override_webpack_1.resetWebpackOverride)();
174
+ (0, preview_server_1.resetPreviewServerPorts)();
175
+ (0, still_frame_1.resetStillFrame)();
176
+ };
139
177
  exports.ConfigInternals = {
140
178
  getBrowser: browser_1.getBrowser,
141
179
  getStudioPort: preview_server_1.getStudioPort,
@@ -157,4 +195,5 @@ exports.ConfigInternals = {
157
195
  getWebpackPolling: webpack_poll_1.getWebpackPolling,
158
196
  getBufferStateDelayInMilliseconds: buffer_state_delay_in_milliseconds_1.getBufferStateDelayInMilliseconds,
159
197
  getOutputCodecOrUndefined: client_1.BrowserSafeApis.getOutputCodecOrUndefined,
198
+ resetConfigOptions,
160
199
  };
@@ -1,2 +1,3 @@
1
1
  export declare const setMetadata: (metadata: Record<string, string>) => void;
2
2
  export declare const getMetadata: () => Record<string, string>;
3
+ export declare const resetMetadata: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMetadata = exports.setMetadata = void 0;
3
+ exports.resetMetadata = exports.getMetadata = exports.setMetadata = void 0;
4
4
  let specifiedMetadata;
5
5
  const setMetadata = (metadata) => {
6
6
  specifiedMetadata = metadata;
@@ -10,3 +10,7 @@ const getMetadata = () => {
10
10
  return specifiedMetadata;
11
11
  };
12
12
  exports.getMetadata = getMetadata;
13
+ const resetMetadata = () => {
14
+ specifiedMetadata = undefined;
15
+ };
16
+ exports.resetMetadata = resetMetadata;
@@ -1,2 +1,3 @@
1
1
  export declare const setOutputLocation: (newOutputLocation: string) => void;
2
2
  export declare const getOutputLocation: () => string | null;
3
+ export declare const resetOutputLocation: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOutputLocation = exports.setOutputLocation = void 0;
3
+ exports.resetOutputLocation = exports.getOutputLocation = exports.setOutputLocation = void 0;
4
4
  let currentOutputLocation = null;
5
5
  const setOutputLocation = (newOutputLocation) => {
6
6
  if (typeof newOutputLocation !== 'string') {
@@ -14,3 +14,7 @@ const setOutputLocation = (newOutputLocation) => {
14
14
  exports.setOutputLocation = setOutputLocation;
15
15
  const getOutputLocation = () => currentOutputLocation;
16
16
  exports.getOutputLocation = getOutputLocation;
17
+ const resetOutputLocation = () => {
18
+ currentOutputLocation = null;
19
+ };
20
+ exports.resetOutputLocation = resetOutputLocation;
@@ -3,3 +3,4 @@ export type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) =>
3
3
  export declare const defaultOverrideFunction: WebpackOverrideFn;
4
4
  export declare const getWebpackOverrideFn: () => WebpackOverrideFn;
5
5
  export declare const overrideWebpackConfig: (fn: WebpackOverrideFn) => void;
6
+ export declare const resetWebpackOverride: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.overrideWebpackConfig = exports.getWebpackOverrideFn = exports.defaultOverrideFunction = void 0;
3
+ exports.resetWebpackOverride = exports.overrideWebpackConfig = exports.getWebpackOverrideFn = exports.defaultOverrideFunction = void 0;
4
4
  const defaultOverrideFunction = (config) => config;
5
5
  exports.defaultOverrideFunction = defaultOverrideFunction;
6
6
  let overrideFn = exports.defaultOverrideFunction;
@@ -13,3 +13,7 @@ const overrideWebpackConfig = (fn) => {
13
13
  overrideFn = async (c) => fn(await prevOverride(c));
14
14
  };
15
15
  exports.overrideWebpackConfig = overrideWebpackConfig;
16
+ const resetWebpackOverride = () => {
17
+ overrideFn = exports.defaultOverrideFunction;
18
+ };
19
+ exports.resetWebpackOverride = resetWebpackOverride;
@@ -10,3 +10,4 @@ export declare const setRendererPort: (port: number | undefined) => void;
10
10
  export declare const getStudioPort: () => number | undefined;
11
11
  export declare const getRendererPortFromConfigFile: () => number | null;
12
12
  export declare const getRendererPortFromConfigFileAndCliFlag: () => number | null;
13
+ export declare const resetPreviewServerPorts: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRendererPortFromConfigFileAndCliFlag = exports.getRendererPortFromConfigFile = exports.getStudioPort = exports.setRendererPort = exports.setStudioPort = exports.setPort = void 0;
3
+ exports.resetPreviewServerPorts = exports.getRendererPortFromConfigFileAndCliFlag = exports.getRendererPortFromConfigFile = exports.getStudioPort = exports.setRendererPort = exports.setStudioPort = exports.setPort = void 0;
4
4
  const client_1 = require("@remotion/renderer/client");
5
5
  const parsed_cli_1 = require("../parsed-cli");
6
6
  const { portOption } = client_1.BrowserSafeApis.options;
@@ -49,3 +49,8 @@ const getRendererPortFromConfigFileAndCliFlag = () => {
49
49
  return ((_b = (_a = portOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value) !== null && _a !== void 0 ? _a : rendererPort) !== null && _b !== void 0 ? _b : null);
50
50
  };
51
51
  exports.getRendererPortFromConfigFileAndCliFlag = getRendererPortFromConfigFileAndCliFlag;
52
+ const resetPreviewServerPorts = () => {
53
+ studioPort = undefined;
54
+ rendererPort = undefined;
55
+ };
56
+ exports.resetPreviewServerPorts = resetPreviewServerPorts;
@@ -1,2 +1,3 @@
1
1
  export declare const setStillFrame: (frame: number) => void;
2
2
  export declare const getStillFrame: () => number;
3
+ export declare const resetStillFrame: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStillFrame = exports.setStillFrame = void 0;
3
+ exports.resetStillFrame = exports.getStillFrame = exports.setStillFrame = void 0;
4
4
  const no_react_1 = require("remotion/no-react");
5
5
  let stillFrame = 0;
6
6
  const setStillFrame = (frame) => {
@@ -14,3 +14,7 @@ const setStillFrame = (frame) => {
14
14
  exports.setStillFrame = setStillFrame;
15
15
  const getStillFrame = () => stillFrame;
16
16
  exports.getStillFrame = getStillFrame;
17
+ const resetStillFrame = () => {
18
+ stillFrame = 0;
19
+ };
20
+ exports.resetStillFrame = resetStillFrame;
@@ -1 +1,5 @@
1
+ export declare const getLoadedConfigFile: () => string | null;
1
2
  export declare const loadConfig: (remotionRoot: string) => Promise<string | null>;
3
+ export declare const reloadConfig: ({ resetConfigOptions, }: {
4
+ resetConfigOptions: () => void;
5
+ }) => Promise<boolean>;
@@ -3,7 +3,7 @@ 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.loadConfig = void 0;
6
+ exports.reloadConfig = exports.loadConfig = exports.getLoadedConfigFile = void 0;
7
7
  const node_fs_1 = require("node:fs");
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const client_1 = require("@remotion/renderer/client");
@@ -13,7 +13,22 @@ const parsed_cli_1 = require("./parsed-cli");
13
13
  const { configOption } = client_1.BrowserSafeApis.options;
14
14
  const defaultConfigFileJavascript = 'remotion.config.js';
15
15
  const defaultConfigFileTypescript = 'remotion.config.ts';
16
- const loadConfig = (remotionRoot) => {
16
+ let loadedConfigFile = null;
17
+ const getLoadedConfigFile = () => {
18
+ var _a;
19
+ return (_a = loadedConfigFile === null || loadedConfigFile === void 0 ? void 0 : loadedConfigFile.resolved) !== null && _a !== void 0 ? _a : null;
20
+ };
21
+ exports.getLoadedConfigFile = getLoadedConfigFile;
22
+ const loadInitialConfigFile = async (remotionRoot, configFileName, isJavascript) => {
23
+ try {
24
+ return await (0, load_config_1.loadConfigFile)(remotionRoot, configFileName, isJavascript);
25
+ }
26
+ catch (error) {
27
+ log_1.Log.error({ indent: false, logLevel: 'error' }, error instanceof Error ? error.message : String(error));
28
+ process.exit(1);
29
+ }
30
+ };
31
+ const loadConfig = async (remotionRoot) => {
17
32
  const configFile = configOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
18
33
  if (configFile) {
19
34
  const fullPath = node_path_1.default.resolve(process.cwd(), configFile);
@@ -21,17 +36,49 @@ const loadConfig = (remotionRoot) => {
21
36
  log_1.Log.error({ indent: false, logLevel: 'error' }, `You specified a config file location of "${configFile}" but no file under ${fullPath} was found.`);
22
37
  process.exit(1);
23
38
  }
24
- return (0, load_config_1.loadConfigFile)(remotionRoot, configFile, fullPath.endsWith('.js'));
39
+ loadedConfigFile = await loadInitialConfigFile(remotionRoot, configFile, fullPath.endsWith('.js'));
40
+ return loadedConfigFile.resolved;
25
41
  }
26
42
  if (remotionRoot === null) {
27
- return Promise.resolve(null);
43
+ loadedConfigFile = null;
44
+ return null;
28
45
  }
29
46
  if ((0, node_fs_1.existsSync)(node_path_1.default.resolve(remotionRoot, defaultConfigFileTypescript))) {
30
- return (0, load_config_1.loadConfigFile)(remotionRoot, defaultConfigFileTypescript, false);
47
+ loadedConfigFile = await loadInitialConfigFile(remotionRoot, defaultConfigFileTypescript, false);
48
+ return loadedConfigFile.resolved;
31
49
  }
32
50
  if ((0, node_fs_1.existsSync)(node_path_1.default.resolve(remotionRoot, defaultConfigFileJavascript))) {
33
- return (0, load_config_1.loadConfigFile)(remotionRoot, defaultConfigFileJavascript, true);
51
+ loadedConfigFile = await loadInitialConfigFile(remotionRoot, defaultConfigFileJavascript, true);
52
+ return loadedConfigFile.resolved;
34
53
  }
35
- return Promise.resolve(null);
54
+ loadedConfigFile = null;
55
+ return null;
36
56
  };
37
57
  exports.loadConfig = loadConfig;
58
+ const reloadConfig = async ({ resetConfigOptions, }) => {
59
+ if (!loadedConfigFile) {
60
+ return false;
61
+ }
62
+ const previousConfigFile = loadedConfigFile;
63
+ let nextConfigFile;
64
+ try {
65
+ nextConfigFile = await (0, load_config_1.prepareConfigFile)(previousConfigFile.remotionRoot, previousConfigFile.resolved, previousConfigFile.resolved.endsWith('.js'));
66
+ }
67
+ catch (error) {
68
+ log_1.Log.error({ indent: false, logLevel: 'error' }, 'Could not reload the Remotion config. Keeping the previous configuration.', error instanceof Error ? error.message : String(error));
69
+ return false;
70
+ }
71
+ resetConfigOptions();
72
+ try {
73
+ (0, load_config_1.executeConfigFile)(nextConfigFile);
74
+ loadedConfigFile = nextConfigFile;
75
+ return true;
76
+ }
77
+ catch (error) {
78
+ resetConfigOptions();
79
+ (0, load_config_1.executeConfigFile)(previousConfigFile);
80
+ log_1.Log.error({ indent: false, logLevel: 'error' }, 'Could not reload the Remotion config. Keeping the previous configuration.', error instanceof Error ? error.message : String(error));
81
+ return false;
82
+ }
83
+ };
84
+ exports.reloadConfig = reloadConfig;
@@ -1,2 +1,2 @@
1
1
  import type { RenderDefaults } from '@remotion/studio-shared';
2
- export declare const getRenderDefaults: () => RenderDefaults;
2
+ export declare const getRenderDefaults: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => RenderDefaults;
@@ -5,13 +5,12 @@ const renderer_1 = require("@remotion/renderer");
5
5
  const client_1 = require("@remotion/renderer/client");
6
6
  const config_1 = require("./config");
7
7
  const parsed_cli_1 = require("./parsed-cli");
8
- const { x264Option, gopSizeOption, audioBitrateOption, offthreadVideoCacheSizeInBytesOption, concurrencyOption, offthreadVideoThreadsOption, scaleOption, jpegQualityOption, videoBitrateOption, enforceAudioOption, mutedOption, colorSpaceOption, enableMultiprocessOnLinuxOption, glOption, numberOfGifLoopsOption, beepOnFinishOption, encodingMaxRateOption, encodingBufferSizeOption, reproOption, logLevelOption, delayRenderTimeoutInMillisecondsOption, headlessOption, forSeamlessAacConcatenationOption, audioCodecOption, hardwareAccelerationOption, chromeModeOption, mediaCacheSizeInBytesOption, darkModeOption, pixelFormatOption, everyNthFrameOption, proResProfileOption, userAgentOption, disableWebSecurityOption, ignoreCertificateErrorsOption, publicLicenseKeyOption, stillImageFormatOption, videoImageFormatOption, sampleRateOption, } = client_1.BrowserSafeApis.options;
9
- const getRenderDefaults = () => {
8
+ const { x264Option, gopSizeOption, audioBitrateOption, offthreadVideoCacheSizeInBytesOption, concurrencyOption, offthreadVideoThreadsOption, scaleOption, jpegQualityOption, videoBitrateOption, enforceAudioOption, mutedOption, colorSpaceOption, enableMultiprocessOnLinuxOption, glOption, numberOfGifLoopsOption, beepOnFinishOption, encodingMaxRateOption, encodingBufferSizeOption, reproOption, delayRenderTimeoutInMillisecondsOption, headlessOption, forSeamlessAacConcatenationOption, audioCodecOption, hardwareAccelerationOption, chromeModeOption, mediaCacheSizeInBytesOption, darkModeOption, pixelFormatOption, everyNthFrameOption, proResProfileOption, userAgentOption, disableWebSecurityOption, ignoreCertificateErrorsOption, publicLicenseKeyOption, stillImageFormatOption, videoImageFormatOption, sampleRateOption, } = client_1.BrowserSafeApis.options;
9
+ const getRenderDefaults = (logLevel) => {
10
10
  var _a;
11
11
  const defaultJpegQuality = jpegQualityOption.getValue({
12
12
  commandLine: parsed_cli_1.parsedCli,
13
13
  }).value;
14
- const logLevel = logLevelOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
15
14
  const defaultCodec = config_1.ConfigInternals.getOutputCodecOrUndefined();
16
15
  const concurrency = renderer_1.RenderInternals.resolveConcurrency(concurrencyOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value);
17
16
  const pixelFormat = pixelFormatOption.getValue({
@@ -1 +1,8 @@
1
- export declare const loadConfigFile: (remotionRoot: string, configFileName: string, isJavascript: boolean) => Promise<string | null>;
1
+ export type PreparedConfigFile = {
2
+ code: string;
3
+ remotionRoot: string;
4
+ resolved: string;
5
+ };
6
+ export declare const prepareConfigFile: (remotionRoot: string, configFileName: string, isJavascript: boolean) => Promise<PreparedConfigFile>;
7
+ export declare const executeConfigFile: ({ code, remotionRoot }: PreparedConfigFile) => void;
8
+ export declare const loadConfigFile: (remotionRoot: string, configFileName: string, isJavascript: boolean) => Promise<PreparedConfigFile>;
@@ -3,19 +3,16 @@ 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.loadConfigFile = void 0;
6
+ exports.loadConfigFile = exports.executeConfigFile = exports.prepareConfigFile = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_worker_threads_1 = require("node:worker_threads");
10
10
  const bundler_1 = require("@remotion/bundler");
11
- const log_1 = require("./log");
12
- const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
11
+ const prepareConfigFile = async (remotionRoot, configFileName, isJavascript) => {
13
12
  const resolved = node_path_1.default.resolve(remotionRoot, configFileName);
14
13
  const tsconfigJson = node_path_1.default.join(remotionRoot, 'tsconfig.json');
15
14
  if (!isJavascript && !node_fs_1.default.existsSync(tsconfigJson)) {
16
- log_1.Log.error({ indent: false, logLevel: '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.');
17
- log_1.Log.error({ indent: false, logLevel: 'error' }, 'The root directory is:', remotionRoot);
18
- process.exit(1);
15
+ throw new 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. The root directory is: ${remotionRoot}`);
19
16
  }
20
17
  const virtualOutfile = 'bundle.js';
21
18
  const result = await bundler_1.BundlerInternals.esbuild.build({
@@ -30,18 +27,20 @@ const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
30
27
  packages: 'external',
31
28
  });
32
29
  if (result.errors.length > 0) {
33
- log_1.Log.error({ indent: false, logLevel: 'error' }, 'Error in remotion.config.ts file');
34
- for (const err in result.errors) {
35
- log_1.Log.error({ indent: false, logLevel: 'error' }, err);
36
- }
37
- process.exit(1);
30
+ throw new Error(`Error in remotion.config.ts file: ${result.errors
31
+ .map((error) => error.text)
32
+ .join('\n')}`);
38
33
  }
39
34
  const firstOutfile = result.outputFiles[0];
40
35
  if (!firstOutfile) {
41
- log_1.Log.error({ indent: false, logLevel: 'error' }, 'No output files found in the config file.');
42
- process.exit(1);
36
+ throw new Error('No output files found in the config file.');
43
37
  }
44
- let str = new TextDecoder().decode(firstOutfile.contents);
38
+ const code = new TextDecoder().decode(firstOutfile.contents);
39
+ return { code, remotionRoot, resolved };
40
+ };
41
+ exports.prepareConfigFile = prepareConfigFile;
42
+ const executeConfigFile = ({ code, remotionRoot }) => {
43
+ let str = code;
45
44
  const currentCwd = process.cwd();
46
45
  // 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
47
46
  if (node_worker_threads_1.isMainThread) {
@@ -50,12 +49,21 @@ const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
50
49
  if (process.env.PATCH_BUN_DEVELOPMENT) {
51
50
  str = str.replace('@remotion/cli/config', './config');
52
51
  }
53
- // Exectute the contents of the config file
54
- // eslint-disable-next-line no-eval
55
- eval(str);
56
- if (node_worker_threads_1.isMainThread) {
57
- process.chdir(currentCwd);
52
+ try {
53
+ // Execute the contents of the config file
54
+ // eslint-disable-next-line no-eval
55
+ eval(str);
58
56
  }
59
- return resolved;
57
+ finally {
58
+ if (node_worker_threads_1.isMainThread) {
59
+ process.chdir(currentCwd);
60
+ }
61
+ }
62
+ };
63
+ exports.executeConfigFile = executeConfigFile;
64
+ const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
65
+ const prepared = await (0, exports.prepareConfigFile)(remotionRoot, configFileName, isJavascript);
66
+ (0, exports.executeConfigFile)(prepared);
67
+ return prepared;
60
68
  };
61
69
  exports.loadConfigFile = loadConfigFile;
@@ -545,6 +545,7 @@ declare const benchmarkConcurrenciesOption: {
545
545
  value: null;
546
546
  };
547
547
  setConfig: (height: number | null) => void;
548
+ reset: () => void;
548
549
  id: "height";
549
550
  }, overrideWidthOption: {
550
551
  name: string;
@@ -563,6 +564,7 @@ declare const benchmarkConcurrenciesOption: {
563
564
  value: null;
564
565
  };
565
566
  setConfig: (width: number | null) => void;
567
+ reset: () => void;
566
568
  id: "width";
567
569
  }, overrideFpsOption: {
568
570
  name: string;
@@ -581,6 +583,7 @@ declare const benchmarkConcurrenciesOption: {
581
583
  value: null;
582
584
  };
583
585
  setConfig: (fps: number | null) => void;
586
+ reset: () => void;
584
587
  id: "fps";
585
588
  }, overrideDurationOption: {
586
589
  name: string;
@@ -599,6 +602,7 @@ declare const benchmarkConcurrenciesOption: {
599
602
  value: null;
600
603
  };
601
604
  setConfig: (duration: number | null) => void;
605
+ reset: () => void;
602
606
  id: "duration";
603
607
  }, outDirOption: {
604
608
  name: string;
@@ -698,6 +702,7 @@ declare const benchmarkConcurrenciesOption: {
698
702
  source: string;
699
703
  };
700
704
  setConfig: (pattern: string | null) => void;
705
+ reset: () => void;
701
706
  id: "image-sequence-pattern";
702
707
  }, scaleOption: {
703
708
  name: string;
@@ -728,6 +733,7 @@ declare const benchmarkConcurrenciesOption: {
728
733
  value: boolean;
729
734
  };
730
735
  setConfig: (value: boolean) => void;
736
+ reset: () => void;
731
737
  id: "overwrite";
732
738
  }, crfOption: {
733
739
  name: string;
@@ -779,6 +785,7 @@ declare const benchmarkConcurrenciesOption: {
779
785
  source: string;
780
786
  };
781
787
  setConfig: (newCodec: import("@remotion/renderer").CodecOrUndefined) => void;
788
+ reset: () => void;
782
789
  id: "codec";
783
790
  }, stillFrameOption: {
784
791
  name: string;
@@ -941,6 +948,7 @@ declare const benchmarkConcurrenciesOption: {
941
948
  value: boolean;
942
949
  };
943
950
  setConfig: () => void;
951
+ reset: () => void;
944
952
  id: "muted";
945
953
  }, headlessOption: {
946
954
  name: string;
@@ -1019,6 +1027,7 @@ declare const benchmarkConcurrenciesOption: {
1019
1027
  source: string;
1020
1028
  };
1021
1029
  setConfig: (shouldOpen: boolean) => void;
1030
+ reset: () => void;
1022
1031
  id: "no-open";
1023
1032
  }, portOption: {
1024
1033
  name: string;
@@ -1,8 +1,10 @@
1
1
  import type { JobProgressCallback, RenderJob } from '@remotion/studio-server';
2
- export declare const processStill: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }: {
2
+ import type { StudioRenderJobFixedConfig } from './studio-render-job-fixed-config';
3
+ export declare const processStill: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, fixedConfig, }: {
3
4
  job: RenderJob;
4
5
  remotionRoot: string;
5
6
  entryPoint: string;
6
7
  onProgress: JobProgressCallback;
7
8
  addCleanupCallback: (label: string, cb: () => void) => void;
9
+ fixedConfig: StudioRenderJobFixedConfig;
8
10
  }) => Promise<void>;
@@ -2,21 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processStill = void 0;
4
4
  const client_1 = require("@remotion/renderer/client");
5
- const preview_server_1 = require("../config/preview-server");
6
5
  const convert_entry_point_to_serve_url_1 = require("../convert-entry-point-to-serve-url");
7
6
  const parsed_cli_1 = require("../parsed-cli");
8
7
  const still_1 = require("../render-flows/still");
9
- const { publicDirOption, askAIOption, keyboardShortcutsOption, rspackOption, browserExecutableOption, bundleCacheOption, } = client_1.BrowserSafeApis.options;
10
- const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }) => {
8
+ const { askAIOption, keyboardShortcutsOption, browserExecutableOption, bundleCacheOption, } = client_1.BrowserSafeApis.options;
9
+ const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, fixedConfig, }) => {
11
10
  if (job.type !== 'still') {
12
11
  throw new Error('Expected still job');
13
12
  }
14
13
  const browserExecutable = browserExecutableOption.getValue({
15
14
  commandLine: parsed_cli_1.parsedCli,
16
15
  }).value;
17
- const publicDir = publicDirOption.getValue({
18
- commandLine: parsed_cli_1.parsedCli,
19
- }).value;
20
16
  const askAIEnabled = askAIOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
21
17
  const keyboardShortcutsEnabled = keyboardShortcutsOption.getValue({
22
18
  commandLine: parsed_cli_1.parsedCli,
@@ -24,7 +20,6 @@ const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addClea
24
20
  const shouldCache = bundleCacheOption.getValue({
25
21
  commandLine: parsed_cli_1.parsedCli,
26
22
  }).value;
27
- const rspack = rspackOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
28
23
  const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(entryPoint);
29
24
  await (0, still_1.renderStillFlow)({
30
25
  remotionRoot,
@@ -40,8 +35,8 @@ const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addClea
40
35
  fullEntryPoint,
41
36
  serializedInputPropsWithCustomSchema: job.serializedInputPropsWithCustomSchema,
42
37
  overwrite: true,
43
- port: (0, preview_server_1.getRendererPortFromConfigFile)(),
44
- publicDir,
38
+ port: fixedConfig.rendererPort,
39
+ publicDir: fixedConfig.publicDir,
45
40
  puppeteerTimeout: job.delayRenderTimeout,
46
41
  jpegQuality: job.jpegQuality,
47
42
  remainingArgs: [],
@@ -64,7 +59,7 @@ const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addClea
64
59
  mediaCacheSizeInBytes: job.mediaCacheSizeInBytes,
65
60
  askAIEnabled,
66
61
  keyboardShortcutsEnabled,
67
- rspack,
62
+ rspack: fixedConfig.rspack,
68
63
  shouldCache,
69
64
  });
70
65
  };
@@ -1,9 +1,11 @@
1
1
  import type { JobProgressCallback, RenderJob } from '@remotion/studio-server';
2
- export declare const processVideoJob: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, }: {
2
+ import type { StudioRenderJobFixedConfig } from './studio-render-job-fixed-config';
3
+ export declare const processVideoJob: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, fixedConfig, }: {
3
4
  job: RenderJob;
4
5
  remotionRoot: string;
5
6
  entryPoint: string;
6
7
  onProgress: JobProgressCallback;
7
8
  addCleanupCallback: (label: string, cb: () => void) => void;
8
9
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
10
+ fixedConfig: StudioRenderJobFixedConfig;
9
11
  }) => Promise<void>;
@@ -2,20 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processVideoJob = void 0;
4
4
  const client_1 = require("@remotion/renderer/client");
5
- const preview_server_1 = require("../config/preview-server");
6
5
  const convert_entry_point_to_serve_url_1 = require("../convert-entry-point-to-serve-url");
7
6
  const get_cli_options_1 = require("../get-cli-options");
8
7
  const parsed_cli_1 = require("../parsed-cli");
9
8
  const render_1 = require("../render-flows/render");
10
- const { publicDirOption, askAIOption, keyboardShortcutsOption, rspackOption, browserExecutableOption, bundleCacheOption, sampleRateOption, } = client_1.BrowserSafeApis.options;
11
- const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, }) => {
9
+ const { askAIOption, keyboardShortcutsOption, browserExecutableOption, bundleCacheOption, sampleRateOption, } = client_1.BrowserSafeApis.options;
10
+ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, fixedConfig, }) => {
12
11
  var _a, _b, _c;
13
12
  if (job.type !== 'video' && job.type !== 'sequence') {
14
13
  throw new Error('Expected video job');
15
14
  }
16
- const publicDir = publicDirOption.getValue({
17
- commandLine: parsed_cli_1.parsedCli,
18
- }).value;
19
15
  const askAIEnabled = askAIOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
20
16
  const keyboardShortcutsEnabled = keyboardShortcutsOption.getValue({
21
17
  commandLine: parsed_cli_1.parsedCli,
@@ -31,7 +27,6 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addC
31
27
  const browserExecutable = browserExecutableOption.getValue({
32
28
  commandLine: parsed_cli_1.parsedCli,
33
29
  }).value;
34
- const rspack = rspackOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
35
30
  const sampleRate = job.type === 'video'
36
31
  ? job.sampleRate
37
32
  : sampleRateOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
@@ -51,8 +46,8 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addC
51
46
  fullEntryPoint,
52
47
  serializedInputPropsWithCustomSchema: job.serializedInputPropsWithCustomSchema,
53
48
  overwrite: true,
54
- port: (0, preview_server_1.getRendererPortFromConfigFile)(),
55
- publicDir,
49
+ port: fixedConfig.rendererPort,
50
+ publicDir: fixedConfig.publicDir,
56
51
  puppeteerTimeout: job.delayRenderTimeout,
57
52
  jpegQuality: (_a = job.jpegQuality) !== null && _a !== void 0 ? _a : undefined,
58
53
  remainingArgs: [],
@@ -102,7 +97,7 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addC
102
97
  imageSequencePattern: null,
103
98
  askAIEnabled,
104
99
  keyboardShortcutsEnabled,
105
- rspack,
100
+ rspack: fixedConfig.rspack,
106
101
  shouldCache,
107
102
  });
108
103
  };
@@ -1,10 +1,12 @@
1
1
  import type { RenderJob, RenderJobWithCleanup } from '@remotion/studio-server';
2
+ import type { StudioRenderJobFixedConfig } from './studio-render-job-fixed-config';
2
3
  export declare const getRenderQueue: () => RenderJob[];
3
- export declare const addJob: ({ job, entryPoint, remotionRoot, logLevel, }: {
4
+ export declare const addJob: ({ job, entryPoint, remotionRoot, logLevel, fixedConfig, }: {
4
5
  job: RenderJobWithCleanup;
5
6
  entryPoint: string;
6
7
  remotionRoot: string;
7
8
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
9
+ fixedConfig: StudioRenderJobFixedConfig;
8
10
  }) => void;
9
11
  export declare const removeJob: (jobId: string) => void;
10
12
  export declare const cancelJob: (jobId: string) => void;
@@ -37,7 +37,7 @@ const notifyClientsOfJobUpdate = () => {
37
37
  });
38
38
  });
39
39
  };
40
- const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, }) => {
40
+ const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, fixedConfig, }) => {
41
41
  if (job.type === 'still') {
42
42
  await (0, process_still_1.processStill)({
43
43
  job,
@@ -45,6 +45,7 @@ const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanu
45
45
  entryPoint,
46
46
  onProgress,
47
47
  addCleanupCallback,
48
+ fixedConfig,
48
49
  });
49
50
  return;
50
51
  }
@@ -56,14 +57,15 @@ const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanu
56
57
  onProgress,
57
58
  addCleanupCallback,
58
59
  logLevel,
60
+ fixedConfig,
59
61
  });
60
62
  return;
61
63
  }
62
64
  throw new Error(`Unknown job ${JSON.stringify(job)}`);
63
65
  };
64
- const addJob = ({ job, entryPoint, remotionRoot, logLevel, }) => {
66
+ const addJob = ({ job, entryPoint, remotionRoot, logLevel, fixedConfig, }) => {
65
67
  jobQueue.push(job);
66
- processJobIfPossible({ entryPoint, remotionRoot, logLevel });
68
+ processJobIfPossible({ entryPoint, remotionRoot, logLevel, fixedConfig });
67
69
  notifyClientsOfJobUpdate();
68
70
  };
69
71
  exports.addJob = addJob;
@@ -92,7 +94,7 @@ const cancelJob = (jobId) => {
92
94
  }
93
95
  };
94
96
  exports.cancelJob = cancelJob;
95
- const processJobIfPossible = async ({ remotionRoot, entryPoint, logLevel, }) => {
97
+ const processJobIfPossible = async ({ remotionRoot, entryPoint, logLevel, fixedConfig, }) => {
96
98
  const runningJob = jobQueue.find((q) => {
97
99
  return q.status === 'running';
98
100
  });
@@ -160,6 +162,7 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, logLevel, }) =>
160
162
  jobCleanups.push({ label, job: cleanup });
161
163
  },
162
164
  logLevel,
165
+ fixedConfig,
163
166
  });
164
167
  log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.gray('╰─ Done in ' + (Date.now() - startTime) + 'ms.'));
165
168
  const { unwatch } = studio_server_1.StudioServerInternals.installFileWatcher({
@@ -219,5 +222,5 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, logLevel, }) =>
219
222
  return job();
220
223
  }));
221
224
  }
222
- processJobIfPossible({ remotionRoot, entryPoint, logLevel });
225
+ processJobIfPossible({ remotionRoot, entryPoint, logLevel, fixedConfig });
223
226
  };
@@ -0,0 +1,5 @@
1
+ export type StudioRenderJobFixedConfig = {
2
+ readonly publicDir: string | null;
3
+ readonly rendererPort: number | null;
4
+ readonly rspack: boolean;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -163,7 +163,7 @@ const bundleOnCli = async ({ fullPath, remotionRoot, publicDir, onProgressCallba
163
163
  maxTimelineTracks,
164
164
  bufferStateDelayInMilliseconds,
165
165
  audioLatencyHint,
166
- renderDefaults: (0, get_render_defaults_1.getRenderDefaults)(),
166
+ renderDefaults: (0, get_render_defaults_1.getRenderDefaults)(logLevel),
167
167
  });
168
168
  bundlingState = {
169
169
  progress: 1,
package/dist/studio.js CHANGED
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.studioCommand = void 0;
4
4
  const client_1 = require("@remotion/renderer/client");
5
5
  const studio_server_1 = require("@remotion/studio-server");
6
+ const chalk_1 = require("./chalk");
6
7
  const config_1 = require("./config");
7
8
  const convert_entry_point_to_serve_url_1 = require("./convert-entry-point-to-serve-url");
8
9
  const entry_point_1 = require("./entry-point");
10
+ const get_config_file_name_1 = require("./get-config-file-name");
9
11
  const get_env_1 = require("./get-env");
10
12
  const get_github_repository_1 = require("./get-github-repository");
11
13
  const get_input_props_1 = require("./get-input-props");
@@ -32,6 +34,37 @@ const studioCommand = async (remotionRoot, args, logLevel) => {
32
34
  const desiredPort = (_b = (_a = portOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value) !== null && _a !== void 0 ? _a : config_1.ConfigInternals.getStudioPort()) !== null && _b !== void 0 ? _b : null;
33
35
  const fullEntryPath = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(file);
34
36
  studio_server_1.StudioServerInternals.setFileWatcherRegistry(studio_server_1.StudioServerInternals.createFileWatcherRegistry());
37
+ const configFile = (0, get_config_file_name_1.getLoadedConfigFile)();
38
+ if (configFile) {
39
+ let isReloadingConfig = false;
40
+ studio_server_1.StudioServerInternals.installFileWatcher({
41
+ file: configFile,
42
+ existenceOnly: false,
43
+ onChange: async () => {
44
+ if (isReloadingConfig) {
45
+ return;
46
+ }
47
+ isReloadingConfig = true;
48
+ try {
49
+ const configWasReloaded = await (0, get_config_file_name_1.reloadConfig)({
50
+ resetConfigOptions: config_1.ConfigInternals.resetConfigOptions,
51
+ });
52
+ if (!configWasReloaded) {
53
+ return;
54
+ }
55
+ log_1.Log.info({ indent: false, logLevel }, chalk_1.chalk.blue('Config file changed. Reloading Studio'));
56
+ studio_server_1.StudioServerInternals.waitForLiveEventsListener().then((listener) => {
57
+ listener.sendEventToClient({
58
+ type: 'config-file-changed',
59
+ });
60
+ });
61
+ }
62
+ finally {
63
+ isReloadingConfig = false;
64
+ }
65
+ },
66
+ });
67
+ }
35
68
  let inputProps = (0, get_input_props_1.getInputProps)((newProps) => {
36
69
  studio_server_1.StudioServerInternals.waitForLiveEventsListener().then((listener) => {
37
70
  inputProps = newProps;
@@ -62,6 +95,7 @@ const studioCommand = async (remotionRoot, args, logLevel) => {
62
95
  const relativePublicDir = publicDirOption.getValue({
63
96
  commandLine: parsed_cli_1.parsedCli,
64
97
  }).value;
98
+ const rendererPort = config_1.ConfigInternals.getRendererPortFromConfigFile();
65
99
  const enableCrossSiteIsolation = enableCrossSiteIsolationOption.getValue({
66
100
  commandLine: parsed_cli_1.parsedCli,
67
101
  }).value;
@@ -89,6 +123,9 @@ const studioCommand = async (remotionRoot, args, logLevel) => {
89
123
  }).value,
90
124
  bufferStateDelayInMilliseconds: config_1.ConfigInternals.getBufferStateDelayInMilliseconds(),
91
125
  });
126
+ const getNumberOfAudioTags = () => numberOfSharedAudioTagsOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
127
+ const getAudioLatencyHint = () => audioLatencyHintOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
128
+ const getPreviewSampleRate = () => previewSampleRateOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
92
129
  const result = await studio_server_1.StudioServerInternals.startStudio({
93
130
  previewEntry: require.resolve('@remotion/studio/previewEntry'),
94
131
  browserArgs: parsed_cli_1.parsedCli['browser-args'],
@@ -105,13 +142,18 @@ const studioCommand = async (remotionRoot, args, logLevel) => {
105
142
  relativePublicDir,
106
143
  webpackOverride: config_1.ConfigInternals.getWebpackOverrideFn(),
107
144
  poll: webpackPollOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value,
108
- getRenderDefaults: get_render_defaults_1.getRenderDefaults,
145
+ getRenderDefaults: () => (0, get_render_defaults_1.getRenderDefaults)(logLevel),
109
146
  getRenderQueue: queue_1.getRenderQueue,
110
- numberOfAudioTags: numberOfSharedAudioTagsOption.getValue({
111
- commandLine: parsed_cli_1.parsedCli,
112
- }).value,
147
+ getNumberOfAudioTags,
113
148
  queueMethods: {
114
- addJob: queue_1.addJob,
149
+ addJob: (options) => (0, queue_1.addJob)({
150
+ ...options,
151
+ fixedConfig: {
152
+ publicDir: relativePublicDir,
153
+ rendererPort,
154
+ rspack: useRspack,
155
+ },
156
+ }),
115
157
  cancelJob: queue_1.cancelJob,
116
158
  removeJob: queue_1.removeJob,
117
159
  },
@@ -119,12 +161,8 @@ const studioCommand = async (remotionRoot, args, logLevel) => {
119
161
  bufferStateDelayInMilliseconds: config_1.ConfigInternals.getBufferStateDelayInMilliseconds(),
120
162
  binariesDirectory,
121
163
  forceIPv4: ipv4Option.getValue({ commandLine: parsed_cli_1.parsedCli }).value,
122
- audioLatencyHint: audioLatencyHintOption.getValue({
123
- commandLine: parsed_cli_1.parsedCli,
124
- }).value,
125
- previewSampleRate: previewSampleRateOption.getValue({
126
- commandLine: parsed_cli_1.parsedCli,
127
- }).value,
164
+ getAudioLatencyHint,
165
+ getPreviewSampleRate,
128
166
  enableCrossSiteIsolation,
129
167
  askAIEnabled,
130
168
  interactivityEnabled,
package/dist/upgrade.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const resolveExtraPackageVersions: (dependencies: Record<string, string>) => Record<string, string>;
1
2
  type DepsWithVersions = {
2
3
  dependencies: Record<string, string>;
3
4
  devDependencies: Record<string, string>;
package/dist/upgrade.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.upgradeCommand = exports.getPackagesToUpgrade = void 0;
3
+ exports.upgradeCommand = exports.getPackagesToUpgrade = exports.resolveExtraPackageVersions = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const renderer_1 = require("@remotion/renderer");
6
6
  const studio_server_1 = require("@remotion/studio-server");
@@ -9,17 +9,24 @@ const chalk_1 = require("./chalk");
9
9
  const extra_packages_1 = require("./extra-packages");
10
10
  const list_of_remotion_packages_1 = require("./list-of-remotion-packages");
11
11
  const log_1 = require("./log");
12
+ const resolveExtraPackageVersions = (dependencies) => {
13
+ const extraVersions = { ...extra_packages_1.EXTRA_PACKAGES };
14
+ for (const pkg of Object.keys(extra_packages_1.EXTRA_PACKAGES)) {
15
+ if (dependencies[pkg]) {
16
+ extraVersions[pkg] = dependencies[pkg];
17
+ }
18
+ else if (pkg.startsWith('@mediabunny/') && dependencies.mediabunny) {
19
+ extraVersions[pkg] = dependencies.mediabunny;
20
+ }
21
+ }
22
+ return extraVersions;
23
+ };
24
+ exports.resolveExtraPackageVersions = resolveExtraPackageVersions;
12
25
  const getExtraPackageVersionsForRemotionVersion = (remotionVersion) => {
13
26
  try {
14
27
  const output = (0, node_child_process_1.execSync)(`npm view @remotion/studio@${remotionVersion} dependencies --json`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
15
28
  const dependencies = JSON.parse(output);
16
- const extraVersions = {};
17
- for (const pkg of Object.keys(extra_packages_1.EXTRA_PACKAGES)) {
18
- if (dependencies[pkg]) {
19
- extraVersions[pkg] = dependencies[pkg];
20
- }
21
- }
22
- return extraVersions;
29
+ return (0, exports.resolveExtraPackageVersions)(dependencies);
23
30
  }
24
31
  catch (_a) {
25
32
  // If we can't fetch the versions, return the default versions from EXTRA_PACKAGES
@@ -27,7 +34,7 @@ const getExtraPackageVersionsForRemotionVersion = (remotionVersion) => {
27
34
  }
28
35
  };
29
36
  const getPackagesToUpgrade = ({ depsWithVersions, catalogEntries, targetVersion, extraPackageVersions, }) => {
30
- var _a;
37
+ var _a, _b;
31
38
  const allDeps = [
32
39
  ...Object.keys(depsWithVersions.dependencies),
33
40
  ...Object.keys(depsWithVersions.devDependencies),
@@ -45,7 +52,7 @@ const getPackagesToUpgrade = ({ depsWithVersions, catalogEntries, targetVersion,
45
52
  const catalogPackagesToUpgrade = [];
46
53
  for (const pkg of allPackagesToUpgrade) {
47
54
  const versionSpec = (0, catalog_utils_1.findVersionSpecifier)(depsWithVersions, pkg);
48
- const targetVersionForPkg = (_a = extraPackageVersions[pkg]) !== null && _a !== void 0 ? _a : targetVersion;
55
+ const targetVersionForPkg = (_b = (_a = extraPackageVersions[pkg]) !== null && _a !== void 0 ? _a : extra_packages_1.EXTRA_PACKAGES[pkg]) !== null && _b !== void 0 ? _b : targetVersion;
49
56
  if ((versionSpec && (0, catalog_utils_1.isCatalogProtocol)(versionSpec)) ||
50
57
  (!versionSpec && catalogPackages.has(pkg))) {
51
58
  catalogPackagesToUpgrade.push({ pkg, version: targetVersionForPkg });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/cli"
4
4
  },
5
5
  "name": "@remotion/cli",
6
- "version": "4.0.494",
6
+ "version": "4.0.495",
7
7
  "description": "Control Remotion features using the `npx remotion` command",
8
8
  "main": "dist/index.js",
9
9
  "bin": {
@@ -36,17 +36,17 @@
36
36
  "author": "Jonny Burger <jonny@remotion.dev>",
37
37
  "license": "SEE LICENSE IN LICENSE.md",
38
38
  "dependencies": {
39
- "@remotion/bundler": "4.0.494",
40
- "@remotion/media-utils": "4.0.494",
41
- "@remotion/player": "4.0.494",
42
- "@remotion/renderer": "4.0.494",
43
- "@remotion/studio-shared": "4.0.494",
44
- "@remotion/studio-server": "4.0.494",
45
- "@remotion/studio": "4.0.494",
39
+ "@remotion/bundler": "4.0.495",
40
+ "@remotion/media-utils": "4.0.495",
41
+ "@remotion/player": "4.0.495",
42
+ "@remotion/renderer": "4.0.495",
43
+ "@remotion/studio-shared": "4.0.495",
44
+ "@remotion/studio-server": "4.0.495",
45
+ "@remotion/studio": "4.0.495",
46
46
  "dotenv": "17.3.1",
47
47
  "minimist": "1.2.6",
48
48
  "prompts": "2.4.2",
49
- "remotion": "4.0.494"
49
+ "remotion": "4.0.495"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=16.8.0",
@@ -57,14 +57,14 @@
57
57
  "@types/prompts": "2.4.9",
58
58
  "@types/prettier": "2.7.2",
59
59
  "@types/node": "20.12.14",
60
- "@remotion/zod-types": "4.0.494",
61
- "@remotion/tailwind-v4": "4.0.494",
62
- "@remotion/enable-scss": "4.0.494",
63
- "@remotion/skia": "4.0.494",
60
+ "@remotion/zod-types": "4.0.495",
61
+ "@remotion/tailwind-v4": "4.0.495",
62
+ "@remotion/enable-scss": "4.0.495",
63
+ "@remotion/skia": "4.0.495",
64
64
  "react": "19.2.3",
65
65
  "react-dom": "19.2.3",
66
66
  "zod": "4.3.6",
67
- "@remotion/eslint-config-internal": "4.0.494",
67
+ "@remotion/eslint-config-internal": "4.0.495",
68
68
  "eslint": "9.19.0",
69
69
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
70
70
  },