@remotion/cli 4.0.14 → 4.0.16

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.
@@ -0,0 +1 @@
1
+ export declare const cloudrunCommand: (remotionRoot: string, args: string[]) => Promise<never>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cloudrunCommand = void 0;
4
+ const log_1 = require("./log");
5
+ const get_package_manager_1 = require("./preview-server/get-package-manager");
6
+ const update_available_1 = require("./preview-server/update-available");
7
+ const cloudrunCommand = async (remotionRoot, args) => {
8
+ try {
9
+ const path = require.resolve('@remotion/cloudrun', {
10
+ paths: [remotionRoot],
11
+ });
12
+ const { CloudrunInternals } = require(path);
13
+ await CloudrunInternals.executeCommand(args, remotionRoot);
14
+ process.exit(0);
15
+ }
16
+ catch (err) {
17
+ const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot, undefined);
18
+ const installCommand = manager === 'unknown' ? 'npm i' : manager.installCommand;
19
+ log_1.Log.error(err);
20
+ log_1.Log.error('Remotion CloudRun is not installed.');
21
+ log_1.Log.info('');
22
+ log_1.Log.info('You can install it using:');
23
+ log_1.Log.info(`${installCommand} @remotion/cloudrun@${(0, update_available_1.getRemotionVersion)()}`);
24
+ process.exit(1);
25
+ }
26
+ };
27
+ exports.cloudrunCommand = cloudrunCommand;
@@ -56,6 +56,11 @@ const findEndPosition = (input, currentPosition) => {
56
56
  const nextEnd = input.indexOf('}', asConstVersion + currentPosition + 1);
57
57
  return nextEnd - 1;
58
58
  }
59
+ // When updating e.g. `defaultProps={{union: {type: 'car' as const, color: ''}}}`
60
+ const nextTriple = input.indexOf('}}}', currentPosition + 1);
61
+ if (nextTriple !== -1) {
62
+ return nextTriple + 1;
63
+ }
59
64
  const next = input.indexOf('}}', currentPosition + 1);
60
65
  if (next !== -1) {
61
66
  return next;
@@ -59,6 +59,6 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultPro
59
59
  if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
60
60
  return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
61
61
  }
62
- return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { value: value, setValue: setValue, jsonPath: [], schema: schema, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }));
62
+ return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, value: value, setValue: setValue, jsonPath: [], schema: schema, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }));
63
63
  };
64
64
  exports.SchemaEditor = SchemaEditor;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { z } from 'zod';
