@remotion/cli 4.0.7 → 4.0.10

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 (30) hide show
  1. package/dist/cloudrun-command.d.ts +1 -0
  2. package/dist/cloudrun-command.js +27 -0
  3. package/dist/config/log.d.ts +1 -1
  4. package/dist/editor/components/Canvas.js +4 -4
  5. package/dist/editor/components/FullscreenToggle.d.ts +2 -0
  6. package/dist/editor/components/FullscreenToggle.js +25 -0
  7. package/dist/editor/components/PreviewToolbar.js +3 -1
  8. package/dist/editor/components/RenderModal/FrameRangeSetting.js +9 -25
  9. package/dist/editor/components/RenderModal/MultiRangeSlider.d.ts +12 -0
  10. package/dist/editor/components/RenderModal/MultiRangeSlider.js +50 -0
  11. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +14 -0
  12. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +42 -0
  13. package/dist/editor/helpers/colors.d.ts +1 -1
  14. package/dist/editor/helpers/use-menu-structure.js +25 -1
  15. package/dist/editor/state/canvas-ref.d.ts +2 -0
  16. package/dist/editor/state/canvas-ref.js +5 -0
  17. package/dist/error-with-stack-frame.d.ts +19 -0
  18. package/dist/error-with-stack-frame.js +81 -0
  19. package/dist/handle-javascript-error.d.ts +20 -0
  20. package/dist/handle-javascript-error.js +81 -0
  21. package/dist/symbolicate-error.d.ts +3 -0
  22. package/dist/symbolicate-error.js +24 -0
  23. package/dist/symbolicate-errors.d.ts +7 -0
  24. package/dist/symbolicate-errors.js +90 -0
  25. package/dist/symbolicate-stacktrace.d.ts +28 -0
  26. package/dist/symbolicate-stacktrace.js +135 -0
  27. package/dist/symbolicateable-error.d.ts +16 -0
  28. package/dist/symbolicateable-error.js +18 -0
  29. package/package.json +8 -8
  30. package/styles/styles.css +53 -0
@@ -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;
@@ -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;
@@ -9,6 +9,7 @@ const colors_1 = require("../helpers/colors");
9
9
  const get_effective_translation_1 = require("../helpers/get-effective-translation");
10
10
  const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
11
11
  const use_keybinding_1 = require("../helpers/use-keybinding");
12
+ const canvas_ref_1 = require("../state/canvas-ref");
12
13
  const editor_zoom_gestures_1 = require("../state/editor-zoom-gestures");
13
14
  const preview_size_1 = require("../state/preview-size");
14
15
  const layout_1 = require("./layout");
@@ -29,11 +30,10 @@ const resetZoom = {
29
30
  const ZOOM_PX_FACTOR = 0.003;
30
31
  const Canvas = () => {
31
32
  const dimensions = (0, is_current_selected_still_1.useDimensions)();
32
- const ref = (0, react_1.useRef)(null);
33
33
  const { setSize, size: previewSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
34
34
  const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
35
35
  const keybindings = (0, use_keybinding_1.useKeybinding)();
36
- const size = player_1.PlayerInternals.useElementSize(ref, {
36
+ const size = player_1.PlayerInternals.useElementSize(canvas_ref_1.canvasRef, {
37
37
  triggerOnWindowResize: false,
38
38
  shouldApplyCssTransforms: true,
39
39
  });
@@ -120,7 +120,7 @@ const Canvas = () => {
120
120
  });
121
121
  }, [editorZoomGestures, dimensions, isFit, setSize, size]);
122
122
  (0, react_1.useEffect)(() => {
123
- const { current } = ref;
123
+ const { current } = canvas_ref_1.canvasRef;
124
124
  if (!current) {
125
125
  return;
126
126
  }
@@ -219,6 +219,6 @@ const Canvas = () => {
219
219
  zoomOut.unregister();
220
220
  };
221
221
  }, [keybindings, onReset, onZoomIn, onZoomOut]);
222
- return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, className: "css-reset", children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
222
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: canvas_ref_1.canvasRef, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, className: "css-reset", children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
223
223
  };
224
224
  exports.Canvas = Canvas;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const FullScreenToggle: React.FC<{}>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FullScreenToggle = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const canvas_ref_1 = require("../state/canvas-ref");
7
+ const preview_size_1 = require("../state/preview-size");
8
+ const ControlButton_1 = require("./ControlButton");
9
+ const FullScreenToggle = () => {
10
+ const { setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
11
+ const onClick = (0, react_1.useCallback)(() => {
12
+ var _a;
13
+ (_a = canvas_ref_1.canvasRef.current) === null || _a === void 0 ? void 0 : _a.requestFullscreen();
14
+ if (document.fullscreenElement)
15
+ setSize(() => ({
16
+ size: 'auto',
17
+ translation: {
18
+ x: 0,
19
+ y: 0,
20
+ },
21
+ }));
22
+ }, [setSize]);
23
+ return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: "Enter fullscreen preview", "aria-label": "Enter fullscreen preview", onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill: "#fff", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }) }) }));
24
+ };
25
+ exports.FullScreenToggle = FullScreenToggle;
@@ -9,6 +9,7 @@ const timeline_layout_1 = require("../helpers/timeline-layout");
9
9
  const loop_1 = require("../state/loop");
