@remotion/cli 4.0.3 → 4.0.5

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 (33) hide show
  1. package/dist/cloudrun-command.d.ts +1 -0
  2. package/dist/cloudrun-command.js +27 -0
  3. package/dist/config/image-format.d.ts +1 -1
  4. package/dist/config/index.d.ts +1 -1
  5. package/dist/config/log.d.ts +1 -1
  6. package/dist/editor/components/GlobalKeybindings.js +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/human-readable-codec.d.ts +1 -1
  11. package/dist/editor/helpers/colors.d.ts +1 -1
  12. package/dist/editor/helpers/render-modal-sections.d.ts +0 -1
  13. package/dist/error-with-stack-frame.d.ts +19 -0
  14. package/dist/error-with-stack-frame.js +81 -0
  15. package/dist/get-cli-options.d.ts +1 -1
  16. package/dist/handle-javascript-error.d.ts +20 -0
  17. package/dist/handle-javascript-error.js +81 -0
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +5 -2
  20. package/dist/log.d.ts +3 -3
  21. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  22. package/dist/preview-server/routes.d.ts +0 -1
  23. package/dist/render-flows/render.js +3 -3
  24. package/dist/render-flows/still.js +3 -3
  25. package/dist/symbolicate-error.d.ts +3 -0
  26. package/dist/symbolicate-error.js +24 -0
  27. package/dist/symbolicate-errors.d.ts +7 -0
  28. package/dist/symbolicate-errors.js +90 -0
  29. package/dist/symbolicate-stacktrace.d.ts +28 -0
  30. package/dist/symbolicate-stacktrace.js +135 -0
  31. package/dist/symbolicateable-error.d.ts +16 -0
  32. package/dist/symbolicateable-error.js +18 -0
  33. package/package.json +8 -8
@@ -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;
@@ -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;
@@ -43,7 +43,7 @@ const GlobalKeybindings = () => {
43
43
  callback: () => {
44
44
  setCheckerboard((c) => !c);
45
45
  },
46
- commandCtrlKey: true,
46
+ commandCtrlKey: false,
47
47
  preventDefault: true,
48
48
  triggerIfInputFieldFocused: false,
49
49
  });
@@ -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 {};
@@ -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;
@@ -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
  }>;
@@ -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;
package/dist/index.d.ts CHANGED
@@ -112,7 +112,7 @@ export declare const CliInternals: {
112
112
  videoBitrate: string | null;
113
113
  height: number | null;
114
114
  width: number | null;
115
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
115
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
116
116
  }>;
117
117
  loadConfig: (remotionRoot: string) => Promise<string | null>;
118
118
  initializeCli: (remotionRoot: string) => Promise<void>;
@@ -121,7 +121,7 @@ export declare const CliInternals: {
121
121
  parsedCli: {
122
122
  "browser-executable": import("@remotion/renderer").BrowserExecutable;
123
123
  "pixel-format": "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
124
- "image-format": "png" | "jpeg" | "pdf" | "webp" | "none";
124
+ "image-format": "none" | "png" | "jpeg" | "pdf" | "webp";
125
125
  "prores-profile": "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy";
126
126
  "bundle-cache": string;
127
127
  "env-file": string;
@@ -185,7 +185,7 @@ export declare const CliInternals: {
185
185
  downloadName: string | null;
186
186
  outName: string | null;
187
187
  configImageFormat: "png" | "jpeg" | "pdf" | "webp" | null;
188
- cliFlag: "png" | "jpeg" | "pdf" | "webp" | "none" | null;
188
+ cliFlag: "none" | "png" | "jpeg" | "pdf" | "webp" | null;
189
189
  isLambda: boolean;
190
190
  fromUi: "png" | "jpeg" | "pdf" | "webp" | null;
191
191
  }) => {
@@ -200,8 +200,8 @@ export declare const CliInternals: {
200
200
  };
201
201
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
202
202
  codec: import("@remotion/renderer").CodecOrUndefined;
203
- uiImageFormat: "png" | "jpeg" | "none" | null;
204
- }) => "png" | "jpeg" | "none";
203
+ uiImageFormat: "none" | "png" | "jpeg" | null;
204
+ }) => "none" | "png" | "jpeg";
205
205
  printCompositions: (compositions: import("remotion").VideoConfig[]) => void;