3
+ import type { JSONPath } from './zod-types';
4
+ import type { UpdaterFunction } from './ZodSwitch';
5
+ export declare const ZodDiscriminatedUnionEditor: React.FC<{
6
+ schema: z.ZodTypeAny;
7
+ setValue: UpdaterFunction<Record<string, unknown>>;
8
+ value: Record<string, unknown>;
9
+ defaultValue: Record<string, unknown>;
10
+ mayPad: boolean;
11
+ jsonPath: JSONPath;
12
+ onRemove: null | (() => void);
13
+ onSave: UpdaterFunction<unknown>;
14
+ showSaveButton: boolean;
15
+ saving: boolean;
16
+ saveDisabledByParent: boolean;
17
+ }>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodDiscriminatedUnionEditor = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const Checkmark_1 = require("../../../icons/Checkmark");
7
+ const get_zod_if_possible_1 = require("../../get-zod-if-possible");
8
+ const ComboBox_1 = require("../../NewComposition/ComboBox");
9
+ const create_zod_values_1 = require("./create-zod-values");
10
+ const Fieldset_1 = require("./Fieldset");
11
+ const local_state_1 = require("./local-state");
12
+ const SchemaLabel_1 = require("./SchemaLabel");
13
+ const ZodObjectEditor_1 = require("./ZodObjectEditor");
14
+ const ZodDiscriminatedUnionEditor = ({ schema, setValue, showSaveButton, saving, value, defaultValue, saveDisabledByParent, onSave, mayPad, jsonPath, onRemove, }) => {
15
+ const z = (0, get_zod_if_possible_1.useZodIfPossible)();
16
+ if (!z) {
17
+ throw new Error('expected zod');
18
+ }
19
+ const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
20
+ const typedSchema = schema._def;
21
+ const options = (0, react_1.useMemo)(() => [...typedSchema.optionsMap.keys()], [typedSchema.optionsMap]);
22
+ const { localValue, onChange: setLocalValue, reset, } = (0, local_state_1.useLocalState)({
23
+ schema,
24
+ setValue,
25
+ value,
26
+ defaultValue,
27
+ });
28
+ const comboBoxValues = (0, react_1.useMemo)(() => {
29
+ return options.map((option) => {
30
+ return {
31
+ value: option,
32
+ label: option,
33
+ id: option,
34
+ keyHint: null,
35
+ leftItem: option === value[typedSchema.discriminator] ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
36
+ onClick: () => {
37
+ const val = (0, create_zod_values_1.createZodValues)(typedSchema.optionsMap.get(option), z, zodTypes);
38
+ setLocalValue(() => val, false, false);
39
+ },
40
+ quickSwitcherLabel: null,
41
+ subMenu: null,
42
+ type: 'item',
43
+ };
44
+ });
45
+ }, [
46
+ options,
47
+ setLocalValue,
48
+ typedSchema.discriminator,
49
+ typedSchema.optionsMap,
50
+ value,
51
+ z,
52
+ zodTypes,
53
+ ]);
54
+ const save = (0, react_1.useCallback)(() => {
55
+ onSave(() => value, false, false);
56
+ }, [onSave, value]);
57
+ const discriminatedUnionReplacement = (0, react_1.useMemo)(() => {
58
+ return {
59
+ discriminator: typedSchema.discriminator,
60
+ markup: ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: true, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value[typedSchema.discriminator] ===
61
+ defaultValue[typedSchema.discriminator], jsonPath: [...jsonPath, typedSchema.discriminator], onRemove: onRemove, onReset: reset, onSave: save, saveDisabledByParent: saveDisabledByParent, saving: saving, showSaveButton: showSaveButton, suffix: null, valid: localValue.zodValidation.success }), (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[typedSchema.discriminator] })] })),
62
+ };
63
+ }, [
64
+ comboBoxValues,
65
+ defaultValue,
66
+ jsonPath,
67
+ localValue.value,
68
+ localValue.zodValidation.success,
69
+ mayPad,
70
+ onRemove,
71
+ reset,
72
+ save,
73
+ saveDisabledByParent,
74
+ saving,
75
+ showSaveButton,
76
+ typedSchema.discriminator,
77
+ value,
78
+ ]);
79
+ return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor
80
+ // Re-render the object editor when the discriminator changes
81
+ , { jsonPath: jsonPath, mayPad: mayPad, defaultValue: defaultValue, onRemove: onRemove, onSave: onSave, saveDisabledByParent: saveDisabledByParent, saving: saving, schema: typedSchema.optionsMap.get(value[typedSchema.discriminator]), setValue: setLocalValue, showSaveButton: showSaveButton, value: value, discriminatedUnionReplacement: discriminatedUnionReplacement }, value[typedSchema.discriminator]));
82
+ };
83
+ exports.ZodDiscriminatedUnionEditor = ZodDiscriminatedUnionEditor;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import type { z } from 'zod';
3
3
  import type { JSONPath } from './zod-types';
4
4
  import type { UpdaterFunction } from './ZodSwitch';
5
+ export type ObjectDiscrimatedUnionReplacement = {
6
+ discriminator: string;
7
+ markup: React.ReactNode;
8
+ };
5
9
  export declare const ZodObjectEditor: React.FC<{
6
10
  schema: z.ZodTypeAny;
7
11
  jsonPath: JSONPath;
@@ -14,4 +18,5 @@ export declare const ZodObjectEditor: React.FC<{
14
18
  saving: boolean;
15
19
  saveDisabledByParent: boolean;
16
20
  mayPad: boolean;
21
+ discriminatedUnionReplacement: ObjectDiscrimatedUnionReplacement | null;
17
22
  }>;
@@ -35,7 +35,7 @@ const SchemaLabel_1 = require("./SchemaLabel");
35
35
  const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
36
36
  const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
37
37
  const ZodSwitch_1 = require("./ZodSwitch");
38
- const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
38
+ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, discriminatedUnionReplacement, }) => {
39
39
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
40
40
  if (!z) {
41
41
  throw new Error('expected zod');
@@ -62,6 +62,10 @@ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSa
62
62
  return localValue.value;
63
63
  }, false, false);
