@remotion/cli 4.1.0-alpha7 → 4.1.0-alpha8

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 (52) hide show
  1. package/dist/benchmark.js +13 -2
  2. package/dist/codemods/stringify-with-path.js +3 -3
  3. package/dist/compositions.js +6 -1
  4. package/dist/config/image-format.d.ts +1 -1
  5. package/dist/config/index.d.ts +1 -1
  6. package/dist/config/log.d.ts +1 -1
  7. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  8. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  9. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  10. package/dist/editor/components/RenderModal/DataEditor.js +3 -3
  11. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -1
  12. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +2 -2
  13. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +1 -1
  14. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  15. package/dist/editor/components/RenderQueue/actions.d.ts +1 -1
  16. package/dist/editor/components/RenderQueue/actions.js +12 -4
  17. package/dist/editor/helpers/colors.d.ts +1 -1
  18. package/dist/editor/helpers/render-modal-sections.d.ts +0 -1
  19. package/dist/error-with-stack-frame.d.ts +19 -0
  20. package/dist/error-with-stack-frame.js +81 -0
  21. package/dist/get-cli-options.d.ts +1 -1
  22. package/dist/get-composition-id.d.ts +2 -2
  23. package/dist/get-composition-id.js +7 -4
  24. package/dist/get-composition-with-dimension-override.d.ts +2 -2
  25. package/dist/get-composition-with-dimension-override.js +2 -2
  26. package/dist/handle-javascript-error.d.ts +20 -0
  27. package/dist/handle-javascript-error.js +81 -0
  28. package/dist/index.d.ts +7 -7
  29. package/dist/log.d.ts +3 -3
  30. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  31. package/dist/preview-server/render-queue/job.d.ts +2 -2
  32. package/dist/preview-server/render-queue/make-retry-payload.js +3 -2
  33. package/dist/preview-server/render-queue/process-still.js +1 -1
  34. package/dist/preview-server/render-queue/process-video.js +1 -1
  35. package/dist/preview-server/routes/add-render.js +2 -2
  36. package/dist/preview-server/routes/update-default-props.js +2 -2
  37. package/dist/preview-server/routes.d.ts +0 -1
  38. package/dist/render-flows/render.d.ts +2 -2
  39. package/dist/render-flows/render.js +18 -7
  40. package/dist/render-flows/still.d.ts +2 -2
  41. package/dist/render-flows/still.js +12 -6
  42. package/dist/render.js +6 -1
  43. package/dist/still.js +6 -1
  44. package/dist/symbolicate-error.d.ts +3 -0
  45. package/dist/symbolicate-error.js +24 -0
  46. package/dist/symbolicate-errors.d.ts +7 -0
  47. package/dist/symbolicate-errors.js +90 -0
  48. package/dist/symbolicate-stacktrace.d.ts +28 -0
  49. package/dist/symbolicate-stacktrace.js +135 -0
  50. package/dist/symbolicateable-error.d.ts +16 -0
  51. package/dist/symbolicateable-error.js +18 -0
  52. package/package.json +8 -8
package/dist/benchmark.js CHANGED
@@ -18,6 +18,7 @@ const setup_cache_1 = require("./setup-cache");
18
18
  const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
19
19
  const show_compositions_picker_1 = require("./show-compositions-picker");
20
20
  const truthy_1 = require("./truthy");
21
+ const remotion_1 = require("remotion");
21
22
  const DEFAULT_RUNS = 3;
22
23
  const getValidConcurrency = (cliConcurrency) => {
23
24
  const { concurrencies } = parse_command_line_1.parsedCli;
@@ -125,9 +126,14 @@ const benchmarkCommand = async (remotionRoot, args) => {
125
126
  });
126
127
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
127
128
  const puppeteerInstance = await browserInstance;
