@remotion/cli 4.0.0-alpha6 → 4.0.0-alpha7

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 (117) hide show
  1. package/dist/benchmark.js +9 -4
  2. package/dist/chalk/index.d.ts +45 -54
  3. package/dist/chalk/index.js +2 -135
  4. package/dist/codemods/stringify-with-path.d.ts +5 -0
  5. package/dist/codemods/stringify-with-path.js +44 -0
  6. package/dist/codemods/update-default-props.d.ts +3 -1
  7. package/dist/codemods/update-default-props.js +3 -17
  8. package/dist/compositions.js +1 -0
  9. package/dist/config/log.d.ts +1 -3
  10. package/dist/config/log.js +2 -9
  11. package/dist/download-progress.d.ts +1 -1
  12. package/dist/download-progress.js +1 -5
  13. package/dist/editor/components/NewComposition/ComboBox.js +2 -2
  14. package/dist/editor/components/NewComposition/MenuContent.js +1 -1
  15. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  16. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  17. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  18. package/dist/editor/components/RenderModal/RenderModalData.js +21 -7
  19. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  20. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -1
  21. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +3 -2
  22. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
  23. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
  24. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
  25. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
  26. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -8
  27. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
  28. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +5 -5
  29. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +3 -2
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +3 -2
  32. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -4
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +9 -6
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -1
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +40 -7
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +16 -0
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +73 -0
  42. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
  43. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +5 -5
  44. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -1
  45. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
  46. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
  47. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
  48. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
  49. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +12 -0
  50. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +32 -0
  51. package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +3 -2
  52. package/dist/editor/components/RenderModal/get-render-modal-warnings.js +9 -2
  53. package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
  54. package/dist/editor/components/RenderQueue/actions.js +8 -4
  55. package/dist/editor/components/Timeline/TimelineSequence.js +6 -4
  56. package/dist/editor/helpers/calculate-timeline.js +1 -1
  57. package/dist/ffmpeg.js +6 -2
  58. package/dist/handle-common-errors.d.ts +2 -1
  59. package/dist/handle-common-errors.js +2 -2
  60. package/dist/index.d.ts +9 -5
  61. package/dist/index.js +4 -5
  62. package/dist/log.d.ts +5 -5
  63. package/dist/log.js +3 -42
  64. package/dist/parse-command-line.d.ts +1 -0
  65. package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
  66. package/dist/preview-server/render-queue/job.d.ts +2 -0
  67. package/dist/preview-server/render-queue/queue.js +2 -1
  68. package/dist/preview-server/routes/can-update-default-props.js +1 -0
  69. package/dist/preview-server/routes/update-default-props.js +4 -3
  70. package/dist/print-error.d.ts +2 -1
  71. package/dist/print-error.js +8 -5
  72. package/dist/progress-bar.d.ts +5 -4
  73. package/dist/progress-bar.js +42 -29
  74. package/dist/render-flows/render.js +46 -19
  75. package/dist/render-flows/still.js +17 -12
  76. package/dist/setup-cache.d.ts +2 -1
  77. package/dist/setup-cache.js +8 -4
  78. package/dist/should-use-non-overlaying-logger.d.ts +4 -0
  79. package/dist/should-use-non-overlaying-logger.js +12 -0
  80. package/dist/user-passed-output-location.js +7 -2
  81. package/package.json +7 -7
  82. package/dist/ansi/ansi-regex.d.ts +0 -2
  83. package/dist/ansi/ansi-regex.js +0 -18
  84. package/dist/cloudrun-command.d.ts +0 -1
  85. package/dist/cloudrun-command.js +0 -27
  86. package/dist/config/ffmpeg-executable.d.ts +0 -5
  87. package/dist/config/ffmpeg-executable.js +0 -21
  88. package/dist/config/quality.d.ts +0 -2
  89. package/dist/config/quality.js +0 -17
  90. package/dist/editor/components/ClipboardIcon.d.ts +0 -2
  91. package/dist/editor/components/ClipboardIcon.js +0 -12
  92. package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
  93. package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
  94. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -6
  95. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -24
  96. package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
  97. package/dist/editor/components/RichTimelineToggle.js +0 -29
  98. package/dist/editor/components/Thumbnail.d.ts +0 -8
  99. package/dist/editor/components/Thumbnail.js +0 -76
  100. package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
  101. package/dist/editor/helpers/use-compact-ui.js +0 -18
  102. package/dist/editor/icons/film.d.ts +0 -3
  103. package/dist/editor/icons/film.js +0 -8
  104. package/dist/editor/icons/timeline.d.ts +0 -3
  105. package/dist/editor/icons/timeline.js +0 -9
  106. package/dist/editor/state/rich-timeline.d.ts +0 -9
  107. package/dist/editor/state/rich-timeline.js +0 -17
  108. package/dist/get-render-media-options.d.ts +0 -8
  109. package/dist/get-render-media-options.js +0 -55
  110. package/dist/install.d.ts +0 -2
  111. package/dist/install.js +0 -36
  112. package/dist/is-javascript.d.ts +0 -2
  113. package/dist/is-javascript.js +0 -9
  114. package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
  115. package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
  116. package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
  117. package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