64
64
  }, saveDisabledByParent: saveDisabledByParent, saving: saving, showSaveButton: showSaveButton, valid: localValue.zodValidation.success })), (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: isRoot, children: keys.map((key, i) => {
65
+ if (discriminatedUnionReplacement &&
66
+ key === discriminatedUnionReplacement.discriminator) {
67
+ return discriminatedUnionReplacement.markup;
68
+ }
65
69
  return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, jsonPath: [...jsonPath, key], schema: shape[key], value: localValue.value[key],
66
70
  // In case of null | {a: string, b: string} type, we need to fallback to the default value
67
71
  defaultValue: (defaultValue !== null && defaultValue !== void 0 ? defaultValue : value)[key], setValue: (val, forceApply) => {
@@ -45,6 +45,6 @@ const ZodOrNullishEditor = ({ jsonPath, schema, setValue, onSave, defaultValue,
45
45
  const save = (0, react_1.useCallback)(() => {
46
46
  onSave(() => value, false, false);
47
47
  }, [onSave, value]);
48
- return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [localValue.value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null })) : ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: localValue.value, setValue: setLocalValue, jsonPath: jsonPath, schema: innerSchema, defaultValue: value, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: false })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
48
+ return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [localValue.value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null })) : ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: localValue.value, setValue: setLocalValue, jsonPath: jsonPath, schema: innerSchema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: false })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
49
49
  };
50
50
  exports.ZodOrNullishEditor = ZodOrNullishEditor;
@@ -8,6 +8,7 @@ const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
8
8
  const ZodColorEditor_1 = require("./ZodColorEditor");
9
9
  const ZodDateEditor_1 = require("./ZodDateEditor");
10
10
  const ZodDefaultEditor_1 = require("./ZodDefaultEditor");
11
+ const ZodDiscriminatedUnionEditor_1 = require("./ZodDiscriminatedUnionEditor");
11
12
  const ZodEffectEditor_1 = require("./ZodEffectEditor");
12
13
  const ZodEnumEditor_1 = require("./ZodEnumEditor");
13
14
  const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
@@ -28,7 +29,7 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, defaultValue, onSave, sh
28
29
  }
29
30
  const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
30
31
  if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
31
- return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
32
+ return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, discriminatedUnionReplacement: null }));
32
33
  }
33
34
  if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