129
+ const serializedInputPropsWithCustomSchema = remotion_1.Internals.serializeJSONWithDate({
130
+ data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
131
+ indent: undefined,
132
+ staticBase: null,
133
+ }).serializedString;
128
134
  const comps = await renderer_1.RenderInternals.internalGetCompositions({
129
135
  serveUrlOrWebpackUrl: bundleLocation,
130
- inputProps,
136
+ serializedInputPropsWithCustomSchema,
131
137
  envVariables,
132
138
  chromiumOptions,
133
139
  timeoutInMilliseconds: puppeteerTimeout,
@@ -191,7 +197,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
191
197
  codec,
192
198
  uiImageFormat: null,
193
199
  }),
194
- inputProps,
200
+ serializedInputPropsWithCustomSchema,
195
201
  overwrite,
196
202
  pixelFormat,
197
203
  proResProfile,
@@ -223,6 +229,11 @@ const benchmarkCommand = async (remotionRoot, args) => {
223
229
  onStart: () => undefined,
224
230
  preferLossless: false,
225
231
  server: undefined,
232
+ serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
233
+ data: composition.props,
234
+ indent: undefined,
235
+ staticBase: null,
236
+ }).serializedString,
226
237
  }, (run, progress) => {
227
238
  benchmarkProgress.update(makeBenchmarkProgressBar({
228
239
  totalRuns: runs,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringifyDefaultProps = void 0;
4
- const input_props_serialization_1 = require("../editor/components/RenderModal/SchemaEditor/input-props-serialization");
4
+ const remotion_1 = require("remotion");
5
5
  const doesMatchPath = (path1, enumPaths) => {
6
6
  return enumPaths.some((p) => path1.every((item, index) => {
7
7
  if (p[index] === '[]' && !Number.isNaN(Number(item))) {
@@ -21,8 +21,8 @@ const stringifyDefaultProps = ({ props, enumPaths, }) => JSON.stringify(props, r
21
21
  if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {
22
22
  return `${item}__ADD_AS_CONST__`;
23
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__`;
24
+ if (typeof item === 'string' && item.startsWith(remotion_1.Internals.FILE_TOKEN)) {
25
+ return `__REMOVEQUOTE____WRAP_IN_STATIC_FILE_START__${decodeURIComponent(item.replace(remotion_1.Internals.FILE_TOKEN, ''))}__WRAP_IN_STATIC_FILE_END____REMOVEQUOTE__`;
26
26
  }
27
27
  return value;
28
28
  }))
@@ -9,6 +9,7 @@ const get_cli_options_1 = require("./get-cli-options");
9
9
  const log_1 = require("./log");
10
10
  const print_compositions_1 = require("./print-compositions");
11
11
  const setup_cache_1 = require("./setup-cache");
12
+ const remotion_1 = require("remotion");
12
13
  const listCompositionsCommand = async (remotionRoot, args) => {
13
14
  const { file, reason } = (0, entry_point_1.findEntryPoint)(args, remotionRoot);
14
15
  if (!file) {
@@ -44,7 +45,11 @@ const listCompositionsCommand = async (remotionRoot, args) => {
44
45
  browserExecutable,
45
46
  chromiumOptions,
46
47
  envVariables,
47
- inputProps,
48
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
49
+ data: inputProps,
50
+ staticBase: null,
51
+ indent: undefined,
52
+ }).serializedString,
48
53
  timeoutInMilliseconds: puppeteerTimeout,
49
54
  port,
50
55
  indent: false,
@@ -2,4 +2,4 @@ import type { StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
2
  export declare const setStillImageFormat: (format: StillImageFormat) => void;
3
3
  export declare const setVideoImageFormat: (format: VideoImageFormat) => void;
4
4
  export declare const getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
5
- export declare const getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
5
+ export declare const getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
@@ -297,7 +297,7 @@ export declare const ConfigInternals: {
297
297
  getShouldOutputImageSequence: (frameRange: FrameRange | null) => boolean;
298
298
  getDotEnvLocation: () => string | null;
299
299
  getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
300
- getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
300
+ getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
301
301
  getWebpackOverrideFn: () => WebpackOverrideFn;
302
302
  getWebpackCaching: () => boolean;
303
303
  getOutputLocation: () => string | null;
@@ -1 +1 @@
1
- export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error", setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
1
+ export declare const getLogLevel: () => "error" | "verbose" | "info" | "warn", setLogLevel: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
@@ -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, "status" | "key" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
16
+ export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -4,5 +4,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>
4
4
  status: RemInputStatus;
5
5
  name: string;
6
6
  };
7
- export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
7
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
8
8
  export {};
@@ -3,5 +3,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextAreaEleme
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, "status" | "key" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  export {};
@@ -39,7 +39,6 @@ const SegmentedControl_1 = require("../SegmentedControl");
39
39
  const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
40
40
  const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
41
41
  const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
42
- const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
43
42
  const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
44
43
  const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
45
44
  const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
@@ -99,7 +98,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
99
98
  return null;
100
99
  }
101
100
  const value = inputProps;
102
- return (0, input_props_serialization_1.serializeJSONWithDate)({
101
+ return remotion_1.Internals.serializeJSONWithDate({
103
102
  data: value,
104
103
  indent: 2,
105
104
  staticBase: window.remotion_staticBase,
@@ -226,12 +225,13 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
226
225
  setSaving(false);
227
226
  }, [fastRefreshes]);
228
227
  const onSave = (0, react_1.useCallback)((updater) => {
228
+ var _a;
229
229
  if (schema === 'no-zod' || schema === 'no-schema' || z === null) {
230
230
  (0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
231
231
  return;
232
232
  }
233
233
  setSaving(true);
234
- (0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater(unresolvedComposition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
234
+ (0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater((_a = unresolvedComposition.defaultProps) !== null && _a !== void 0 ? _a : {}), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
235
235
  .then((response) => {
236
236
  if (!response.success) {
237
237
  console.log(response.stack);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { z } from 'zod';
3
- import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-serialization';
3
+ import type { SerializedJSONWithCustomFields } from 'remotion';
4
4
  export type EditType = 'inputProps' | 'defaultProps';
5
5
  export declare const RenderModalJSONPropsEditor: React.FC<{
6
6
  value: unknown;
@@ -32,8 +32,8 @@ const use_keybinding_1 = require("../../helpers/use-keybinding");
32
32
  const layout_1 = require("../layout");
33
33
  const RemTextarea_1 = require("../NewComposition/RemTextarea");
34
34
  const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
35
- const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
36
35
  const ZodErrorMessages_1 = require("./SchemaEditor/ZodErrorMessages");
36
+ const remotion_1 = require("remotion");
37
37
  const style = {
38
38
  fontFamily: 'monospace',
39
39
  flex: 1,
@@ -46,7 +46,7 @@ const scrollable = {
46
46
  };
47
47
  const parseJSON = (str, schema) => {
48
48
  try {
49
- const value = (0, input_props_serialization_1.deserializeJSONWithCustomFields)(str);
49
+ const value = remotion_1.Internals.deserializeJSONWithCustomFields(str);
50
50
  const zodValidation = schema.safeParse(value);
51
51
  return { str, value, validJSON: true, zodValidation };
52
52
  }
@@ -6,7 +6,7 @@ export declare const SchemaEditor: React.FC<{
6
6
  setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
7
7
  zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
8
8
  defaultProps: Record<string, unknown>;
9
- onSave: (updater: (oldState: unknown) => unknown) => void;
9
+ onSave: (updater: (oldState: Record<string, unknown>) => Record<string, unknown>) => void;
10
10
  showSaveButton: boolean;
11
11
  saving: boolean;
12
12
  saveDisabledByParent: boolean;
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from '@remotion/renderer';
2
- export declare const humanReadableCodec: (codec: Codec) => "GIF" | "AAC" | "MP3" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
2
+ export declare const humanReadableCodec: (codec: Codec) => "AAC" | "MP3" | "GIF" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
@@ -56,5 +56,5 @@ export declare const openInFileExplorer: ({ directory }: {
56
56
  export declare const removeRenderJob: (job: RenderJob) => Promise<undefined>;
57
57
  export declare const cancelRenderJob: (job: RenderJob) => Promise<import("../../../preview-server/render-queue/job").CancelRenderResponse>;
58
58
  export declare const updateAvailable: (signal: AbortSignal) => Promise<import("../../../preview-server/render-queue/job").UpdateAvailableResponse>;
59
- export declare const updateDefaultProps: (compositionId: string, defaultProps: unknown, enumPaths: EnumPath[]) => Promise<import("../../../preview-server/render-queue/job").UpdateDefaultPropsResponse>;
59
+ export declare const updateDefaultProps: (compositionId: string, defaultProps: Record<string, unknown>, enumPaths: EnumPath[]) => Promise<import("../../../preview-server/render-queue/job").UpdateDefaultPropsResponse>;
60
60
  export declare const canUpdateDefaultProps: (compositionId: string) => Promise<import("../../../preview-server/render-queue/job").CanUpdateDefaultPropsResponse>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canUpdateDefaultProps = exports.updateDefaultProps = exports.updateAvailable = exports.cancelRenderJob = exports.removeRenderJob = exports.openInFileExplorer = exports.subscribeToFileExistenceWatcher = exports.unsubscribeFromFileExistenceWatcher = exports.addVideoRenderJob = exports.addStillRenderJob = void 0;
4
- const input_props_serialization_1 = require("../RenderModal/SchemaEditor/input-props-serialization");
4
+ const remotion_1 = require("remotion");
5
5
  const callApi = (endpoint, body, signal) => {
6
6
  return new Promise((resolve, reject) => {
7
7
  fetch(endpoint, {
@@ -39,7 +39,11 @@ const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, f
39
39
  chromiumOptions,
40
40
  delayRenderTimeout,
41
41
  envVariables,
42
- inputProps,
42
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
43
+ data: inputProps,
44
+ staticBase: window.remotion_staticBase,
45
+ indent: undefined,
46
+ }).serializedString,
43
47
  });
44
48
  };
45
49
  exports.addStillRenderJob = addStillRenderJob;
@@ -70,7 +74,11 @@ const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, s
70
74
  disallowParallelEncoding,
71
75
  chromiumOptions,
72
76
  envVariables,
73
- inputProps,
77
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
78
+ data: inputProps,
79
+ staticBase: window.remotion_staticBase,
80
+ indent: undefined,
81
+ }).serializedString,
74
82
  });
75
83
  };
76
84
  exports.addVideoRenderJob = addVideoRenderJob;
@@ -112,7 +120,7 @@ exports.updateAvailable = updateAvailable;
112
120
  const updateDefaultProps = (compositionId, defaultProps, enumPaths) => {
113
121
  return callApi('/api/update-default-props', {
114
122
  compositionId,
115
- defaultProps: (0, input_props_serialization_1.serializeJSONWithDate)({
123
+ defaultProps: remotion_1.Internals.serializeJSONWithDate({
116
124
  data: defaultProps,
117
125
  indent: undefined,
118
126
  staticBase: window.remotion_staticBase,
@@ -16,4 +16,4 @@ export declare const BLUE_DISABLED = "#284f73";
16
16
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
17
17
  selected: boolean;
18
18
  hovered: boolean;
19
- }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
19
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "rgba(255, 255, 255, 0.06)" | "hsla(0, 0%, 100%, 0.25)";
@@ -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';
@@ -0,0 +1,19 @@
1
+ import type { Page, SymbolicatedStackFrame } from '@remotion/renderer';
2
+ export declare class ErrorWithStackFrame extends Error {
3
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
4
+ frame: number | null;
5
+ name: string;
6
+ delayRenderCall: SymbolicatedStackFrame[] | null;
7
+ constructor({ message, symbolicatedStackFrames, frame, name, delayRenderCall, }: {
8
+ message: string;
9
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
10
+ frame: number | null;
11
+ name: string;
12
+ delayRenderCall: SymbolicatedStackFrame[] | null;
13
+ });
14
+ }
15
+ export declare const handleJavascriptException: ({ page, onError, frame, }: {
16
+ page: Page;
17
+ frame: number | null;
18
+ onError: (err: Error) => void;
19
+ }) => () => void;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleJavascriptException = exports.ErrorWithStackFrame = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const renderer_1 = require("@remotion/renderer");
6
+ const log_1 = require("./log");
7
+ class ErrorWithStackFrame extends Error {
8
+ constructor({ message, symbolicatedStackFrames, frame, name, delayRenderCall, }) {
9
+ super(message);
10
+ this.symbolicatedStackFrames = symbolicatedStackFrames;
11
+ this.frame = frame;
12
+ this.name = name;
13
+ this.delayRenderCall = delayRenderCall;
14
+ }
15
+ }
16
+ exports.ErrorWithStackFrame = ErrorWithStackFrame;
17
+ const cleanUpErrorMessage = (exception) => {
18
+ var _a, _b, _c, _d;
19
+ let errorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
20
+ if (!errorMessage) {
21
+ return null;
22
+ }
23
+ const errorType = (_b = exception.exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className;
24
+ const prefix = `${errorType}: `;
25
+ if (errorMessage.startsWith(prefix)) {
26
+ errorMessage = errorMessage.substring(prefix.length);
27
+ }
28
+ const frames = (_d = (_c = exception.exceptionDetails.stackTrace) === null || _c === void 0 ? void 0 : _c.callFrames.length) !== null && _d !== void 0 ? _d : 0;
29
+ const split = errorMessage.split('\n');
30
+ return split.slice(0, Math.max(1, split.length - frames)).join('\n');
31
+ };
32
+ const removeDelayRenderStack = (message) => {
33
+ const index = message.indexOf(remotion_1.Internals.DELAY_RENDER_CALLSTACK_TOKEN);
34
+ if (index === -1) {
35
+ return message;
36
+ }
37
+ return message.substring(0, index);
38
+ };
39
+ const callFrameToStackFrame = (callFrame) => {
40
+ return {
41
+ columnNumber: callFrame.columnNumber,
42
+ fileName: callFrame.url,
43
+ functionName: callFrame.functionName,
44
+ lineNumber: callFrame.lineNumber,
45
+ };
46
+ };
47
+ const handleJavascriptException = ({ page, onError, frame, }) => {
48
+ const client = page._client();
49
+ const handler = (exception) => {
50
+ var _a, _b, _c;
51
+ const rawErrorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
52
+ const cleanErrorMessage = cleanUpErrorMessage(exception);
53
+ if (!cleanErrorMessage) {
54
+ log_1.Log.error(exception);
55
+ const err = new Error(rawErrorMessage);
56
+ err.stack = rawErrorMessage;
57
+ onError(err);
58
+ return;
59
+ }
60
+ if (!exception.exceptionDetails.stackTrace) {
61
+ const err = new Error(removeDelayRenderStack(cleanErrorMessage));
62
+ err.stack = rawErrorMessage;
63
+ onError(err);
64
+ return;
65
+ }
66
+ const errorType = (_b = exception.exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className;
67
+ const symbolicatedErr = new renderer_1.RenderInternals.SymbolicateableError({
68
+ message: removeDelayRenderStack(cleanErrorMessage),
69
+ stackFrame: exception.exceptionDetails.stackTrace.callFrames.map((f) => callFrameToStackFrame(f)),
70
+ frame,
71
+ name: errorType,
72
+ stack: (_c = exception.exceptionDetails.exception) === null || _c === void 0 ? void 0 : _c.description,
73
+ });
74
+ onError(symbolicatedErr);
75
+ };
76
+ client.on('Runtime.exceptionThrown', handler);
77
+ return () => {
78
+ client.off('Runtime.exceptionThrown', handler);
79
+ };
80
+ };
81
+ exports.handleJavascriptException = handleJavascriptException;
@@ -33,5 +33,5 @@ export declare const getCliOptions: (options: {
33
33
  videoBitrate: string | null;
34
34
  height: number | null;
35
35
  width: number | null;
36
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
36
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
37
37
  }>;
@@ -1,9 +1,9 @@
1
1
  import type { BrowserExecutable, ChromiumOptions, HeadlessBrowser, LogLevel, RemotionServer } from '@remotion/renderer';
2
2
  import type { VideoConfig } from 'remotion';
3
- export declare const getCompositionId: ({ args, compositionIdFromUi, inputProps, puppeteerInstance, envVariables, timeoutInMilliseconds, chromiumOptions, port, browserExecutable, serveUrlOrWebpackUrl, logLevel, indent, server, }: {
3
+ export declare const getCompositionId: ({ args, compositionIdFromUi, serializedInputPropsWithCustomSchema, puppeteerInstance, envVariables, timeoutInMilliseconds, chromiumOptions, port, browserExecutable, serveUrlOrWebpackUrl, logLevel, indent, server, }: {
4
4
  args: string[];
5
5
  compositionIdFromUi: string | null;
6
- inputProps: Record<string, unknown>;
6
+ serializedInputPropsWithCustomSchema: string;
7
7
  puppeteerInstance: HeadlessBrowser | undefined;
8
8
  envVariables: Record<string, string>;
9
9
  timeoutInMilliseconds: number;
@@ -16,7 +16,7 @@ const getCompName = ({ cliArgs, compositionIdFromUi, }) => {
16
16
  const [compName, ...remainingArgs] = cliArgs;
17
17
  return { compName, remainingArgs, reason: 'Passed as argument' };
18
18
  };
19
- const getCompositionId = async ({ args, compositionIdFromUi, inputProps, puppeteerInstance, envVariables, timeoutInMilliseconds, chromiumOptions, port, browserExecutable, serveUrlOrWebpackUrl, logLevel, indent, server, }) => {
19
+ const getCompositionId = async ({ args, compositionIdFromUi, serializedInputPropsWithCustomSchema, puppeteerInstance, envVariables, timeoutInMilliseconds, chromiumOptions, port, browserExecutable, serveUrlOrWebpackUrl, logLevel, indent, server, }) => {
20
20
  const { compName, remainingArgs, reason: compReason, } = getCompName({
21
21
  cliArgs: args,
22
22
  compositionIdFromUi,
@@ -24,7 +24,7 @@ const getCompositionId = async ({ args, compositionIdFromUi, inputProps, puppete
24
24
  if (compName) {
25
25
  const { metadata: config, propsSize } = await renderer_1.RenderInternals.internalSelectComposition({
26
26
  id: compName,
27
- inputProps,
27
+ serializedInputPropsWithCustomSchema,
28
28
  puppeteerInstance,
29
29
  envVariables,
30
30
  timeoutInMilliseconds,
@@ -38,7 +38,10 @@ const getCompositionId = async ({ args, compositionIdFromUi, inputProps, puppete
38
38
  onBrowserLog: null,
39
39
  });
40
40
  if (propsSize > 10000000) {
41
- log_1.Log.warn(`The props of your composition are large (${(0, format_bytes_1.formatBytes)(propsSize)}). This may cause slowdown.`);
41
+ log_1.Log.warnAdvanced({
42
+ indent,
43
+ logLevel,
44
+ }, `The props of your composition are large (${(0, format_bytes_1.formatBytes)(propsSize)}). This may cause slowdown.`);
42
45
  }
43
46
  if (!config) {
44
47
  throw new Error(`Cannot find composition with ID "${compName}"`);
@@ -52,7 +55,6 @@ const getCompositionId = async ({ args, compositionIdFromUi, inputProps, puppete
52
55
  }
53
56
  if (!process.env.CI) {
54
57
  const comps = await renderer_1.RenderInternals.internalGetCompositions({
55
- inputProps,
56
58
  puppeteerInstance,
57
59
  envVariables,
58
60
  timeoutInMilliseconds,
@@ -64,6 +66,7 @@ const getCompositionId = async ({ args, compositionIdFromUi, inputProps, puppete
64
66
  server,
65
67
  serveUrlOrWebpackUrl,
66
68
  onBrowserLog: null,
69
+ serializedInputPropsWithCustomSchema,
67
70
  });
68
71
  const { compositionId, reason } = await (0, show_compositions_picker_1.showSingleCompositionsPicker)(comps);
69
72
  if (compositionId && typeof compositionId === 'string') {
@@ -1,6 +1,6 @@
1
1
  import type { BrowserExecutable, ChromiumOptions, HeadlessBrowser, LogLevel, RemotionServer } from '@remotion/renderer';
2
2
  import type { VideoConfig } from 'remotion';
3
- export declare const getCompositionWithDimensionOverride: ({ height, width, args, compositionIdFromUi, chromiumOptions, envVariables, port, puppeteerInstance, timeoutInMilliseconds, browserExecutable, serveUrlOrWebpackUrl, indent, inputProps, logLevel, server, }: {
3
+ export declare const getCompositionWithDimensionOverride: ({ height, width, args, compositionIdFromUi, chromiumOptions, envVariables, port, puppeteerInstance, timeoutInMilliseconds, browserExecutable, serveUrlOrWebpackUrl, indent, serializedInputPropsWithCustomSchema, logLevel, server, }: {
4
4
  height: number | null;
5
5
  width: number | null;
6
6
  args: string[];
@@ -14,7 +14,7 @@ export declare const getCompositionWithDimensionOverride: ({ height, width, args
14
14
  serveUrlOrWebpackUrl: string;
15
15
  indent: boolean;
16
16
  logLevel: LogLevel;
17
- inputProps: Record<string, unknown>;
17
+ serializedInputPropsWithCustomSchema: string;
18
18
  server: RemotionServer;
19
19
  }) => Promise<{
20
20
  compositionId: string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCompositionWithDimensionOverride = void 0;
4
4
  const get_composition_id_1 = require("./get-composition-id");
5
- const getCompositionWithDimensionOverride = async ({ height, width, args, compositionIdFromUi, chromiumOptions, envVariables, port, puppeteerInstance, timeoutInMilliseconds, browserExecutable, serveUrlOrWebpackUrl, indent, inputProps, logLevel, server, }) => {
5
+ const getCompositionWithDimensionOverride = async ({ height, width, args, compositionIdFromUi, chromiumOptions, envVariables, port, puppeteerInstance, timeoutInMilliseconds, browserExecutable, serveUrlOrWebpackUrl, indent, serializedInputPropsWithCustomSchema, logLevel, server, }) => {
6
6
  const returnValue = await (0, get_composition_id_1.getCompositionId)({
7
7
  args,
8
8
  compositionIdFromUi,
@@ -12,7 +12,7 @@ const getCompositionWithDimensionOverride = async ({ height, width, args, compos
12
12
  browserExecutable,
13
13
  chromiumOptions,
14
14
  envVariables,
15
- inputProps,
15
+ serializedInputPropsWithCustomSchema,
16
16
  port,
17
17
  puppeteerInstance,
18
18
  timeoutInMilliseconds,
@@ -0,0 +1,20 @@
1
+ import type { Page } from '../browser/BrowserPage';
2
+ import type { SymbolicatedStackFrame } from '../symbolicate-stacktrace';
3
+ export declare class ErrorWithStackFrame extends Error {
4
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
5
+ frame: number | null;
6
+ name: string;
7
+ delayRenderCall: SymbolicatedStackFrame[] | null;
8
+ constructor({ message, symbolicatedStackFrames, frame, name, delayRenderCall, }: {
9
+ message: string;
10
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
11
+ frame: number | null;
12
+ name: string;
13
+ delayRenderCall: SymbolicatedStackFrame[] | null;
14
+ });
15
+ }
16
+ export declare const handleJavascriptException: ({ page, onError, frame, }: {
17
+ page: Page;
18
+ frame: number | null;
19
+ onError: (err: Error) => void;
20
+ }) => () => void;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleJavascriptException = exports.ErrorWithStackFrame = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const symbolicateable_error_1 = require("./symbolicateable-error");
6
+ const log_1 = require("./log");
7
+ class ErrorWithStackFrame extends Error {
8
+ constructor({ message, symbolicatedStackFrames, frame, name, delayRenderCall, }) {
9
+ super(message);
10
+ this.symbolicatedStackFrames = symbolicatedStackFrames;
11
+ this.frame = frame;
12
+ this.name = name;
13
+ this.delayRenderCall = delayRenderCall;
14
+ }
15
+ }
16
+ exports.ErrorWithStackFrame = ErrorWithStackFrame;
17
+ const cleanUpErrorMessage = (exception) => {
18
+ var _a, _b, _c, _d;
19
+ let errorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
20
+ if (!errorMessage) {
21
+ return null;
22
+ }
23
+ const errorType = (_b = exception.exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className;
24
+ const prefix = `${errorType}: `;
25
+ if (errorMessage.startsWith(prefix)) {
26
+ errorMessage = errorMessage.substring(prefix.length);
27
+ }
28
+ const frames = (_d = (_c = exception.exceptionDetails.stackTrace) === null || _c === void 0 ? void 0 : _c.callFrames.length) !== null && _d !== void 0 ? _d : 0;
29
+ const split = errorMessage.split('\n');
30
+ return split.slice(0, Math.max(1, split.length - frames)).join('\n');
31
+ };
32
+ const removeDelayRenderStack = (message) => {
33
+ const index = message.indexOf(remotion_1.Internals.DELAY_RENDER_CALLSTACK_TOKEN);
34
+ if (index === -1) {
35
+ return message;
36
+ }
37
+ return message.substring(0, index);
38
+ };
39
+ const callFrameToStackFrame = (callFrame) => {
40
+ return {
41
+ columnNumber: callFrame.columnNumber,
42
+ fileName: callFrame.url,
43
+ functionName: callFrame.functionName,
44
+ lineNumber: callFrame.lineNumber,
45
+ };
46
+ };
47
+ const handleJavascriptException = ({ page, onError, frame, }) => {
48
+ const client = page._client();
49
+ const handler = (exception) => {
50
+ var _a, _b, _c;
51
+ const rawErrorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
52
+ const cleanErrorMessage = cleanUpErrorMessage(exception);
53
+ if (!cleanErrorMessage) {
54
+ log_1.Log.error(exception);
55
+ const err = new Error(rawErrorMessage);
56
+ err.stack = rawErrorMessage;
57
+ onError(err);
58
+ return;
59
+ }
60
+ if (!exception.exceptionDetails.stackTrace) {
61
+ const err = new Error(removeDelayRenderStack(cleanErrorMessage));
62
+ err.stack = rawErrorMessage;
63
+ onError(err);
64
+ return;
65
+ }
66
+ const errorType = (_b = exception.exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className;
67
+ const symbolicatedErr = new symbolicateable_error_1.SymbolicateableError({
68
+ message: removeDelayRenderStack(cleanErrorMessage),
69
+ stackFrame: exception.exceptionDetails.stackTrace.callFrames.map((f) => callFrameToStackFrame(f)),
70
+ frame,
71
+ name: errorType,
72
+ stack: (_c = exception.exceptionDetails.exception) === null || _c === void 0 ? void 0 : _c.description,
73
+ });
74
+ onError(symbolicatedErr);
75
+ };
76
+ client.on('Runtime.exceptionThrown', handler);
77
+ return () => {
78
+ client.off('Runtime.exceptionThrown', handler);
79
+ };
80
+ };
81
+ exports.handleJavascriptException = handleJavascriptException;