@remotion/cli 4.0.6 → 4.0.8

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 (32) hide show
  1. package/dist/config/image-format.d.ts +1 -1
  2. package/dist/config/index.d.ts +1 -1
  3. package/dist/config/log.d.ts +1 -1
  4. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  5. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  6. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  7. package/dist/editor/components/PlayPause.js +4 -4
  8. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  9. package/dist/editor/helpers/colors.d.ts +1 -1
  10. package/dist/editor/helpers/render-modal-sections.d.ts +1 -0
  11. package/dist/get-cli-options.d.ts +1 -1
  12. package/dist/handle-common-errors.js +1 -1
  13. package/dist/index.d.ts +5 -5
  14. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  15. package/dist/preview-server/routes.d.ts +1 -0
  16. package/package.json +8 -8
  17. package/dist/cloudrun-command.d.ts +0 -1
  18. package/dist/cloudrun-command.js +0 -27
  19. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +0 -14
  20. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +0 -42
  21. package/dist/error-with-stack-frame.d.ts +0 -19
  22. package/dist/error-with-stack-frame.js +0 -81
  23. package/dist/handle-javascript-error.d.ts +0 -20
  24. package/dist/handle-javascript-error.js +0 -81
  25. package/dist/symbolicate-error.d.ts +0 -3
  26. package/dist/symbolicate-error.js +0 -24
  27. package/dist/symbolicate-errors.d.ts +0 -7
  28. package/dist/symbolicate-errors.js +0 -90
  29. package/dist/symbolicate-stacktrace.d.ts +0 -28
  30. package/dist/symbolicate-stacktrace.js +0 -135
  31. package/dist/symbolicateable-error.d.ts +0 -16
  32. package/dist/symbolicateable-error.js +0 -18
@@ -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: () => "none" | "png" | "jpeg" | undefined;
5
+ export declare const getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | 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: () => "none" | "png" | "jpeg" | undefined;
300
+ getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
301
301
  getWebpackOverrideFn: () => WebpackOverrideFn;
302
302
  getWebpackCaching: () => boolean;
303
303
  getOutputLocation: () => string | null;
@@ -1 +1 @@
1
- export declare const getLogLevel: () => "error" | "verbose" | "info" | "warn", setLogLevel: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
1
+ export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error", setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => 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, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & 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 {};
@@ -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, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
7
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & 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, "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 {};
@@ -114,11 +114,11 @@ const PlayPause = ({ playbackRate, loop }) => {
114
114
  frameForward(1);
115
115
  }, [frameForward]);
116
116
  const jumpToStart = (0, react_1.useCallback)(() => {
117
- seek(0);
118
- }, [seek]);
117
+ seek(inFrame !== null && inFrame !== void 0 ? inFrame : 0);
118
+ }, [seek, inFrame]);
119
119
  const jumpToEnd = (0, react_1.useCallback)(() => {
120
- seek((0, imperative_state_1.getCurrentDuration)() - 1);
121
- }, [seek]);
120
+ seek(outFrame !== null && outFrame !== void 0 ? outFrame : (0, imperative_state_1.getCurrentDuration)() - 1);
121
+ }, [seek, outFrame]);
122
122
  const keybindings = (0, use_keybinding_1.useKeybinding)();