34
35
  if (value.startsWith(window.remotion_staticBase)) {
@@ -86,6 +87,9 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, defaultValue, onSave, sh
86
87
  if (typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
87
88
  return ((0, jsx_runtime_1.jsx)(ZodDefaultEditor_1.ZodDefaultEditor, { jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
88
89
  }
90
+ if (typeName === z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion) {
91
+ return ((0, jsx_runtime_1.jsx)(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { defaultValue: defaultValue, mayPad: mayPad, schema: schema, setValue: setValue, value: value, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, saving: saving, saveDisabledByParent: saveDisabledByParent, showSaveButton: showSaveButton }));
92
+ }
89
93
  return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)`, saving: saving, mayPad: mayPad }));
90
94
  };
91
95
  exports.ZodSwitch = ZodSwitch;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Codec } from '@remotion/renderer';
3
2
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
4
3
  type Section = 'general' | 'picture' | 'advanced' | 'data' | 'gif' | 'audio';
@@ -27,8 +27,8 @@ const handleCommonError = async (err, logLevel) => {
27
27
  }
28
28
  if (err.message.includes('Error creating WebGL context')) {
29
29
  log_1.Log.info();
30
- log_1.Log.info('💡 You might need to set the OpenGL renderer to "angle"');
31
- log_1.Log.info('💡 Get help for this issue at https://www.remotion.dev/docs/three');
30
+ log_1.Log.warn('💡 You might need to set the OpenGL renderer to "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
31
+ log_1.Log.warn("💡 Check how it's done at https://www.remotion.dev/docs/chromium-flags#--gl");
32
32
  }
33
33
  if (err.message.includes('The bucket does not allow ACLs')) {
34
34
  log_1.Log.info();
package/dist/index.d.ts CHANGED
@@ -136,6 +136,7 @@ export declare const CliInternals: {
136
136
  "every-nth-frame": number;
137
137
  "number-of-gif-loops": number;
138
138
  "number-of-shared-audio-tags": number;
139
+ version: string;
139
140
  codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
140
141
  concurrency: number;
141
142
  timeout: number;
package/dist/index.js CHANGED
@@ -90,7 +90,7 @@ const cli = async () => {
90
90
  (0, ffmpeg_1.ffprobeCommand)(remotionRoot, process.argv.slice(3));
91
91
  }
92
92
  else if (command === 'upgrade') {
93
- await (0, upgrade_1.upgrade)(remotionRoot, parse_command_line_1.parsedCli['package-manager']);
93
+ await (0, upgrade_1.upgrade)(remotionRoot, parse_command_line_1.parsedCli['package-manager'], parse_command_line_1.parsedCli.version);
94
94
  }
95
95
  else if (command === versions_1.VERSIONS_COMMAND) {
96
96
  await (0, versions_1.versionsCommand)(remotionRoot);
@@ -0,0 +1,12 @@
1
+ import type { LogLevel, RenderMediaOnDownload } from '@remotion/renderer';
2
+ import type { DownloadProgress } from './progress-types';
3
+ export declare const makeOnDownload: ({ indent, logLevel, updatesDontOverwrite, downloads, updateRenderProgress, }: {
4
+ indent: boolean;
5
+ logLevel: LogLevel;
6
+ updatesDontOverwrite: boolean;
7
+ downloads: DownloadProgress[];
8
+ updateRenderProgress: (progress: {
9
+ newline: boolean;
10
+ printToConsole: boolean;
11
+ }) => void;
12
+ }) => RenderMediaOnDownload;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeOnDownload = void 0;
4
+ const format_bytes_1 = require("./format-bytes");
5
+ const log_1 = require("./log");
6
+ const makeOnDownload = ({ indent, logLevel, updatesDontOverwrite, downloads, updateRenderProgress, }) => {
7
+ return (src) => {
8
+ const id = Math.random();
9
+ const download = {
10
+ id,
11
+ name: src,
12
+ progress: 0,
13
+ downloaded: 0,
14
+ totalBytes: null,
15
+ };
16
+ const nextDownloadIndex = downloads.length;
17
+ downloads.push(download);
18
+ log_1.Log.verboseAdvanced({ indent, logLevel }, `Starting download [${nextDownloadIndex}]:`, src);
19
+ updateRenderProgress({
20
+ newline: false,
21
+ printToConsole: !updatesDontOverwrite,
22
+ });
23
+ let lastUpdate = Date.now();
24
+ return ({ percent, downloaded, totalSize }) => {
25
+ download.progress = percent;
26
+ download.totalBytes = totalSize;
27
+ download.downloaded = downloaded;
28
+ if (lastUpdate + 1000 > Date.now() && updatesDontOverwrite) {
29
+ return;
30
+ }
31
+ lastUpdate = Date.now();
32
+ log_1.Log.verboseAdvanced({ indent, logLevel }, `Download [${nextDownloadIndex}]:`, percent ? `${(percent * 100).toFixed(1)}%` : (0, format_bytes_1.formatBytes)(downloaded));
33
+ updateRenderProgress({
34
+ newline: false,
35
+ printToConsole: !updatesDontOverwrite,
36
+ });
37
+ };
38
+ };
39
+ };
40
+ exports.makeOnDownload = makeOnDownload;
@@ -11,6 +11,7 @@ type CommandLineOptions = {
11
11
  ['every-nth-frame']: number;
12
12
  ['number-of-gif-loops']: number;
13
13
  ['number-of-shared-audio-tags']: number;
14
+ version: string;
14
15
  codec: Codec;
15
16
  concurrency: number;
16
17
  timeout: number;
@@ -37,7 +37,7 @@ const processStill = async ({ job, remotionRoot, entryPoint, onProgress, addClea
37
37
  imageFormatFromUi: job.imageFormat,
38
38
  logLevel: job.verbose ? 'verbose' : 'info',
39
39
  onProgress,
40
- indentOutput: true,
40
+ indent: true,
41
41
  addCleanupCallback,
42
42
  cancelSignal: job.cancelToken.cancelSignal,
43
43
  outputLocationFromUi: job.outName,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  import type { LiveEventsServer } from './live-events';
4
3
  export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, }: {
@@ -5,6 +5,7 @@ const renderer_1 = require("@remotion/renderer");
5
5
  const ansi_diff_1 = require("./ansi/ansi-diff");
6
6
  const chalk_1 = require("./chalk");
7
7
  const download_progress_1 = require("./download-progress");
8
+ const format_bytes_1 = require("./format-bytes");
8
9
  const make_progress_bar_1 = require("./make-progress-bar");
9
10
  const truthy_1 = require("./truthy");
10
11
  const createOverwriteableCliOutput = (options) => {
@@ -171,13 +172,7 @@ const getGuiProgressSubtitle = (progress) => {
171
172
  return `Bundling ${Math.round(progress.bundling.progress * 100)}%`;
172
173
  }
173
174
  if (progress.copyingState.doneIn === null) {
174
- const bytes = new Intl.NumberFormat('en', {
175
- notation: 'compact',
176
- style: 'unit',
177
- unit: 'byte',
178
- unitDisplay: 'narrow',
179
- });
180
- return `Copying public dir ${bytes.format(progress.copyingState.bytes)}`;
175
+ return `Copying public dir ${(0, format_bytes_1.formatBytes)(progress.copyingState.bytes)}`;
181
176
  }
182
177
  if (!progress.rendering) {
183
178
  return `Getting compositions`;
@@ -40,6 +40,7 @@ const get_filename_1 = require("../get-filename");
40
40
  const get_final_output_codec_1 = require("../get-final-output-codec");
41
41
  const image_formats_1 = require("../image-formats");
42
42
  const log_1 = require("../log");
43
+ const make_on_download_1 = require("../make-on-download");
43
44
  const parse_command_line_1 = require("../parse-command-line");
44
45
  const progress_bar_1 = require("../progress-bar");
45
46
  const setup_cache_1 = require("../setup-cache");
@@ -83,7 +84,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
83
84
  bytes: 0,
84
85
  doneIn: null,
85
86
  };
86
- const updateRenderProgress = (newline) => {
87
+ const updateRenderProgress = ({ newline, printToConsole, }) => {
87
88
  const aggregateRenderProgress = {
88
89
  rendering: renderingProgress,
89
90
  stitching: shouldOutputImageSequence ? null : stitchingProgress,
@@ -97,7 +98,9 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
97
98
  stitchingStep: steps.indexOf('stitching'),
98
99
  });
99
100
  onProgress({ message, value: progress, ...aggregateRenderProgress });
100
- return renderProgress.update(updatesDontOverwrite ? message : output, newline);
101
+ if (printToConsole) {
102
+ renderProgress.update(updatesDontOverwrite ? message : output, newline);
103
+ }
101
104
  };
102
105
  const { urlOrBundle, cleanup: cleanupBundle } = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
103
106
  fullPath: fullEntryPoint,
@@ -106,7 +109,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
106
109
  onProgress: ({ bundling, copying }) => {
107
110
  bundlingProgress = bundling;
108
111
  copyingState = copying;
109
- updateRenderProgress(false);
112
+ updateRenderProgress({ newline: false, printToConsole: true });
110
113
  },
111
114
  indentOutput: indent,
112
115
  logLevel,
@@ -118,24 +121,13 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
118
121
  quietProgress: updatesDontOverwrite,
119
122
  });
120
123
  addCleanupCallback(() => cleanupBundle());
121
- const onDownload = (src) => {
122
- const id = Math.random();
123
- const download = {
124
- id,
125
- name: src,
126
- progress: 0,
127
- downloaded: 0,
128
- totalBytes: null,
129
- };
130
- downloads.push(download);
131
- updateRenderProgress(false);
132
- return ({ percent, downloaded, totalSize }) => {
133
- download.progress = percent;
134
- download.totalBytes = totalSize;
135
- download.downloaded = downloaded;
136
- updateRenderProgress(false);
137
- };
138
- };
124
+ const onDownload = (0, make_on_download_1.makeOnDownload)({
125
+ downloads,
126
+ indent,
127
+ logLevel,
128
+ updateRenderProgress,
129
+ updatesDontOverwrite,
130
+ });
139
131
  const puppeteerInstance = await browserInstance;
140
132
  addCleanupCallback(() => puppeteerInstance.close(false, logLevel, indent));
141
133
  const actualConcurrency = renderer_1.RenderInternals.getActualConcurrency(concurrency);
@@ -220,7 +212,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
220
212
  serializedInputPropsWithCustomSchema,
221
213
  onFrameUpdate: (rendered) => {
222
214
  renderingProgress.frames = rendered;
223
- updateRenderProgress(false);
215
+ updateRenderProgress({ newline: false, printToConsole: true });
224
216
  },
225
217
  onStart: () => undefined,
226
218
  onDownload,
@@ -251,7 +243,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
251
243
  data: config.props,
252
244
  }).serializedString,
253
245
  });
254
- updateRenderProgress(true);
246
+ updateRenderProgress({ newline: true, printToConsole: true });
255
247
  log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.blue(`▶ ${absoluteOutputFile}`));
256
248
  return;
257
249
  }
@@ -303,7 +295,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
303
295
  update.renderedDoneIn;
304
296
  renderingProgress.frames =
305
297
  update.renderedFrames;
306
- updateRenderProgress(false);
298
+ updateRenderProgress({ newline: false, printToConsole: true });
307
299
  },
308
300
  puppeteerInstance,
309
301
  onDownload,
@@ -323,7 +315,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
323
315
  staticBase: null,
324
316
  }).serializedString,
325
317
  });
326
- updateRenderProgress(true);
318
+ updateRenderProgress({ newline: true, printToConsole: true });
327
319
  log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.blue(`${exists ? '○' : '+'} ${absoluteOutputFile}`));
328
320
  log_1.Log.verboseAdvanced({ indent, logLevel }, `Slowest frames:`);
329
321
  slowestFrames.forEach(({ frame, time }) => {
@@ -1,6 +1,6 @@
1
1
  import type { Browser, BrowserExecutable, CancelSignal, ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
2
2
  import type { JobProgressCallback } from '../preview-server/render-queue/job';
3
- export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, height, serializedInputPropsWithCustomSchema, overwrite, port, publicDir, puppeteerTimeout, jpegQuality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, onProgress, indentOutput, addCleanupCallback, cancelSignal, outputLocationFromUi, }: {
3
+ export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, height, serializedInputPropsWithCustomSchema, overwrite, port, publicDir, puppeteerTimeout, jpegQuality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, onProgress, indent, addCleanupCallback, cancelSignal, outputLocationFromUi, }: {
4
4
  remotionRoot: string;
5
5
  fullEntryPoint: string;
6
6
  entryPointReason: string;
@@ -23,7 +23,7 @@ export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPoin
23
23
  imageFormatFromUi: StillImageFormat | null;
24
24
  logLevel: LogLevel;
25
25
  onProgress: JobProgressCallback;
26
- indentOutput: boolean;
26
+ indent: boolean;
27
27
  addCleanupCallback: (cb: () => void) => void;
28
28
  cancelSignal: CancelSignal | null;
29
29
  outputLocationFromUi: string | null;
@@ -16,6 +16,7 @@ const determine_image_format_1 = require("../determine-image-format");
16
16
  const get_cli_options_1 = require("../get-cli-options");
17
17
  const get_composition_with_dimension_override_1 = require("../get-composition-with-dimension-override");
18
18
  const log_1 = require("../log");
19
+ const make_on_download_1 = require("../make-on-download");
19
20
  const parse_command_line_1 = require("../parse-command-line");
20
21
  const progress_bar_1 = require("../progress-bar");
21
22
  const progress_types_1 = require("../progress-types");
@@ -23,36 +24,40 @@ const setup_cache_1 = require("../setup-cache");
23
24
  const should_use_non_overlaying_logger_1 = require("../should-use-non-overlaying-logger");
24
25
  const truthy_1 = require("../truthy");
25
26
  const user_passed_output_location_1 = require("../user-passed-output-location");
26
- const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, height, serializedInputPropsWithCustomSchema, overwrite, port, publicDir, puppeteerTimeout, jpegQuality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, onProgress, indentOutput, addCleanupCallback, cancelSignal, outputLocationFromUi, }) => {
27
+ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, height, serializedInputPropsWithCustomSchema, overwrite, port, publicDir, puppeteerTimeout, jpegQuality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, onProgress, indent, addCleanupCallback, cancelSignal, outputLocationFromUi, }) => {
27
28
  var _a, _b;
28
- const downloads = [];
29
29
  const aggregate = (0, progress_types_1.initialAggregateRenderProgress)();
30
30
  const updatesDontOverwrite = (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel });
31
- let renderProgress = null;
31
+ const renderProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
32
+ quiet: (0, parse_command_line_1.quietFlagProvided)(),
33
+ cancelSignal,
34
+ updatesDontOverwrite: (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel }),
35
+ indent,
36
+ });
32
37
  const steps = [
33
38
  renderer_1.RenderInternals.isServeUrl(fullEntryPoint) ? null : 'bundling',
34
39
  'rendering',
35
40
  ].filter(truthy_1.truthy);
36
- const updateProgress = (newline) => {
41
+ const updateRenderProgress = ({ newline, printToConsole, }) => {
37
42
  const { output, progress, message } = (0, progress_bar_1.makeRenderingAndStitchingProgress)({
38
43
  prog: aggregate,
39
44
  steps: steps.length,
40
45
  stitchingStep: steps.indexOf('stitching'),
41
46
  });
42
- if (renderProgress) {
47
+ if (printToConsole) {
43
48
  renderProgress.update(updatesDontOverwrite ? message : output, newline);
44
49
  }
45
50
  onProgress({ message, value: progress, ...aggregate });
46
51
  };
47
52
  if (browserExecutable) {
48
- log_1.Log.verboseAdvanced({ indent: indentOutput, logLevel }, 'Browser executable: ', browserExecutable);
53
+ log_1.Log.verboseAdvanced({ indent, logLevel }, 'Browser executable: ', browserExecutable);
49
54
  }
50
55
  const browserInstance = renderer_1.RenderInternals.internalOpenBrowser({
51
56
  browser,
52
57
  browserExecutable,
53
58
  chromiumOptions,
54
59
  forceDeviceScaleFactor: scale,
55
- indent: indentOutput,
60
+ indent,
56
61
  viewport: null,
57
62
  logLevel,
58
63
  });
@@ -64,9 +69,9 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
64
69
  onProgress: ({ copying, bundling }) => {
65
70
  aggregate.bundling = bundling;
66
71
  aggregate.copyingState = copying;
67
- updateProgress(false);
72
+ updateRenderProgress({ newline: false, printToConsole: true });
68
73
  },
69
- indentOutput,
74
+ indentOutput: indent,
70
75
  logLevel,
71
76
  bundlingStep: steps.indexOf('bundling'),
72
77
  onDirectoryCreated: (dir) => {
@@ -78,7 +83,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
78
83
  });
79
84
  const server = await renderer_1.RenderInternals.prepareServer({
80
85
  concurrency: 1,
81
- indent: indentOutput,
86
+ indent,
82
87
  port,
83
88
  remotionRoot,
84
89
  logLevel,
@@ -87,7 +92,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
87
92
  addCleanupCallback(() => server.closeServer(false));
88
93
  addCleanupCallback(() => cleanupBundle());
89
94
  const puppeteerInstance = await browserInstance;
90
- addCleanupCallback(() => puppeteerInstance.close(false, logLevel, indentOutput));
95
+ addCleanupCallback(() => puppeteerInstance.close(false, logLevel, indent));
91
96
  const { compositionId, config, reason, argsAfterComposition } = await (0, get_composition_with_dimension_override_1.getCompositionWithDimensionOverride)({
92
97
  height,
93
98
  width,
@@ -96,7 +101,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
96
101
  browserExecutable,
97
102
  chromiumOptions,
98
103
  envVariables,
99
- indent: indentOutput,
104
+ indent,
100
105
  serializedInputPropsWithCustomSchema,
101
106
  port,
102
107
  puppeteerInstance,
@@ -125,14 +130,8 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
125
130
  (0, node_fs_1.mkdirSync)(node_path_1.default.join(absoluteOutputLocation, '..'), {
126
131
  recursive: true,
127
132
  });
128
- log_1.Log.verboseAdvanced({ indent: indentOutput, logLevel }, chalk_1.chalk.gray(`Entry point = ${fullEntryPoint} (${entryPointReason})`));
129
- log_1.Log.infoAdvanced({ indent: indentOutput, logLevel }, chalk_1.chalk.gray(`Composition = ${compositionId} (${reason}), Format = ${imageFormat} (${source}), Output = ${relativeOutputLocation}`));
130
- renderProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
131
- quiet: (0, parse_command_line_1.quietFlagProvided)(),
132
- cancelSignal,
133
- updatesDontOverwrite: (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel }),
134
- indent: indentOutput,
135
- });
133
+ log_1.Log.verboseAdvanced({ indent, logLevel }, chalk_1.chalk.gray(`Entry point = ${fullEntryPoint} (${entryPointReason})`));
134
+ log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.gray(`Composition = ${compositionId} (${reason}), Format = ${imageFormat} (${source}), Output = ${relativeOutputLocation}`));
136
135
  const renderStart = Date.now();
137
136
  aggregate.rendering = {
138
137
  frames: 0,
@@ -141,23 +140,14 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
141
140
  steps,
142
141
  totalFrames: 1,
143
142
  };
144
- updateProgress(false);
145
- const onDownload = (src) => {
146
- const id = Math.random();
147
- const download = {
148
- id,
149
- name: src,
150
- progress: 0,
151
- downloaded: 0,
152
- totalBytes: null,
153
- };
154
- downloads.push(download);
155
- updateProgress(false);
156
- return ({ percent }) => {
157
- download.progress = percent;
158
- updateProgress(false);
159
- };
160
- };
143
+ updateRenderProgress({ newline: false, printToConsole: true });
144
+ const onDownload = (0, make_on_download_1.makeOnDownload)({
145
+ downloads: aggregate.downloads,
146
+ indent,
147
+ logLevel,
148
+ updateRenderProgress,
149
+ updatesDontOverwrite,
150
+ });
161
151
  await renderer_1.RenderInternals.internalRenderStill({
162
152
  composition: config,
163
153
  frame: stillFrame,
@@ -177,7 +167,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
177
167
  puppeteerInstance,
178
168
  server: await server,
179
169
  cancelSignal,
180
- indent: indentOutput,
170
+ indent,
181
171
  onBrowserLog: null,
182
172
  logLevel,
183
173
  serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
@@ -193,7 +183,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
193
183
  steps,
194
184
  totalFrames: 1,
195
185
  };
196
- updateProgress(true);
197
- log_1.Log.infoAdvanced({ indent: indentOutput, logLevel }, chalk_1.chalk.blue(`${exists ? '○' : '+'} ${absoluteOutputLocation}`));
186
+ updateRenderProgress({ newline: true, printToConsole: true });
187
+ log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.blue(`${exists ? '○' : '+'} ${absoluteOutputLocation}`));
198
188
  };
199
189
  exports.renderStillFlow = renderStillFlow;
package/dist/still.js CHANGED
@@ -54,7 +54,7 @@ const still = async (remotionRoot, args) => {
54
54
  imageFormatFromUi: null,
55
55
  logLevel,
56
56
  onProgress: () => undefined,
57
- indentOutput: false,
57
+ indent: false,
58
58
  addCleanupCallback: (c) => {
59
59
  (0, cleanup_before_quit_1.registerCleanupJob)(c);
60
60
  },
package/dist/upgrade.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const upgrade: (remotionRoot: string, packageManager: string | undefined) => Promise<void>;
1
+ export declare const upgrade: (remotionRoot: string, packageManager: string | undefined, version: string | undefined) => Promise<void>;
package/dist/upgrade.js CHANGED
@@ -20,7 +20,7 @@ const getUpgradeCommand = ({ manager, packages, version, }) => {
20
20
  };
21
21
  return commands[manager];
22
22
  };
23
- const upgrade = async (remotionRoot, packageManager) => {
23
+ const upgrade = async (remotionRoot, packageManager, version) => {
24
24
  var _a, _b, _c, _d;
25
25
  const packageJsonFilePath = node_path_1.default.join(remotionRoot, 'package.json');
26
26
  const packageJson = require(packageJsonFilePath);
@@ -28,8 +28,15 @@ const upgrade = async (remotionRoot, packageManager) => {
28
28
  const devDependencies = Object.keys((_a = packageJson.devDependencies) !== null && _a !== void 0 ? _a : {});
29
29
  const optionalDependencies = Object.keys((_b = packageJson.optionalDependencies) !== null && _b !== void 0 ? _b : {});
30
30
  const peerDependencies = Object.keys((_c = packageJson.peerDependencies) !== null && _c !== void 0 ? _c : {});
31
- const latestRemotionVersion = await (0, get_latest_remotion_version_1.getLatestRemotionVersion)();
32
- log_1.Log.info('Newest Remotion version is', latestRemotionVersion);
31
+ let targetVersion;
32
+ if (version) {
33
+ targetVersion = version;
34
+ log_1.Log.info('Upgrading to specified version: ' + version);
35
+ }
36
+ else {
37
+ targetVersion = await (0, get_latest_remotion_version_1.getLatestRemotionVersion)();
38
+ log_1.Log.info('Newest Remotion version is', targetVersion);
39
+ }
33
40
  const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot, packageManager);
34
41
  if (manager === 'unknown') {
35
42
  throw new Error(`No lockfile was found in your project (one of ${get_package_manager_1.lockFilePaths
@@ -43,7 +50,7 @@ const upgrade = async (remotionRoot, packageManager) => {
43
50
  const prom = renderer_1.RenderInternals.execa(manager.manager, getUpgradeCommand({
44
51
  manager: manager.manager,
45
52
  packages: toUpgrade,
46
- version: latestRemotionVersion,
53
+ version: targetVersion,
47
54
  }), {
48
55
  stdio: 'inherit',
49
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -35,11 +35,11 @@
35
35
  "prompts": "2.4.1",
36
36
  "semver": "7.5.3",
37
37
  "source-map": "0.6.1",
38
- "@remotion/bundler": "4.0.14",
39
- "@remotion/media-utils": "4.0.14",
40
- "@remotion/player": "4.0.14",
41
- "@remotion/renderer": "4.0.14",
42
- "remotion": "4.0.14"
38
+ "remotion": "4.0.16",
39
+ "@remotion/media-utils": "4.0.16",
40
+ "@remotion/player": "4.0.16",
41
+ "@remotion/bundler": "4.0.16",
42
+ "@remotion/renderer": "4.0.16"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
@@ -65,8 +65,8 @@
65
65
  "typescript": "4.9.5",
66
66
  "vitest": "0.31.1",
67
67
  "zod": "^3.21.4",
68
- "@remotion/zod-types": "4.0.14",
69
- "@remotion/tailwind": "4.0.14"
68
+ "@remotion/tailwind": "4.0.16",
69
+ "@remotion/zod-types": "4.0.16"
70
70
  },
71
71
  "keywords": [
72
72
  "remotion",