@remotion/cli 4.1.0-alpha10 → 4.1.0-alpha12
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.
- package/dist/codemods/update-default-props.js +5 -0
- package/dist/config/image-format.d.ts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/editor/components/AssetSelector.js +61 -6
- package/dist/editor/components/AssetSelectorItem.js +27 -11
- package/dist/editor/components/CompositionSelector.js +3 -3
- package/dist/editor/components/CopyButton.js +8 -2
- package/dist/editor/components/CurrentCompositionSideEffects.js +9 -5
- package/dist/editor/components/FullscreenToggle.js +23 -1
- package/dist/editor/components/InlineAction.d.ts +1 -0
- package/dist/editor/components/InlineAction.js +2 -2
- package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
- package/dist/editor/components/OptionsPanel.js +45 -12
- package/dist/editor/components/RenderModal/CliCopyButton.js +2 -1
- package/dist/editor/components/RenderModal/MultiRangeSlider.js +4 -7
- package/dist/editor/components/RenderModal/RenderModal.js +7 -7
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +5 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +17 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +83 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +5 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +5 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +5 -1
- package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +2 -1
- package/dist/editor/components/TopPanel.js +4 -8
- package/dist/editor/components/UpdateModal/UpdateModal.js +4 -1
- package/dist/editor/helpers/copy-text.d.ts +1 -1
- package/dist/editor/helpers/copy-text.js +15 -10
- package/dist/editor/helpers/document-title.d.ts +4 -0
- package/dist/editor/helpers/document-title.js +60 -0
- package/dist/editor/helpers/pick-color.js +12 -7
- package/dist/editor/helpers/render-modal-sections.d.ts +0 -1
- package/dist/editor/icons/clipboard.d.ts +4 -0
- package/dist/editor/icons/clipboard.js +6 -0
- package/dist/editor/icons/file.d.ts +3 -1
- package/dist/editor/icons/file.js +1 -1
- package/dist/editor/icons/folder.d.ts +3 -0
- package/dist/editor/icons/folder.js +5 -1
- package/dist/event-source-events.d.ts +1 -0
- package/dist/event-source.js +1 -0
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/get-input-props.js +2 -1
- package/dist/handle-common-errors.js +2 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/make-on-download.d.ts +12 -0
- package/dist/make-on-download.js +40 -0
- package/dist/parse-command-line.d.ts +1 -0
- package/dist/preview-server/public-folder.js +3 -0
- package/dist/preview-server/render-queue/process-still.js +1 -1
- package/dist/preview-server/routes.d.ts +0 -1
- package/dist/preview-server/routes.js +1 -0
- package/dist/progress-bar.js +2 -7
- package/dist/render-flows/render.js +17 -25
- package/dist/render-flows/still.d.ts +2 -2
- package/dist/render-flows/still.js +30 -40
- package/dist/still.js +1 -1
- package/dist/studio.js +8 -1
- package/dist/upgrade.d.ts +1 -1
- package/dist/upgrade.js +11 -4
- package/package.json +8 -8
- package/styles/styles.css +7 -17
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +0 -14
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +0 -42
- package/dist/error-with-stack-frame.d.ts +0 -19
- package/dist/error-with-stack-frame.js +0 -81
- package/dist/handle-javascript-error.d.ts +0 -20
- package/dist/handle-javascript-error.js +0 -81
- package/dist/symbolicate-error.d.ts +0 -3
- package/dist/symbolicate-error.js +0 -24
- package/dist/symbolicate-errors.d.ts +0 -7
- package/dist/symbolicate-errors.js +0 -90
- package/dist/symbolicate-stacktrace.d.ts +0 -28
- package/dist/symbolicate-stacktrace.js +0 -135
- package/dist/symbolicateable-error.d.ts +0 -16
- package/dist/symbolicateable-error.js +0 -18
|
@@ -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,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;
|