package/dist/benchmark.js CHANGED
@@ -16,6 +16,7 @@ const parse_command_line_1 = require("./parse-command-line");
16
16
  const progress_bar_1 = require("./progress-bar");
17
17
  const select_composition_1 = require("./select-composition");
18
18
  const setup_cache_1 = require("./setup-cache");
19
+ const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
19
20
  const truthy_1 = require("./truthy");
20
21
  const DEFAULT_RUNS = 3;
21
22
  const getValidConcurrency = (cliConcurrency) => {
@@ -104,6 +105,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
104
105
  shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
105
106
  chromiumOptions,
106
107
  forceDeviceScaleFactor: scale,
108
+ indent: false,
107
109
  });
108
110
  const { urlOrBundle: bundleLocation, cleanup: cleanupBundle } = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
109
111
  fullPath: fullEntryPoint,
@@ -117,6 +119,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
117
119
  onDirectoryCreated: (dir) => {
118
120
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
119
121
  },
122
+ quietProgress: false,
120
123
  });
121
124
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
122
125
  const puppeteerInstance = await browserInstance;
@@ -154,7 +157,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
154
157
  uiCodec: null,
155
158
  });
156
159
  for (const composition of compositions) {
157
- const { proResProfile, frameRange: defaultFrameRange, overwrite, jpegQuality, crf: configFileCrf, pixelFormat, scale: configFileScale, numberOfGifLoops, everyNthFrame, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, height, width, concurrency: unparsedConcurrency, } = await (0, get_cli_options_1.getCliOptions)({
160
+ const { proResProfile, frameRange: defaultFrameRange, overwrite, jpegQuality, crf: configFileCrf, pixelFormat, scale: configFileScale, numberOfGifLoops, everyNthFrame, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, height, width, concurrency: unparsedConcurrency, logLevel, } = await (0, get_cli_options_1.getCliOptions)({
158
161
  isLambda: false,
159
162
  type: 'series',
160
163
  remotionRoot,
@@ -165,6 +168,8 @@ const benchmarkCommand = async (remotionRoot, args) => {
165
168
  const benchmarkProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
166
169
  quiet: (0, parse_command_line_1.quietFlagProvided)(),
167
170
  cancelSignal: null,
171
+ updatesDontOverwrite: (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel }),
172
+ indent: false,
168
173
  });
169
174
  log_1.Log.info();
170
175
  log_1.Log.info(`${chalk_1.chalk.bold(`Benchmark #${count++}:`)} ${chalk_1.chalk.gray(`composition=${composition.id} concurrency=${con} codec=${codec} (${codecReason})`)}`);
@@ -211,10 +216,10 @@ const benchmarkCommand = async (remotionRoot, args) => {
211
216
  run,
212
217
  doneIn: null,
213
218
  progress,
214
- }));
219
+ }), false);
215
220
  });
216
- benchmarkProgress.update('');
217
- benchmarkProgress.update(getResults(timeTaken, runs));
221
+ benchmarkProgress.update('', false);
222
+ benchmarkProgress.update(getResults(timeTaken, runs), false);
218
223
  benchmark[composition.id][`${con}`] = timeTaken;
219
224
  }
220
225
  }