10
10
  const CheckboardToggle_1 = require("./CheckboardToggle");
11
11
  const FpsCounter_1 = require("./FpsCounter");
12
+ const FullscreenToggle_1 = require("./FullscreenToggle");
12
13
  const layout_1 = require("./layout");
13
14
  const LoopToggle_1 = require("./LoopToggle");
14
15
  const MuteToggle_1 = require("./MuteToggle");
@@ -45,6 +46,7 @@ const PreviewToolbar = () => {
45
46
  const { mediaMuted } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
46
47
  const { setMediaMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
47
48
  const [loop, setLoop] = (0, react_1.useState)((0, loop_1.loadLoopOption)());
48
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: padding }), (0, jsx_runtime_1.jsx)(TimelineZoomControls_1.TimelineZoomControls, {})] }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(SizeSelector_1.SizeSelector, {}), (0, jsx_runtime_1.jsx)(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(PlayPause_1.PlayPause, { loop: loop, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(LoopToggle_1.LoopToggle, { loop: loop, setLoop: setLoop }), (0, jsx_runtime_1.jsx)(CheckboardToggle_1.CheckboardToggle, {}), (0, jsx_runtime_1.jsx)(TimelineInOutToggle_1.TimelineInOutPointToggle, {}), (0, jsx_runtime_1.jsx)(MuteToggle_1.MuteToggle, { muted: mediaMuted, setMuted: setMediaMuted }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(FpsCounter_1.FpsCounter, { playbackSpeed: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(RenderButton_1.RenderButton, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 })] }), (0, jsx_runtime_1.jsx)(PlaybackKeyboardShortcutsManager_1.PlaybackKeyboardShortcutsManager, { setPlaybackRate: setPlaybackRate }), (0, jsx_runtime_1.jsx)(PlaybackRatePersistor_1.PlaybackRatePersistor, {})] }));
49
+ const isFullscreenSupported = document.fullscreenEnabled || document.webkitFullscreenEnabled;
50
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: padding }), (0, jsx_runtime_1.jsx)(TimelineZoomControls_1.TimelineZoomControls, {})] }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(SizeSelector_1.SizeSelector, {}), (0, jsx_runtime_1.jsx)(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(PlayPause_1.PlayPause, { loop: loop, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(LoopToggle_1.LoopToggle, { loop: loop, setLoop: setLoop }), (0, jsx_runtime_1.jsx)(CheckboardToggle_1.CheckboardToggle, {}), (0, jsx_runtime_1.jsx)(TimelineInOutToggle_1.TimelineInOutPointToggle, {}), (0, jsx_runtime_1.jsx)(MuteToggle_1.MuteToggle, { muted: mediaMuted, setMuted: setMediaMuted }), isFullscreenSupported && (0, jsx_runtime_1.jsx)(FullscreenToggle_1.FullScreenToggle, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(FpsCounter_1.FpsCounter, { playbackSpeed: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(RenderButton_1.RenderButton, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 })] }), (0, jsx_runtime_1.jsx)(PlaybackKeyboardShortcutsManager_1.PlaybackKeyboardShortcutsManager, { setPlaybackRate: setPlaybackRate }), (0, jsx_runtime_1.jsx)(PlaybackRatePersistor_1.PlaybackRatePersistor, {})] }));
49
51
  };