206
206
  getFinalOutputCodec: ({ cliFlag, configFile, downloadName, outName, uiCodec, }: {
207
207
  cliFlag: import("@remotion/renderer").CodecOrUndefined;
package/dist/index.js CHANGED
@@ -61,14 +61,17 @@ const cli = async () => {
61
61
  if (command !== versions_1.VERSIONS_COMMAND) {
62
62
  await (0, versions_1.validateVersionsBeforeCommand)(remotionRoot);
63
63
  }
64
- const errorSymbolicationLock = renderer_1.RenderInternals.registerErrorSymbolicationLock();
64
+ const isStudio = command === 'studio' || command === 'preview';
65
+ const errorSymbolicationLock = isStudio
66
+ ? 0
67
+ : renderer_1.RenderInternals.registerErrorSymbolicationLock();
65
68
  (0, cleanup_before_quit_1.handleCtrlC)();
66
69
  await (0, initialize_cli_1.initializeCli)(remotionRoot);
67
70
  try {
68
71
  if (command === 'compositions') {
69
72
  await (0, compositions_1.listCompositionsCommand)(remotionRoot, args);
70
73
  }
71
- else if (command === 'preview' || command === 'studio') {
74
+ else if (isStudio) {
72
75
  await (0, studio_1.studioCommand)(remotionRoot, args);
73
76
  }
74
77
  else if (command === 'lambda') {
package/dist/log.d.ts CHANGED
@@ -2,19 +2,19 @@ export declare const Log: {
2
2
  verbose: (message?: any, ...optionalParams: any[]) => void;
3
3
  verboseAdvanced: (options: {
4
4
  indent: boolean;
5
- logLevel: "verbose" | "info" | "warn" | "error";
5
+ logLevel: "error" | "verbose" | "info" | "warn";
6
6
  } & {
7
7
  tag?: string | undefined;
8
8
  }, message?: any, ...optionalParams: any[]) => void;
9
9
  info: (message?: any, ...optionalParams: any[]) => void;
10
10
  infoAdvanced: (options: {
11
11
  indent: boolean;
12
- logLevel: "verbose" | "info" | "warn" | "error";
12
+ logLevel: "error" | "verbose" | "info" | "warn";
13
13
  }, message?: any, ...optionalParams: any[]) => void;
14
14
  warn: (message?: any, ...optionalParams: any[]) => void;
15
15
  warnAdvanced: (options: {
16
16
  indent: boolean;
17
- logLevel: "verbose" | "info" | "warn" | "error";
17
+ logLevel: "error" | "verbose" | "info" | "warn";
18
18
  }, message?: any, ...optionalParams: any[]) => void;
19
19
  error: (message?: any, ...optionalParams: any[]) => void;
20
20
  };
@@ -11,5 +11,5 @@ type Range = {
11
11
  type Ranges = Range[] & {
12
12
  type?: string;
13
13
  };
14
- export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | -2 | Ranges;
15
15
  export {};
@@ -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, }: {
@@ -139,7 +139,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
139
139
  const puppeteerInstance = await browserInstance;
140
140
  addCleanupCallback(() => puppeteerInstance.close(false, logLevel, indent));
141
141
  const actualConcurrency = renderer_1.RenderInternals.getActualConcurrency(concurrency);
142
- const server = renderer_1.RenderInternals.prepareServer({
142
+ const server = await renderer_1.RenderInternals.prepareServer({
143
143
  concurrency: actualConcurrency,
144
144
  indent,
145
145
  port,
@@ -147,7 +147,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
147
147
  logLevel,
148
148
  webpackConfigOrServeUrl: urlOrBundle,
149
149
  });
150
- addCleanupCallback(() => server.then((s) => s.closeServer(false)));
150
+ addCleanupCallback(() => server.closeServer(false));
151
151
  const { compositionId, config, reason, argsAfterComposition } = await (0, get_composition_with_dimension_override_1.getCompositionWithDimensionOverride)({
152
152
  height,
153
153
  width,
@@ -163,7 +163,7 @@ const renderVideoFlow = async ({ remotionRoot, fullEntryPoint, indent, logLevel,
163
163
  serveUrlOrWebpackUrl: urlOrBundle,
164
164
  timeoutInMilliseconds: puppeteerTimeout,
165
165
  logLevel,
166
- server: await server,
166
+ server,
167
167
  });
168
168
  const { codec, reason: codecReason } = (0, get_final_output_codec_1.getFinalOutputCodec)({
169
169
  cliFlag: parse_command_line_1.parsedCli.codec,
@@ -76,7 +76,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
76
76
  },
77
77
  quietProgress: updatesDontOverwrite,
78
78
  });
79
- const server = renderer_1.RenderInternals.prepareServer({
79
+ const server = await renderer_1.RenderInternals.prepareServer({
80
80
  concurrency: 1,
81
81
  indent: indentOutput,
82
82
  port,
@@ -84,7 +84,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
84
84
  logLevel,
85
85
  webpackConfigOrServeUrl: urlOrBundle,
86
86
  });
87
- addCleanupCallback(() => server.then((s) => s.closeServer(false)));
87
+ addCleanupCallback(() => server.closeServer(false));
88
88
  addCleanupCallback(() => cleanupBundle());
89
89
  const puppeteerInstance = await browserInstance;
90
90
  addCleanupCallback(() => puppeteerInstance.close(false, logLevel, indentOutput));
@@ -103,7 +103,7 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
103
103
  serveUrlOrWebpackUrl: urlOrBundle,
104
104
  timeoutInMilliseconds: puppeteerTimeout,
105
105
  logLevel,
106
- server: await server,
106
+ server,
107
107
  });
108
108
  const { format: imageFormat, source } = (0, determine_image_format_1.determineFinalStillImageFormat)({
109
109
  cliFlag: (_a = parse_command_line_1.parsedCli['image-format']) !== null && _a !== void 0 ? _a : null,
@@ -0,0 +1,3 @@
1
+ import { ErrorWithStackFrame } from './handle-javascript-exception';
2
+ import type { SymbolicateableError } from './symbolicateable-error';
3
+ export declare const symbolicateError: (symbolicateableError: SymbolicateableError) => Promise<ErrorWithStackFrame>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.symbolicateError = void 0;
4
+ const symbolicate_stacktrace_1 = require("../symbolicate-stacktrace");
5
+ const handle_javascript_exception_1 = require("./handle-javascript-exception");
6
+ const truthy_1 = require("./truthy");
7
+ const symbolicateError = async (symbolicateableError) => {
8
+ const { delayRenderCall, stackFrame } = symbolicateableError;
9
+ const [mainErrorFrames, delayRenderFrames] = await Promise.all([
10
+ stackFrame ? (0, symbolicate_stacktrace_1.symbolicateStackTraceFromRemoteFrames)(stackFrame) : null,
11
+ delayRenderCall
12
+ ? (0, symbolicate_stacktrace_1.symbolicateStackTraceFromRemoteFrames)(delayRenderCall)
13
+ : null,
14
+ ].filter(truthy_1.truthy));
15
+ const symbolicatedErr = new handle_javascript_exception_1.ErrorWithStackFrame({
16
+ message: symbolicateableError.message,
17
+ symbolicatedStackFrames: mainErrorFrames,
18
+ frame: symbolicateableError.frame,
19
+ name: symbolicateableError.name,
20
+ delayRenderCall: delayRenderFrames,
21
+ });
22
+ return symbolicatedErr;
23
+ };
24
+ exports.symbolicateError = symbolicateError;
@@ -0,0 +1,7 @@
1
+ import type { SymbolicatedStackFrame, UnsymbolicatedStackFrame } from '@remotion/renderer';
2
+ import type { SourceMapConsumer } from 'source-map';
3
+ import { ErrorWithStackFrame } from './error-with-stack-frame';
4
+ export declare const symbolicateError: (symbolicateableError: SymbolicateableError) => Promise<ErrorWithStackFrame>;
5
+ export declare const symbolicateStackTraceFromRemoteFrames: (frames: UnsymbolicatedStackFrame[]) => Promise<SymbolicatedStackFrame[]>;
6
+ export declare const getSourceMapFromRemoteFile: (fileName: string) => Promise<any>;
7
+ export declare const symbolicateFromSources: (frames: UnsymbolicatedStackFrame[], mapValues: Record<string, SourceMapConsumer | null>) => SymbolicatedStackFrame[];
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.symbolicateFromSources = exports.getSourceMapFromRemoteFile = exports.symbolicateStackTraceFromRemoteFrames = exports.symbolicateError = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const truthy_1 = require("./truthy");
6
+ const error_with_stack_frame_1 = require("./error-with-stack-frame");
7
+ const symbolicateError = async (symbolicateableError) => {
8
+ const { delayRenderCall, stackFrame } = symbolicateableError;
9
+ const [mainErrorFrames, delayRenderFrames] = await Promise.all([
10
+ stackFrame ? (0, exports.symbolicateStackTraceFromRemoteFrames)(stackFrame) : null,
11
+ delayRenderCall
12
+ ? (0, exports.symbolicateStackTraceFromRemoteFrames)(delayRenderCall)
13
+ : null,
14
+ ].filter(truthy_1.truthy));
15
+ const symbolicatedErr = new error_with_stack_frame_1.ErrorWithStackFrame({
16
+ message: symbolicateableError.message,
17
+ symbolicatedStackFrames: mainErrorFrames,
18
+ frame: symbolicateableError.frame,
19
+ name: symbolicateableError.name,
20
+ delayRenderCall: delayRenderFrames,
21
+ });
22
+ return symbolicatedErr;
23
+ };
24
+ exports.symbolicateError = symbolicateError;
25
+ const symbolicateStackTraceFromRemoteFrames = async (frames) => {
26
+ const uniqueFileNames = [
27
+ ...new Set(frames
28
+ .map((f) => f.fileName)
29
+ .filter((f) => f.startsWith('http://') || f.startsWith('https://'))
30
+ .filter(truthy_1.truthy)),
31
+ ];
32
+ const maps = await Promise.all(uniqueFileNames.map((fileName) => {
33
+ return (0, exports.getSourceMapFromRemoteFile)(fileName);
34
+ }));
35
+ const mapValues = {};
36
+ for (let i = 0; i < uniqueFileNames.length; i++) {
37
+ mapValues[uniqueFileNames[i]] = maps[i];
38
+ }
39
+ return (0, exports.symbolicateFromSources)(frames, mapValues);
40
+ };
41
+ exports.symbolicateStackTraceFromRemoteFrames = symbolicateStackTraceFromRemoteFrames;
42
+ const getSourceMapFromRemoteFile = async (fileName) => {
43
+ const fileContents = await renderer_1.RenderInternals.fetchUrl(fileName);
44
+ return renderer_1.RenderInternals.getSourceMap(fileName, fileContents, 'remote');
45
+ };
46
+ exports.getSourceMapFromRemoteFile = getSourceMapFromRemoteFile;
47
+ const symbolicateFromSources = (frames, mapValues) => {
48
+ return frames
49
+ .map((frame) => {
50
+ const map = mapValues[frame.fileName];
51
+ if (!map) {
52
+ return null;
53
+ }
54
+ return symbolicateStackFrame(frame, map);
55
+ })
56
+ .filter(truthy_1.truthy);
57
+ };
58
+ exports.symbolicateFromSources = symbolicateFromSources;
59
+ const symbolicateStackFrame = (frame, map) => {
60
+ const pos = getOriginalPosition(map, frame.lineNumber, frame.columnNumber);
61
+ const hasSource = pos.source ? map.sourceContentFor(pos.source, false) : null;
62
+ const scriptCode = hasSource && pos.line
63
+ ? getLinesAround(pos.line, 3, hasSource.split('\n'))
64
+ : null;
65
+ return {
66
+ originalColumnNumber: pos.column,
67
+ originalFileName: pos.source,
68
+ originalFunctionName: frame.functionName,
69
+ originalLineNumber: pos.line,
70
+ originalScriptCode: scriptCode,
71
+ };
72
+ };
73
+ const getOriginalPosition = (source_map, line, column) => {
74
+ const result = source_map.originalPositionFor({
75
+ line,
76
+ column,
77
+ });
78
+ return { line: result.line, column: result.column, source: result.source };
79
+ };
80
+ function getLinesAround(line, count, lines) {
81
+ const result = [];
82
+ for (let index = Math.max(0, line - 1 - count) + 1; index <= Math.min(lines.length - 1, line - 1 + count); ++index) {
83
+ result.push({
84
+ lineNumber: index + 1,
85
+ content: lines[index],
86
+ highlight: index + 1 === line,
87
+ });
88
+ }
89
+ return result;
90
+ }
@@ -0,0 +1,28 @@
1
+ import type { BasicSourceMapConsumer, IndexedSourceMapConsumer } from 'source-map';
2
+ import { SourceMapConsumer } from 'source-map';
3
+ import type { UnsymbolicatedStackFrame } from './parse-browser-error-stack';
4
+ type ScriptLine = {
5
+ lineNumber: number;
6
+ content: string;
7
+ highlight: boolean;
8
+ };
9
+ export type SymbolicatedStackFrame = {
10
+ originalFunctionName: string | null;
11
+ originalFileName: string | null;
12
+ originalLineNumber: number | null;
13
+ originalColumnNumber: number | null;
14
+ originalScriptCode: ScriptLine[] | null;
15
+ };
16
+ export declare const symbolicateStackTraceFromRemoteFrames: (frames: UnsymbolicatedStackFrame[]) => Promise<SymbolicatedStackFrame[]>;
17
+ export declare const symbolicateFromSources: (frames: UnsymbolicatedStackFrame[], mapValues: Record<string, SourceMapConsumer | null>) => SymbolicatedStackFrame[];
18
+ export declare const symbolicateStackFrame: (frame: UnsymbolicatedStackFrame, map: SourceMapConsumer) => {
19
+ originalColumnNumber: number | null;
20
+ originalFileName: string | null;
21
+ originalFunctionName: any;
22
+ originalLineNumber: number | null;
23
+ originalScriptCode: ScriptLine[] | null;
24
+ };
25
+ export declare const getSourceMapFromRemoteFile: (fileName: string) => Promise<SourceMapConsumer | null>;
26
+ export declare const getSourceMapFromLocalFile: (fileName: string) => Promise<SourceMapConsumer | null>;
27
+ export type AnySourceMapConsumer = BasicSourceMapConsumer | IndexedSourceMapConsumer;
28
+ export {};
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSourceMapFromLocalFile = exports.getSourceMapFromRemoteFile = exports.symbolicateStackFrame = exports.symbolicateFromSources = exports.symbolicateStackTraceFromRemoteFrames = void 0;
7
+ const fs_1 = require("fs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const source_map_1 = require("source-map");
10
+ const read_file_1 = require("./assets/read-file");
11
+ const truthy_1 = require("./truthy");
12
+ function extractSourceMapUrl(fileContents) {
13
+ const regex = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/gm;
14
+ let match = null;
15
+ for (;;) {
16
+ const next = regex.exec(fileContents);
17
+ if (next === null || next === undefined) {
18
+ break;
19
+ }
20
+ match = next;
21
+ }
22
+ if (!(match === null || match === void 0 ? void 0 : match[1])) {
23
+ return null;
24
+ }
25
+ return match[1].toString();
26
+ }
27
+ const getSourceMap = async (filePath, fileContents, type) => {
28
+ const sm = extractSourceMapUrl(fileContents);
29
+ if (sm === null) {
30
+ return null;
31
+ }
32
+ if (sm.indexOf('data:') === 0) {
33
+ const base64 = /^data:application\/json;([\w=:"-]+;)*base64,/;
34
+ const match2 = sm.match(base64);
35
+ if (!match2) {
36
+ throw new Error('Sorry, non-base64 inline source-map encoding is not supported.');
37
+ }
38
+ const converted = window.atob(sm.substring(match2[0].length));
39
+ return new source_map_1.SourceMapConsumer(JSON.parse(converted));
40
+ }
41
+ if (type === 'local') {
42
+ // Find adjacent file: bundle.js -> bundle.js.map
43
+ const newFilePath = path_1.default.join(path_1.default.dirname(filePath), sm);
44
+ return new source_map_1.SourceMapConsumer((0, fs_1.readFileSync)(newFilePath, 'utf8'));
45
+ }
46
+ const index = filePath.lastIndexOf('/');
47
+ const url = filePath.substring(0, index + 1) + sm;
48
+ const obj = await fetchUrl(url);
49
+ return new source_map_1.SourceMapConsumer(obj);
50
+ };
51
+ const fetchUrl = async (url) => {
52
+ const res = await (0, read_file_1.readFile)(url);
53
+ return new Promise((resolve, reject) => {
54
+ let downloaded = '';
55
+ res.on('data', (d) => {
56
+ downloaded += d;
57
+ });
58
+ res.on('end', () => {
59
+ resolve(downloaded);
60
+ });
61
+ res.on('error', (err) => reject(err));
62
+ });
63
+ };
64
+ function getLinesAround(line, count, lines) {
65
+ const result = [];
66
+ for (let index = Math.max(0, line - 1 - count) + 1; index <= Math.min(lines.length - 1, line - 1 + count); ++index) {
67
+ result.push({
68
+ lineNumber: index + 1,
69
+ content: lines[index],
70
+ highlight: index + 1 === line,
71
+ });
72
+ }
73
+ return result;
74
+ }
75
+ const getOriginalPosition = (source_map, line, column) => {
76
+ const result = source_map.originalPositionFor({
77
+ line,
78
+ column,
79
+ });
80
+ return { line: result.line, column: result.column, source: result.source };
81
+ };
82
+ const symbolicateStackTraceFromRemoteFrames = async (frames) => {
83
+ const uniqueFileNames = [
84
+ ...new Set(frames
85
+ .map((f) => f.fileName)
86
+ .filter((f) => f.startsWith('http://') || f.startsWith('https://'))
87
+ .filter(truthy_1.truthy)),
88
+ ];
89
+ const maps = await Promise.all(uniqueFileNames.map((fileName) => {
90
+ return (0, exports.getSourceMapFromRemoteFile)(fileName);
91
+ }));
92
+ const mapValues = {};
93
+ for (let i = 0; i < uniqueFileNames.length; i++) {
94
+ mapValues[uniqueFileNames[i]] = maps[i];
95
+ }
96
+ return (0, exports.symbolicateFromSources)(frames, mapValues);
97
+ };
98
+ exports.symbolicateStackTraceFromRemoteFrames = symbolicateStackTraceFromRemoteFrames;
99
+ const symbolicateFromSources = (frames, mapValues) => {
100
+ return frames
101
+ .map((frame) => {
102
+ const map = mapValues[frame.fileName];
103
+ if (!map) {
104
+ return null;
105
+ }
106
+ return (0, exports.symbolicateStackFrame)(frame, map);
107
+ })
108
+ .filter(truthy_1.truthy);
109
+ };
110
+ exports.symbolicateFromSources = symbolicateFromSources;
111
+ const symbolicateStackFrame = (frame, map) => {
112
+ const pos = getOriginalPosition(map, frame.lineNumber, frame.columnNumber);
113
+ const hasSource = pos.source ? map.sourceContentFor(pos.source, false) : null;
114
+ const scriptCode = hasSource && pos.line
115
+ ? getLinesAround(pos.line, 3, hasSource.split('\n'))
116
+ : null;
117
+ return {
118
+ originalColumnNumber: pos.column,
119
+ originalFileName: pos.source,
120
+ originalFunctionName: frame.functionName,
121
+ originalLineNumber: pos.line,
122
+ originalScriptCode: scriptCode,
123
+ };
124
+ };
125
+ exports.symbolicateStackFrame = symbolicateStackFrame;
126
+ const getSourceMapFromRemoteFile = async (fileName) => {
127
+ const fileContents = await fetchUrl(fileName);
128
+ return getSourceMap(fileName, fileContents, 'remote');
129
+ };
130
+ exports.getSourceMapFromRemoteFile = getSourceMapFromRemoteFile;
131
+ const getSourceMapFromLocalFile = (fileName) => {
132
+ const fileContents = (0, fs_1.readFileSync)(fileName, 'utf8');
133
+ return getSourceMap(fileName, fileContents, 'local');
134
+ };
135
+ exports.getSourceMapFromLocalFile = getSourceMapFromLocalFile;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A symbolicateable error is an error that can be symolicated by fetching the original sources. By throwing a symbolicateable error, Remotion CLI will attempt to symplicate it
3
+ */
4
+ import type { UnsymbolicatedStackFrame } from '../parse-browser-error-stack';
5
+ export declare class SymbolicateableError extends Error {
6
+ stackFrame: UnsymbolicatedStackFrame[] | null;
7
+ delayRenderCall: UnsymbolicatedStackFrame[] | null;
8
+ frame: number | null;
9
+ constructor({ message, stack, stackFrame, frame, name, }: {
10
+ message: string;
11
+ stack: string | undefined;
12
+ frame: number | null;
13
+ name: string;
14
+ stackFrame: UnsymbolicatedStackFrame[] | null;
15
+ });
16
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * A symbolicateable error is an error that can be symolicated by fetching the original sources. By throwing a symbolicateable error, Remotion CLI will attempt to symplicate it
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SymbolicateableError = void 0;
7
+ const delay_render_embedded_stack_1 = require("../delay-render-embedded-stack");
8
+ class SymbolicateableError extends Error {
9
+ constructor({ message, stack, stackFrame, frame, name, }) {
10
+ super(message);
11
+ this.stack = stack;
12
+ this.stackFrame = stackFrame;
13
+ this.frame = frame;
14
+ this.name = name;
15
+ this.delayRenderCall = stack ? (0, delay_render_embedded_stack_1.parseDelayRenderEmbeddedStack)(stack) : null;
16
+ }
17
+ }
18
+ exports.SymbolicateableError = SymbolicateableError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
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.3",
39
- "remotion": "4.0.3",
40
- "@remotion/player": "4.0.3",
41
- "@remotion/media-utils": "4.0.3",
42
- "@remotion/renderer": "4.0.3"
38
+ "@remotion/media-utils": "4.0.5",
39
+ "@remotion/player": "4.0.5",
40
+ "remotion": "4.0.5",
41
+ "@remotion/bundler": "4.0.5",
42
+ "@remotion/renderer": "4.0.5"
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/tailwind": "4.0.3",
69
- "@remotion/zod-types": "4.0.3"
68
+ "@remotion/zod-types": "4.0.5",
69
+ "@remotion/tailwind": "4.0.5"
70
70
  },
71
71
  "keywords": [
72
72
  "remotion",