@@ -1,58 +1,49 @@
1
- declare type Style = {
2
- codes: [number, number];
3
- name: string;
4
- wrap?: (input: string, newline: boolean) => string;
5
- };
6
- declare type Method = (str: string) => string;
7
- declare type Colors = {
1
+ export declare const chalk: {
8
2
  enabled: boolean;
9
3
  visible: boolean;
10
- styles: Record<string, Style>;
4
+ styles: Record<string, {
5
+ codes: [number, number];
6
+ name: string;
7
+ wrap?: ((input: string, newline: boolean) => string) | undefined;
8
+ }>;
11
9
  keys: Record<string, string[]>;
12
- alias?: (name: string, col: string) => void;
13
- };
14
- declare type ColorsWithMethods = Colors & {
15
- reset: Method;
16
- bold: Method;
17
- dim: Method;
18
- italic: Method;
19
- underline: Method;
20
- inverse: Method;
21
- hidden: Method;
22
- strikethrough: Method;
23
- black: Method;
24
- red: Method;
25
- green: Method;
26
- yellow: Method;
27
- blue: Method;
28
- magenta: Method;
29
- cyan: Method;
30
- white: Method;
31
- gray: Method;
32
- bgBlack: Method;
33
- bgRed: Method;
34
- bgGreen: Method;
35
- bgYellow: Method;
36
- bgBlue: Method;
37
- bgMagenta: Method;
38
- bgCyan: Method;
39
- bgWhite: Method;
40
- blackBright: Method;
41
- redBright: Method;
42
- greenBright: Method;
43
- yellowBright: Method;
44
- blueBright: Method;
45
- magentaBright: Method;
46
- cyanBright: Method;
47
- whiteBright: Method;
48
- bgBlackBright: Method;
49
- bgRedBright: Method;
50
- bgGreenBright: Method;
51
- bgYellowBright: Method;
52
- bgBlueBright: Method;
53
- bgMagentaBright: Method;
54
- bgCyanBright: Method;
55
- bgWhiteBright: Method;
10
+ alias?: ((name: string, col: string) => void) | undefined;
11
+ } & {
12
+ reset: (str: string) => string;
13
+ bold: (str: string) => string;
14
+ dim: (str: string) => string;
15
+ italic: (str: string) => string;
16
+ underline: (str: string) => string;
17
+ inverse: (str: string) => string;
18
+ hidden: (str: string) => string;
19
+ strikethrough: (str: string) => string;
20
+ black: (str: string) => string;
21
+ red: (str: string) => string;
22
+ green: (str: string) => string;
23
+ yellow: (str: string) => string;
24
+ blue: (str: string) => string;
25
+ magenta: (str: string) => string;
26
+ white: (str: string) => string;
27
+ gray: (str: string) => string;
28
+ bgBlack: (str: string) => string;
29
+ bgRed: (str: string) => string;
30
+ bgGreen: (str: string) => string;
31
+ bgYellow: (str: string) => string;
32
+ bgBlue: (str: string) => string;
33
+ bgMagenta: (str: string) => string;
34
+ bgWhite: (str: string) => string;
35
+ blackBright: (str: string) => string;
36
+ redBright: (str: string) => string;
37
+ greenBright: (str: string) => string;
38
+ yellowBright: (str: string) => string;
39
+ blueBright: (str: string) => string;
40
+ magentaBright: (str: string) => string;
41
+ whiteBright: (str: string) => string;
42
+ bgBlackBright: (str: string) => string;
43
+ bgRedBright: (str: string) => string;
44
+ bgGreenBright: (str: string) => string;
45
+ bgYellowBright: (str: string) => string;
46
+ bgBlueBright: (str: string) => string;
47
+ bgMagentaBright: (str: string) => string;
48
+ bgWhiteBright: (str: string) => string;
56
49
  };
57
- export declare const chalk: ColorsWithMethods;
58
- export {};
@@ -1,138 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chalk = void 0;
4
- const hasColor = () => {
5
- if (typeof process !== 'undefined') {
6
- return process.env.FORCE_COLOR !== '0';
7
- }
8
- return false;
9
- };
10
- exports.chalk = (() => {
11
- const colors = {
12
- enabled: hasColor(),
13
- visible: true,
14
- styles: {},
15
- keys: {},
16
- };
17
- const ansi = (st) => {
18
- const open = `\u001b[${st.codes[0]}m`;
19
- const close = `\u001b[${st.codes[1]}m`;
20
- const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, 'g');
21
- st.wrap = (input, newline) => {
22
- if (input.includes(close))
23
- input = input.replace(regex, close + open);
24
- const output = open + input + close;
25
- // see https://github.com/chalk/chalk/pull/92, thanks to the
26
- // chalk contributors for this fix. However, we've confirmed that
27
- // this issue is also present in Windows terminals
28
- return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
29
- };
30
- return st;
31
- };
32
- const wrap = (sty, input, newline) => {
33
- var _a;
34
- return (_a = sty.wrap) === null || _a === void 0 ? void 0 : _a.call(sty, input, newline);
35
- };
36
- const style = (input, stack) => {
37
- if (input === '' || input === null || input === undefined)
38
- return '';
39
- if (colors.enabled === false)
40
- return input;
41
- if (colors.visible === false)
42
- return '';
43
- let str = String(input);
44
- const nl = str.includes('\n');
45
- let n = stack.length;
46
- while (n-- > 0)
47
- str = wrap(colors.styles[stack[n]], str, nl);
48
- return str;
49
- };
50
- const define = (name, codes, type) => {
51
- colors.styles[name] = ansi({ name, codes });
52
- const keys = colors.keys[type] || (colors.keys[type] = []);
53
- keys.push(name);
54
- Reflect.defineProperty(colors, name, {
55
- configurable: true,
56
- enumerable: true,
57
- set(value) {
58
- var _a;
59
- (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
60
- },
61
- get() {
62
- const color = (input) => style(input, color.stack);
63
- Reflect.setPrototypeOf(color, colors);
64
- color.stack = this.stack ? this.stack.concat(name) : [name];
65
- return color;
66
- },
67
- });
68
- };
69
- define('reset', [0, 0], 'modifier');
70
- define('bold', [1, 22], 'modifier');
71
- define('dim', [2, 22], 'modifier');
72
- define('italic', [3, 23], 'modifier');
73
- define('underline', [4, 24], 'modifier');
74
- define('inverse', [7, 27], 'modifier');
75
- define('hidden', [8, 28], 'modifier');
76
- define('strikethrough', [9, 29], 'modifier');
77
- define('black', [30, 39], 'color');
78
- define('red', [31, 39], 'color');
79
- define('green', [32, 39], 'color');
80
- define('yellow', [33, 39], 'color');
81
- define('blue', [34, 39], 'color');
82
- define('magenta', [35, 39], 'color');
83
- define('cyan', [36, 39], 'color');
84
- define('white', [37, 39], 'color');
85
- define('gray', [90, 39], 'color');
86
- define('grey', [90, 39], 'color');
87
- define('bgBlack', [40, 49], 'bg');
88
- define('bgRed', [41, 49], 'bg');
89
- define('bgGreen', [42, 49], 'bg');
90
- define('bgYellow', [43, 49], 'bg');
91
- define('bgBlue', [44, 49], 'bg');
92
- define('bgMagenta', [45, 49], 'bg');
93
- define('bgCyan', [46, 49], 'bg');
94
- define('bgWhite', [47, 49], 'bg');
95
- define('blackBright', [90, 39], 'bright');
96
- define('redBright', [91, 39], 'bright');
97
- define('greenBright', [92, 39], 'bright');
98
- define('yellowBright', [93, 39], 'bright');
99
- define('blueBright', [94, 39], 'bright');
100
- define('magentaBright', [95, 39], 'bright');
101
- define('cyanBright', [96, 39], 'bright');
102
- define('whiteBright', [97, 39], 'bright');
103
- define('bgBlackBright', [100, 49], 'bgBright');
104
- define('bgRedBright', [101, 49], 'bgBright');
105
- define('bgGreenBright', [102, 49], 'bgBright');
106
- define('bgYellowBright', [103, 49], 'bgBright');
107
- define('bgBlueBright', [104, 49], 'bgBright');
108
- define('bgMagentaBright', [105, 49], 'bgBright');
109
- define('bgCyanBright', [106, 49], 'bgBright');
110
- define('bgWhiteBright', [107, 49], 'bgBright');
111
- colors.alias = (name, color) => {
112
- // @ts-expect-error
113
- const fn = colors[color];
114
- if (typeof fn !== 'function') {
115
- throw new TypeError('Expected alias to be the name of an existing color (string) or a function');
116
- }
117
- if (!fn.stack) {
118
- Reflect.defineProperty(fn, 'name', { value: name });
119
- colors.styles[name] = fn;
120
- fn.stack = [name];
121
- }
122
- Reflect.defineProperty(colors, name, {
123
- configurable: true,
124
- enumerable: true,
125
- set(value) {
126
- var _a;
127
- (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
128
- },
129
- get() {
130
- const col = (input) => style(input, col.stack);
131
- Reflect.setPrototypeOf(col, colors);
132
- col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
133
- return col;
134
- },
135
- });
136
- };
137
- return colors;
138
- })();
4
+ const renderer_1 = require("@remotion/renderer");
5
+ exports.chalk = renderer_1.RenderInternals.chalk;
@@ -0,0 +1,5 @@
1
+ import type { EnumPath } from '../editor/components/RenderModal/SchemaEditor/extract-enum-json-paths';
2
+ export declare const stringifyDefaultProps: ({ props, enumPaths, }: {
3
+ props: unknown;
4
+ enumPaths: EnumPath[];
5
+ }) => string;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyDefaultProps = void 0;
4
+ const input_props_serialization_1 = require("../editor/components/RenderModal/SchemaEditor/input-props-serialization");
5
+ const doesMatchPath = (path1, enumPaths) => {
6
+ return enumPaths.some((p) => path1.every((item, index) => {
7
+ if (p[index] === '[]' && !Number.isNaN(Number(item))) {
8
+ return true;
9
+ }
10
+ if (p[index] === '{}' && typeof item === 'string') {
11
+ return true;
12
+ }
13
+ return item === p[index];
14
+ }));
15
+ };
16
+ const stringifyDefaultProps = ({ props, enumPaths, }) => JSON.stringify(props, replacerWithPath(function (key, value, path) {
17
+ /* Don't replace with arrow function */ const item = this[key];
18
+ if (item instanceof Date) {
19
+ return `__REMOVEQUOTE__new Date('${item.toISOString()}')__REMOVEQUOTE__`;
20
+ }
21
+ if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {
22
+ return `${item}__ADD_AS_CONST__`;
23
+ }
24
+ if (typeof item === 'string' && item.startsWith(input_props_serialization_1.FILE_TOKEN)) {
25
+ return `__REMOVEQUOTE____WRAP_IN_STATIC_FILE_START__${decodeURIComponent(item.replace(input_props_serialization_1.FILE_TOKEN, ''))}__WRAP_IN_STATIC_FILE_END____REMOVEQUOTE__`;
26
+ }
27
+ return value;
28
+ }))
29
+ .replace(/"__REMOVEQUOTE__/g, '')
30
+ .replace(/__REMOVEQUOTE__"/g, '')
31
+ .replace(/__ADD_AS_CONST__"/g, '" as const')
32
+ .replace(/__WRAP_IN_STATIC_FILE_START__/g, 'staticFile("')
33
+ .replace(/__WRAP_IN_STATIC_FILE_END__/g, '")');
34
+ exports.stringifyDefaultProps = stringifyDefaultProps;
35
+ function replacerWithPath(replacer) {
36
+ const m = new Map();
37
+ return function (field, value) {
38
+ const path = [m.get(this), field].flat(1);
39
+ if (value === Object(value)) {
40
+ m.set(value, path);
41
+ }
42
+ return replacer.call(this, field, value, path.filter((item) => typeof item !== 'undefined' && item !== ''));
43
+ };
44
+ }
@@ -1,5 +1,7 @@
1
- export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, }: {
1
+ import type { EnumPath } from '../editor/components/RenderModal/SchemaEditor/extract-enum-json-paths';
2
+ export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, enumPaths, }: {
2
3
  input: string;
3
4
  compositionId: string;
4
5
  newDefaultProps: unknown;
6
+ enumPaths: EnumPath[];
5
7
  }) => Promise<string>;
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.updateDefaultProps = void 0;
27
+ const stringify_with_path_1 = require("./stringify-with-path");
27
28
  const findStarter = ({ input, compositionId, }) => {
28
29
  const format1 = input.indexOf(`id="${compositionId}"`);
29
30
  if (format1 > -1) {
@@ -85,23 +86,8 @@ const findTerminators = (input, position) => {
85
86
  }
86
87
  return Infinity;
87
88
  };
88
- const stringifyDefaultProps = (props) => {
89
- // Don't replace with arrow function
90
- return JSON.stringify(props, function (key, value) {
91
- if (this[key] instanceof Date) {
92
- return `__REMOVEQUOTE__new Date('${new Date(this[key]).toISOString()}')__REMOVEQUOTE__`;
93
- }
94
- if (typeof this[key] === 'string') {
95
- return `${this[key]}__ADD_AS_CONST__`;
96
- }
97
- return value;
98
- })
99
- .replace(/"__REMOVEQUOTE__/g, '')
100
- .replace(/__REMOVEQUOTE__"/g, '')
101
- .replace(/__ADD_AS_CONST__"/g, '" as const');
102
- };
103
89
  // TODO: Add more sanity checks
104
- const updateDefaultProps = async ({ input, compositionId, newDefaultProps, }) => {
90
+ const updateDefaultProps = async ({ input, compositionId, newDefaultProps, enumPaths, }) => {
105
91
  const starter = findStarter({ input, compositionId });
106
92
  const START_TOKEN = 'defaultProps={';
107
93
  const start = input.indexOf(START_TOKEN, starter);
@@ -120,7 +106,7 @@ const updateDefaultProps = async ({ input, compositionId, newDefaultProps, }) =>
120
106
  }
121
107
  const { format, resolveConfig, resolveConfigFile } = prettier;
122
108
  const newFile = input.substring(0, startPos) +
123
- stringifyDefaultProps(newDefaultProps) +
109
+ (0, stringify_with_path_1.stringifyDefaultProps)({ props: newDefaultProps, enumPaths }) +
124
110
  input.substring(endPos);
125
111
  const configFilePath = await resolveConfigFile();
126
112
  if (!configFilePath) {
@@ -39,6 +39,7 @@ const listCompositionsCommand = async (remotionRoot, args) => {
39
39
  onDirectoryCreated: (dir) => {
40
40
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
41
41
  },
42
+ quietProgress: false,
42
43
  });
43
44
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
44
45
  const compositions = await (0, renderer_1.getCompositions)(bundled, {
@@ -1,3 +1 @@
1
- import type { LogLevel } from '@remotion/renderer';
2
- export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
3
- export declare const setLogLevel: (newLogLevel: LogLevel) => void;
1
+ export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error", setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
@@ -1,12 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setLogLevel = exports.getLogLevel = void 0;
4
- let logLevel = 'info';
5
- const getLogLevel = () => {
6
- return logLevel;
7
- };
8
- exports.getLogLevel = getLogLevel;
9
- const setLogLevel = (newLogLevel) => {
10
- logLevel = newLogLevel;
11
- };
12
- exports.setLogLevel = setLogLevel;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ exports.getLogLevel = renderer_1.RenderInternals.getLogLevel, exports.setLogLevel = renderer_1.RenderInternals.setLogLevel;
@@ -1,3 +1,3 @@
1
1
  import type { DownloadProgress } from './progress-types';
2
2
  export declare const getFileSizeDownloadBar: (downloaded: number) => string;
3
- export declare const makeMultiDownloadProgress: (progresses: DownloadProgress[], indent: boolean) => string | null;
3
+ export declare const makeMultiDownloadProgress: (progresses: DownloadProgress[]) => string | null;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeMultiDownloadProgress = exports.getFileSizeDownloadBar = void 0;
4
4
  const format_bytes_1 = require("./format-bytes");
5
- const log_1 = require("./log");
6
5
  const make_progress_bar_1 = require("./make-progress-bar");
7
6
  const truthy_1 = require("./truthy");
8
7
  const getFileSizeDownloadBar = (downloaded) => {
@@ -10,7 +9,7 @@ const getFileSizeDownloadBar = (downloaded) => {
10
9
  return `[${(0, format_bytes_1.formatBytes)(downloaded).padEnd(desiredLength - 2, ' ')}]`;
11
10
  };
12
11
  exports.getFileSizeDownloadBar = getFileSizeDownloadBar;
13
- const makeMultiDownloadProgress = (progresses, indent) => {
12
+ const makeMultiDownloadProgress = (progresses) => {
14
13
  if (progresses.length === 0) {
15
14
  return null;
16
15
  }
@@ -20,7 +19,6 @@ const makeMultiDownloadProgress = (progresses, indent) => {
20
19
  ? progress.name.substring(0, 57) + '...'
21
20
  : progress.name;
22
21
  return [
23
- indent ? log_1.INDENT_TOKEN : null,
24
22
  ` +`,
25
23
  progress.progress
26
24
  ? (0, make_progress_bar_1.makeProgressBar)(progress.progress)
@@ -32,8 +30,6 @@ const makeMultiDownloadProgress = (progresses, indent) => {
32
30
  }
33
31
  const everyFileHasContentLength = progresses.every((p) => p.totalBytes !== null);
34
32
  return [
35
- indent ? log_1.INDENT_TOKEN : null,
36
- // TODO: Shifted 1 character to the right in v4
37
33
  ` +`,
38
34
  everyFileHasContentLength
39
35
  ? (0, make_progress_bar_1.makeProgressBar)(progresses.reduce((a, b) => a + b.progress, 0) /
@@ -137,8 +137,8 @@ const Combobox = ({ values, selectedId, style: customStyle, title }) => {
137
137
  : colors_1.INPUT_BORDER_COLOR_UNHOVERED,
138
138
  };
139
139
  }, [customStyle, hovered, opened]);
140
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { ref: ref, title: title, tabIndex: tabIndex, type: "button", style: style, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: [(0, jsx_runtime_1.jsx)("div", { title: typeof selected.label === 'string' ? selected.label : undefined, style: label, children: selected === null || selected === void 0 ? void 0 : selected.label }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(caret_1.CaretDown, {})] }), portalStyle
141
- ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => v.id === selected.id), topItemCanBeUnselected: false }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
140
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { ref: ref, title: title, tabIndex: tabIndex, type: "button", style: style, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: [selected ? ((0, jsx_runtime_1.jsx)("div", { title: typeof selected.label === 'string' ? selected.label : undefined, style: label, children: selected === null || selected === void 0 ? void 0 : selected.label })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(caret_1.CaretDown, {})] }), portalStyle
141
+ ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => selected && v.id === selected.id), topItemCanBeUnselected: false }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
142
142
  : null] }));
143
143
  };
144
144
  exports.Combobox = Combobox;
@@ -28,7 +28,7 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
28
28
  if (values[0].type === 'divider') {
29
29
  throw new Error('first value cant be divide');
30
30
  }
31
- const [selectedItem, setSelectedItem] = (0, react_1.useState)(typeof preselectIndex === 'number'
31
+ const [selectedItem, setSelectedItem] = (0, react_1.useState)(typeof preselectIndex === 'number' && preselectIndex >= 0
32
32
  ? values[preselectIndex].id
33
33
  : null);
34
34
  const onEscape = (0, react_1.useCallback)(() => {
@@ -13,5 +13,5 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
13
13
  isFocused: boolean;
14
14
  isHovered: boolean;
15
15
  }) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
16
- export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
16
+ export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -3,5 +3,5 @@ import type { RemInputStatus } from './RemInput';
3
3
  declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
4
4
  status: RemInputStatus;
5
5
  };
6
- export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
6
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
7
7
  export {};
@@ -3,5 +3,5 @@ declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextA
3
3
  status: 'error' | 'warning' | 'ok';
4
4
  };
5
5
  export declare const inputBaseStyle: React.CSSProperties;
6
- export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  export {};
@@ -37,7 +37,8 @@ const actions_1 = require("../RenderQueue/actions");
37
37
  const SegmentedControl_1 = require("../SegmentedControl");
38
38
  const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
39
39
  const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
40
- const date_serialization_1 = require("./SchemaEditor/date-serialization");
40
+ const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
41
+ const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
41
42
  const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
42
43
  const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
43
44
  const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
@@ -77,7 +78,7 @@ const tabWrapper = {
77
78
  const persistanceKey = 'remotion.show-render-modalwarning';
78
79
  const parseJSON = (str) => {
79
80
  try {
80
- const value = (0, date_serialization_1.deserializeJSONWithDate)(str);
81
+ const value = (0, input_props_serialization_1.deserializeJSONWithCustomFields)(str);
81
82
  return { str, value, validJSON: true };
82
83
  }
83
84
  catch (e) {
@@ -105,7 +106,11 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
105
106
  return null;
106
107
  }
107
108
  const value = inputProps !== null && inputProps !== void 0 ? inputProps : {};
108
- return (0, date_serialization_1.serializeJSONWithDate)(value, 2);
109
+ return (0, input_props_serialization_1.serializeJSONWithDate)({
110
+ data: value,
111
+ indent: 2,
112
+ staticBase: window.remotion_staticBase,
113
+ });
109
114
  }, [inJSONEditor, inputProps]);
110
115
  const cliProps = (0, remotion_1.getInputProps)();
111
116
  const [canSaveDefaultProps, setCanSaveDefaultProps] = (0, react_1.useState)({
@@ -192,25 +197,34 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
192
197
  setMode('schema');
193
198
  }, []);
194
199
  const onUpdate = (0, react_1.useCallback)(() => {
200
+ if (schema === 'no-zod' || z === null) {
201
+ (0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
202
+ return;
203
+ }
195
204
  setValBeforeSafe(inputProps);
196
- (0, actions_1.updateDefaultProps)(composition.id, inputProps);
197
- }, [composition.id, inputProps]);
205
+ (0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []));
206
+ }, [composition.id, inputProps, schema, z]);
198
207
  (0, react_1.useEffect)(() => {
199
208
  setSaving(false);
200
209
  }, [fastRefreshes]);
201
210
  const onSave = (0, react_1.useCallback)((updater) => {
211
+ if (schema === 'no-zod' || z === null) {
212
+ (0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
213
+ return;
214
+ }
202
215
  setSaving(true);
203
- (0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps)).catch((err) => {
216
+ (0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).catch((err) => {
204
217
  (0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
205
218
  setSaving(false);
206
219
  });
207
- }, [composition.defaultProps, composition.id]);
220
+ }, [composition.defaultProps, composition.id, schema, z]);
208
221
  const connectionStatus = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type;
209
222
  const warnings = (0, react_1.useMemo)(() => {
210
223
  return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
211
224
  canSaveDefaultProps,
212
225
  cliProps,
213
226
  isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
227
+ customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
214
228
  inJSONEditor,
215
229
  propsEditType,
216
230
  });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { State } from './RenderModalData';
3
- import type { SerializedJSONWithDate } from './SchemaEditor/date-serialization';
3
+ import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-serialization';
4
4
  export declare type EditType = 'inputProps' | 'defaultProps';
5
5
  export declare const RenderModalJSONPropsEditor: React.FC<{
6
6
  value: unknown;
@@ -11,5 +11,5 @@ export declare const RenderModalJSONPropsEditor: React.FC<{
11
11
  valBeforeSafe: unknown;
12
12
  showSaveButton: boolean;
13
13
  parseJSON: (str: string) => State;
14
- serializedJSON: SerializedJSONWithDate | null;
14
+ serializedJSON: SerializedJSONWithCustomFields | null;
15
15
  }>;
@@ -54,6 +54,6 @@ const InvalidDefaultProps = ({ zodValidationResult }) => {
54
54
  };
55
55
  exports.InvalidDefaultProps = InvalidDefaultProps;
56
56
  const InvalidSchema = ({ zodValidationResult, reset }) => {
57
- return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the ", (0, jsx_runtime_1.jsx)("code", { children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
57
+ return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
58
58
  };
59
59
  exports.InvalidSchema = InvalidSchema;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { z } from 'zod';
3
3
  import type { JSONPath } from './zod-types';
4
+ import type { UpdaterFunction } from './ZodSwitch';
4
5
  export declare const ZodArrayEditor: React.FC<{
5
6
  schema: z.ZodTypeAny;
6
7
  jsonPath: JSONPath;
7
8
  value: unknown[];
8
9
  defaultValue: unknown[];
9
- setValue: React.Dispatch<React.SetStateAction<unknown[]>>;
10
- onSave: (updater: (oldState: unknown[]) => unknown[]) => void;
10
+ setValue: UpdaterFunction<unknown[]>;
11
+ onSave: UpdaterFunction<unknown[]>;
11
12
  compact: boolean;
12
13
  showSaveButton: boolean;
13
14
  onRemove: null | (() => void);