50
52
  exports.PreviewToolbar = PreviewToolbar;
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrameRangeSetting = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const InputDragger_1 = require("../NewComposition/InputDragger");
7
- const RemInput_1 = require("../NewComposition/RemInput");
8
6
  const layout_1 = require("./layout");
7
+ const MultiRangeSlider_1 = require("./MultiRangeSlider");
8
+ const numberWrapper = {
9
+ minWidth: '39px',
10
+ display: 'flex',
11
+ justifyContent: 'flex-end',
12
+ alignItems: 'center',
13
+ fontSize: '14px',
14
+ };
9
15
  const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
10
- const maxStartFrame = endFrame - 1;
11
16
  const minStartFrame = 0;
12
- const minEndFrame = startFrame + 1;
13
17
  const maxEndFrame = durationInFrames - 1;
14
18
  const onStartFrameChangedDirectly = (0, react_1.useCallback)((newStartFrame) => {
15
19
  setStartFrame(newStartFrame);
@@ -17,26 +21,6 @@ const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames
17
21
  const onEndFrameChangedDirectly = (0, react_1.useCallback)((newEndFrame) => {
18
22
  setEndFrame(newEndFrame);
19
23
  }, [setEndFrame]);
20
- const onStartFrameChanged = (0, react_1.useCallback)((e) => {
21
- setStartFrame((q) => {
22
- const newStartFrame = parseInt(e, 10);
23
- if (Number.isNaN(newStartFrame)) {
24
- return q;
25
- }
26
- const newStartFrameClamped = Math.min(maxStartFrame, Math.max(newStartFrame, minStartFrame));
27
- return newStartFrameClamped;
28
- });
29
- }, [maxStartFrame, setStartFrame]);
30
- const onEndFrameChanged = (0, react_1.useCallback)((e) => {
31
- setEndFrame((q) => {
32
- const newEndFrame = parseInt(e, 10);
33
- if (Number.isNaN(newEndFrame)) {
34
- return q;
35
- }
36
- const newEndFrameClamped = Math.min(maxEndFrame, Math.max(newEndFrame, minEndFrame));
37
- return newEndFrameClamped;
38
- });
39
- }, [maxEndFrame, minEndFrame, setEndFrame]);
40
- return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame range" }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.rightRow, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: startFrame, onTextChange: onStartFrameChanged, placeholder: `${minStartFrame}-${maxStartFrame}`, onValueChange: onStartFrameChangedDirectly, name: "startFrame", step: 1, min: minStartFrame, max: maxStartFrame, status: "ok", rightAlign: true }) }), (0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: endFrame, onTextChange: onEndFrameChanged, placeholder: `${minEndFrame}-${maxEndFrame}`, onValueChange: onEndFrameChangedDirectly, name: "endFrame", step: 1, min: minEndFrame, max: maxEndFrame, status: "ok", rightAlign: true }) })] })] }));
24
+ return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame range" }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.rightRow, children: [(0, jsx_runtime_1.jsx)("div", { style: numberWrapper, children: startFrame }), (0, jsx_runtime_1.jsx)(MultiRangeSlider_1.MultiRangeSlider, { min: minStartFrame, max: maxEndFrame, start: startFrame, end: endFrame, step: 1, onLeftThumbDrag: onStartFrameChangedDirectly, onRightThumbDrag: onEndFrameChangedDirectly }), (0, jsx_runtime_1.jsx)("div", { style: numberWrapper, children: endFrame })] })] }));
41
25
  };
42
26
  exports.FrameRangeSetting = FrameRangeSetting;
@@ -0,0 +1,12 @@
1
+ import type { FC } from 'react';
2
+ interface MultiRangeSliderProps {
3
+ min: number;
4
+ max: number;
5
+ start: number;
6
+ end: number;
7
+ step: number;
8
+ onLeftThumbDrag: (newVal: number) => void;
9
+ onRightThumbDrag: (newVal: number) => void;
10
+ }
11
+ export declare const MultiRangeSlider: FC<MultiRangeSliderProps>;
12
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiRangeSlider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
7
+ const container = {
8
+ borderColor: 'black',
9
+ borderStyle: 'solid',
10
+ height: 39,
11
+ width: 220,
12
+ position: 'relative',
13
+ backgroundColor: colors_1.INPUT_BACKGROUND,
14
+ marginLeft: 8,
15
+ marginRight: 8,
16
+ borderRadius: 2,
17
+ };
18
+ const slider = {
19
+ position: 'relative',
20
+ height: 38,
21
+ width: 220,
22
+ };
23
+ const sliderRange = {
24
+ position: 'absolute',
25
+ top: 0,
26
+ backgroundColor: colors_1.BLUE,
27
+ height: 39,
28
+ };
29
+ const MultiRangeSlider = ({ min, max, start, end, step, onLeftThumbDrag, onRightThumbDrag, }) => {
30
+ const getPercent = (0, react_1.useCallback)((value) => Math.round(((value - min) / (max - min)) * 100), [min, max]);
31
+ const rangeStyle = (0, react_1.useMemo)(() => {
32
+ const minPercent = getPercent(start);
33
+ const maxPercent = getPercent(end);
34
+ return {
35
+ ...sliderRange,
36
+ left: `${minPercent}%`,
37
+ width: `${maxPercent - minPercent}%`,
38
+ };
39
+ }, [end, getPercent, start]);
40
+ const onChangeLeft = (0, react_1.useCallback)((event) => {
41
+ const value = Math.min(Number(event.target.value), end - 1);
42
+ onLeftThumbDrag(value);
43
+ }, [end, onLeftThumbDrag]);
44
+ const onChangeRight = (0, react_1.useCallback)((event) => {
45
+ const value = Math.max(Number(event.target.value), start + 1);
46
+ onRightThumbDrag(value);
47
+ }, [onRightThumbDrag, start]);
48
+ return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsxs)("div", { style: slider, children: [(0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: start, step: step, onChange: onChangeLeft, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: end, step: step, onChange: onChangeRight, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("div", { style: rangeStyle })] }) }));
49
+ };
50
+ exports.MultiRangeSlider = MultiRangeSlider;
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,42 @@
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;
@@ -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)";
@@ -11,6 +11,7 @@ const NotificationCenter_1 = require("../components/Notifications/NotificationCe
11
11
  const SizeSelector_1 = require("../components/SizeSelector");
12
12
  const TimelineInOutToggle_1 = require("../components/TimelineInOutToggle");
13
13
  const Checkmark_1 = require("../icons/Checkmark");
14
+ const canvas_ref_1 = require("../state/canvas-ref");
14
15
  const checkerboard_1 = require("../state/checkerboard");
15
16
  const editor_zoom_gestures_1 = require("../state/editor-zoom-gestures");
16
17
  const modals_1 = require("../state/modals");
@@ -36,6 +37,7 @@ const useMenuStructure = (closeMenu) => {
36
37
  const { type } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
37
38
  const { setSidebarCollapsedState, sidebarCollapsedStateLeft, sidebarCollapsedStateRight, } = (0, react_1.useContext)(sidebar_1.SidebarContext);
38
39
  const sizes = (0, SizeSelector_1.getUniqueSizes)(size);
40
+ const isFullscreenSupported = document.fullscreenEnabled || document.webkitFullscreenEnabled;
39
41
  const structure = (0, react_1.useMemo)(() => {
40
42
  const struct = [
41
43
  {
@@ -474,7 +476,28 @@ const useMenuStructure = (closeMenu) => {
474
476
  value: 'clear-marks',
475
477
  quickSwitcherLabel: 'Timeline: Clear In and Out Mark',
476
478
  },
477
- ],
479
+ {
480
+ id: 'fullscreen-divider',
481
+ type: 'divider',
482
+ },
483
+ isFullscreenSupported
484
+ ? {
485
+ id: 'fullscreen',
486
+ keyHint: null,
487
+ label: 'Fullscreen',
488
+ leftItem: null,
489
+ onClick: () => {
490
+ var _a;
491
+ closeMenu();
492
+ (_a = canvas_ref_1.canvasRef.current) === null || _a === void 0 ? void 0 : _a.requestFullscreen();
493
+ },
494
+ subMenu: null,
495
+ type: 'item',
496
+ value: 'fullscreen',
497
+ quickSwitcherLabel: 'Go Fullscreen',
498
+ }
499
+ : null,
500
+ ].filter(remotion_1.Internals.truthy),
478
501
  },
479
502
  'EyeDropper' in window
480
503
  ? {
@@ -639,6 +662,7 @@ const useMenuStructure = (closeMenu) => {
639
662
  sidebarCollapsedStateLeft,
640
663
  sidebarCollapsedStateRight,
641
664
  checkerboard,
665
+ isFullscreenSupported,
642
666
  closeMenu,
643
667
  setSelectedModal,
644
668
  type,
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const canvasRef: import("react").RefObject<HTMLDivElement>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canvasRef = void 0;
4
+ const react_1 = require("react");
5
+ exports.canvasRef = (0, react_1.createRef)();
@@ -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;
@@ -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;
@@ -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.7",
3
+ "version": "4.0.10",
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.7",
39
- "@remotion/renderer": "4.0.7",
40
- "remotion": "4.0.7",
41
- "@remotion/media-utils": "4.0.7",
42
- "@remotion/player": "4.0.7"
38
+ "@remotion/bundler": "4.0.10",
39
+ "@remotion/media-utils": "4.0.10",
40
+ "@remotion/player": "4.0.10",
41
+ "remotion": "4.0.10",
42
+ "@remotion/renderer": "4.0.10"
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.7",
69
- "@remotion/tailwind": "4.0.7"
68
+ "@remotion/zod-types": "4.0.10",
69
+ "@remotion/tailwind": "4.0.10"
70
70
  },
71
71
  "keywords": [
72
72
  "remotion",
package/styles/styles.css CHANGED
@@ -42,3 +42,56 @@ input[type='color'].__remotion_color_picker::-webkit-color-swatch-wrapper {
42
42
  input[type='color'].__remotion_color_picker::-webkit-color-swatch {
43
43
  border: none;
44
44
  }
45
+
46
+ .__remotion_thumb,
47
+ .__remotion_thumb::-webkit-slider-thumb {
48
+ -webkit-appearance: none;
49
+ -webkit-tap-highlight-color: transparent;
50
+ }
51
+
52
+ .__remotion_thumb {
53
+ pointer-events: none;
54
+ position: absolute;
55
+ height: 0;
56
+ outline: none;
57
+ top: 51%;
58
+ width: 100%;
59
+ z-index: 2;
60
+ }
61
+
62
+ /* For Firefox browsers */
63
+ .__remotion_thumb::-moz-range-thumb {
64
+ border: none;
65
+ border-radius: 0;
66
+ cursor: pointer;
67
+ height: 40px;
68
+ width: 10px;
69
+ pointer-events: all;
70
+ border-color: black;
71
+ background-color: white;
72
+ position: relative;
73
+ }
74
+
75
+ .__remotion_thumb::-moz-range-thumb {
76
+ border-width: 1px;
77
+ border-style: solid;
78
+ }
79
+
80
+ /* For Chrome browsers */
81
+ .__remotion_thumb::-webkit-slider-thumb {
82
+ border: 1px solid black;
83
+ border-radius: 2px;
84
+ cursor: pointer;
85
+ height: 40px;
86
+ width: 10px;
87
+ pointer-events: all;
88
+ border-color: black;
89
+ background-color: white;
90
+ position: relative;
91
+ }
92
+
93
+ .__remotion_thumb::-webkit-slider-thumb {
94
+ border-width: 1px;
95
+ border-style: solid;
96
+ border-color: black;
97
+ }