123
123
  (0, react_1.useEffect)(() => {
124
124
  const arrowLeft = keybindings.registerKeybinding({
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from '@remotion/renderer';
2
- export declare const humanReadableCodec: (codec: Codec) => "AAC" | "MP3" | "GIF" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
2
+ export declare const humanReadableCodec: (codec: Codec) => "GIF" | "AAC" | "MP3" | "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)" | "rgba(255, 255, 255, 0.06)" | "hsla(0, 0%, 100%, 0.25)";
19
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Codec } from '@remotion/renderer';
2
3
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
3
4
  type Section = 'general' | 'picture' | 'advanced' | 'data' | 'gif' | 'audio';
@@ -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: "none" | "png" | "jpeg" | undefined;
36
+ configFileImageFormat: "png" | "jpeg" | "none" | undefined;
37
37
  }>;
@@ -49,7 +49,7 @@ const handleCommonError = async (err, logLevel) => {
49
49
  log_1.Log.info(' or if the component was renamed and the import statement not properly adjusted.');
50
50
  }
51
51
  if (err.message.includes('GLIBC_')) {
52
- log_1.Log.info('💡 Remotion requires at least Libc 2.34.');
52
+ log_1.Log.info('💡 Remotion requires at least Libc 2.35.');
53
53
  log_1.Log.info('💡 Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439');
54
54
  }
55
55
  if (err.message.includes('EBADF')) {
package/dist/index.d.ts CHANGED
@@ -118,7 +118,7 @@ export declare const CliInternals: {
118
118
  videoBitrate: string | null;
119
119
  height: number | null;
120
120
  width: number | null;
121
- configFileImageFormat: "none" | "png" | "jpeg" | undefined;
121
+ configFileImageFormat: "png" | "jpeg" | "none" | undefined;
122
122
  }>;
123
123
  loadConfig: (remotionRoot: string) => Promise<string | null>;
124
124
  initializeCli: (remotionRoot: string) => Promise<void>;
@@ -127,7 +127,7 @@ export declare const CliInternals: {
127
127
  parsedCli: {
128
128
  "browser-executable": import("@remotion/renderer").BrowserExecutable;
129
129
  "pixel-format": "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
130
- "image-format": "none" | "png" | "jpeg" | "pdf" | "webp";
130
+ "image-format": "png" | "jpeg" | "pdf" | "webp" | "none";
131
131
  "prores-profile": "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy";
132
132
  "bundle-cache": string;
133
133
  "env-file": string;
@@ -191,7 +191,7 @@ export declare const CliInternals: {
191
191
  downloadName: string | null;
192
192
  outName: string | null;
193
193
  configImageFormat: "png" | "jpeg" | "pdf" | "webp" | null;
194
- cliFlag: "none" | "png" | "jpeg" | "pdf" | "webp" | null;
194
+ cliFlag: "png" | "jpeg" | "pdf" | "webp" | "none" | null;
195
195
  isLambda: boolean;
196
196
  fromUi: "png" | "jpeg" | "pdf" | "webp" | null;
197
197
  }) => {
@@ -206,8 +206,8 @@ export declare const CliInternals: {
206
206
  };
207
207
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
208
208
  codec: import("@remotion/renderer").CodecOrUndefined;
209
- uiImageFormat: "none" | "png" | "jpeg" | null;
210
- }) => "none" | "png" | "jpeg";
209
+ uiImageFormat: "png" | "jpeg" | "none" | null;
210
+ }) => "png" | "jpeg" | "none";
211
211
  printCompositions: (compositions: import("remotion").VideoConfig[]) => void;
212
212
  getFinalOutputCodec: ({ cliFlag, configFile, downloadName, outName, uiCodec, }: {
213
213
  cliFlag: import("@remotion/renderer").CodecOrUndefined;
@@ -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 | -2 | Ranges;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
15
15
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
3
  import type { LiveEventsServer } from './live-events';
3
4
  export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
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.6",
39
- "@remotion/renderer": "4.0.6",
40
- "remotion": "4.0.6",
41
- "@remotion/media-utils": "4.0.6",
42
- "@remotion/player": "4.0.6"
38
+ "@remotion/bundler": "4.0.8",
39
+ "@remotion/media-utils": "4.0.8",
40
+ "remotion": "4.0.8",
41
+ "@remotion/renderer": "4.0.8",
42
+ "@remotion/player": "4.0.8"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
@@ -65,8 +65,8 @@
65
65
  "typescript": "4.9.5",
66
66
  "vitest": "0.31.1",
67
67
  "zod": "^3.21.4",
68
- "@remotion/zod-types": "4.0.6",
69
- "@remotion/tailwind": "4.0.6"
68
+ "@remotion/tailwind": "4.0.8",
69
+ "@remotion/zod-types": "4.0.8"
70
70
  },
71
71
  "keywords": [
72
72
  "remotion",
@@ -1 +0,0 @@
1
- export declare const cloudrunCommand: (remotionRoot: string, args: string[]) => Promise<never>;
@@ -1,27 +0,0 @@
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;
@@ -1,14 +0,0 @@
1
- export type SerializedJSONWithCustomFields = {
2
- serializedString: string;
3
- customDateUsed: boolean;
4
- customFileUsed: boolean;
5
- mapUsed: boolean;
6
- setUsed: boolean;
7
- };
8
- export declare const FILE_TOKEN = "remotion-file:";
9
- export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
- data: unknown;
11
- indent: number | undefined;
12
- staticBase: string;
13
- }) => SerializedJSONWithCustomFields;
14
- export declare const deserializeJSONWithCustomFields: (data: string) => any;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeJSONWithCustomFields = exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
4
- const DATE_TOKEN = 'remotion-date:';
5
- exports.FILE_TOKEN = 'remotion-file:';
6
- const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
7
- let customDateUsed = false;
8
- let customFileUsed = false;
9
- let mapUsed = false;
10
- let setUsed = false;
11
- const serializedString = JSON.stringify(data, function (key, value) {
12
- const item = this[key];
13
- if (item instanceof Date) {
14
- customDateUsed = true;
15
- return `${DATE_TOKEN}${item.toISOString()}`;
16
- }
17
- if (item instanceof Map) {
18
- mapUsed = true;
19
- return value;
20
- }
21
- if (item instanceof Set) {
22
- setUsed = true;
23
- return value;
24
- }
25
- if (typeof item === 'string' && item.startsWith(staticBase)) {
26
- customFileUsed = true;
27
- return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
28
- }
29
- return value;
30
- }, indent);
31
- return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
32
- };
33
- exports.serializeJSONWithDate = serializeJSONWithDate;
34
- const deserializeJSONWithCustomFields = (data) => {
35
- return JSON.parse(data, (_, value) => {
36
- if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
37
- return new Date(value.replace(DATE_TOKEN, ''));
38
- }
39
- return value;
40
- });
41
- };
42
- exports.deserializeJSONWithCustomFields = deserializeJSONWithCustomFields;
@@ -1,19 +0,0 @@
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;
@@ -1,81 +0,0 @@
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;
@@ -1,20 +0,0 @@
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;
@@ -1,81 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- import { ErrorWithStackFrame } from './handle-javascript-exception';
2
- import type { SymbolicateableError } from './symbolicateable-error';
3
- export declare const symbolicateError: (symbolicateableError: SymbolicateableError) => Promise<ErrorWithStackFrame>;
@@ -1,24 +0,0 @@
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;
@@ -1,7 +0,0 @@
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[];
@@ -1,90 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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 {};
@@ -1,135 +0,0 @@
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;
@@ -1,16 +0,0 @@
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
- }
@@ -1,18 +0,0 @@
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;