@remotion/cli 3.2.21 → 3.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/config/ffmpeg-override.d.ts +3 -0
  2. package/dist/config/ffmpeg-override.js +12 -0
  3. package/dist/config/index.d.ts +1 -0
  4. package/dist/config/index.js +3 -0
  5. package/dist/editor/components/Canvas.js +6 -2
  6. package/dist/editor/components/NewComposition/RemInput.js +1 -1
  7. package/dist/editor/components/Notifications/NotificationCenter.js +1 -1
  8. package/dist/editor/components/SizeSelector.js +1 -1
  9. package/dist/editor/components/Timeline/Timeline.js +1 -1
  10. package/dist/editor/components/Timeline/TimelineSlider.js +1 -1
  11. package/dist/editor/components/TimelineInOutToggle.js +1 -1
  12. package/dist/event-source.js +10 -9
  13. package/dist/get-cli-options.d.ts +1 -1
  14. package/dist/get-cli-options.js +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/render.js +3 -1
  17. package/package.json +7 -7
  18. package/dist/bundle.d.ts +0 -1
  19. package/dist/bundle.js +0 -32
  20. package/dist/config/bundle-out-dir.d.ts +0 -2
  21. package/dist/config/bundle-out-dir.js +0 -12
  22. package/dist/config/get-public-path.d.ts +0 -2
  23. package/dist/config/get-public-path.js +0 -12
  24. package/dist/editor/components/Button.d.ts +0 -4
  25. package/dist/editor/components/Button.js +0 -24
  26. package/dist/editor/components/PreviewZoomControls.d.ts +0 -2
  27. package/dist/editor/components/PreviewZoomControls.js +0 -49
  28. package/dist/editor/helpers/normalize-wheel.d.ts +0 -5
  29. package/dist/editor/helpers/normalize-wheel.js +0 -20
  30. package/dist/prepare-entry-point.d.ts +0 -12
  31. package/dist/prepare-entry-point.js +0 -37
  32. package/dist/webpack-cache.d.ts +0 -12
  33. package/dist/webpack-cache.js +0 -66
@@ -0,0 +1,3 @@
1
+ import type { FfmpegOverrideFn } from '@remotion/renderer';
2
+ export declare const setFfmpegOverrideFunction: (fn: FfmpegOverrideFn) => void;
3
+ export declare const getFfmpegOverrideFunction: () => FfmpegOverrideFn;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFfmpegOverrideFunction = exports.setFfmpegOverrideFunction = void 0;
4
+ let ffmpegOverrideFn = ({ args }) => args;
5
+ const setFfmpegOverrideFunction = (fn) => {
6
+ ffmpegOverrideFn = fn;
7
+ };
8
+ exports.setFfmpegOverrideFunction = setFfmpegOverrideFunction;
9
+ const getFfmpegOverrideFunction = () => {
10
+ return ffmpegOverrideFn;
11
+ };
12
+ exports.getFfmpegOverrideFunction = getFfmpegOverrideFunction;
@@ -45,5 +45,6 @@ export declare const ConfigInternals: {
45
45
  setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
46
46
  getKeyboardShortcutsEnabled: () => boolean;
47
47
  getPublicDir: () => string | null;
48
+ getFfmpegOverrideFunction: () => import("@remotion/renderer").FfmpegOverrideFn;
48
49
  };
49
50
  export declare const overrideRemotion: () => void;
@@ -61,6 +61,7 @@ const enforce_audio_track_1 = require("./enforce-audio-track");
61
61
  const env_file_2 = require("./env-file");
62
62
  const every_nth_frame_2 = require("./every-nth-frame");
63
63
  const ffmpeg_executable_2 = require("./ffmpeg-executable");
64
+ const ffmpeg_override_1 = require("./ffmpeg-override");
64
65
  const frame_range_2 = require("./frame-range");
65
66
  const image_format_2 = require("./image-format");
66
67
  const image_sequence_2 = require("./image-sequence");
@@ -125,6 +126,7 @@ exports.Config = {
125
126
  setCrf: crf_2.setCrf,
126
127
  setImageSequence: image_sequence_2.setImageSequence,
127
128
  setProResProfile: prores_profile_2.setProResProfile,
129
+ overrideFfmpegCommand: ffmpeg_override_1.setFfmpegOverrideFunction,
128
130
  },
129
131
  };
130
132
  // eslint-disable-next-line no-restricted-imports
@@ -168,6 +170,7 @@ exports.ConfigInternals = {
168
170
  setEnforceAudioTrack: enforce_audio_track_1.setEnforceAudioTrack,
169
171
  getKeyboardShortcutsEnabled: keyboard_shortcuts_1.getKeyboardShortcutsEnabled,
170
172
  getPublicDir: public_dir_1.getPublicDir,
173
+ getFfmpegOverrideFunction: ffmpeg_override_1.getFfmpegOverrideFunction,
171
174
  };
172
175
  const overrideRemotion = () => {
173
176
  Object.assign(remotion_1.Config, exports.Config);
@@ -122,8 +122,12 @@ const Canvas = () => {
122
122
  if (!current) {
123
123
  return;
124
124
  }
125
- current.addEventListener('wheel', onWheel);
126
- return () => current.removeEventListener('wheel', onWheel);
125
+ current.addEventListener('wheel', onWheel, { passive: false });
126
+ return () =>
127
+ // @ts-expect-error
128
+ current.removeEventListener('wheel', onWheel, {
129
+ passive: false,
130
+ });
127
131
  }, [onWheel]);
128
132
  const onReset = (0, react_1.useCallback)(() => {
129
133
  setSize(() => {
@@ -33,7 +33,7 @@ const RemInputForwardRef = (props, ref) => {
33
33
  }, [isFocused, isHovered, props.style]);
34
34
  (0, react_1.useImperativeHandle)(ref, () => {
35
35
  return inputRef.current;
36
- });
36
+ }, []);
37
37
  (0, react_1.useEffect)(() => {
38
38
  if (!inputRef.current) {
39
39
  return;
@@ -32,7 +32,7 @@ const NotificationCenter = () => {
32
32
  return {
33
33
  addNotification,
34
34
  };
35
- });
35
+ }, [addNotification]);
36
36
  return ((0, jsx_runtime_1.jsx)("div", { style: container, children: notifications.map((n) => {
37
37
  return ((0, jsx_runtime_1.jsx)(Notification_1.Notification, { created: n.created, duration: n.duration, id: n.id, onRemove: onRemove, children: n.content }, n.id));
38
38
  }) }));
@@ -84,7 +84,7 @@ const SizeSelector = () => {
84
84
  },
85
85
  type: 'item',
86
86
  value: newSize.size,
87
- keyHint: newSize.size ? '0' : null,
87
+ keyHint: newSize.size === 1 ? '0' : null,
88
88
  leftItem: String(size.size) === String(newSize.size) ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
89
89
  subMenu: null,
90
90
  };
@@ -60,7 +60,7 @@ const Timeline = () => {
60
60
  });
61
61
  },
62
62
  };
63
- });
63
+ }, [timeline]);
64
64
  const withoutHidden = (0, react_1.useMemo)(() => {
65
65
  return timeline.filter((t) => !(0, is_collapsed_1.isTrackHidden)(t, timeline, state));
66
66
  }, [state, timeline]);
@@ -43,7 +43,7 @@ const TimelineSlider = () => {
43
43
  current.style.transform = `translateX(${(0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, (0, imperative_state_1.getCurrentDuration)(), (_b = width !== null && width !== void 0 ? width : (_a = timeline_refs_1.sliderAreaRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0)}px)`;
44
44
  },
45
45
  };
46
- });
46
+ }, []);
47
47
  (0, react_1.useEffect)(() => {
48
48
  const currentRef = ref.current;
49
49
  if (!currentRef) {
@@ -211,7 +211,7 @@ const TimelineInOutPointToggle = () => {
211
211
  });
212
212
  },
213
213
  };
214
- });
214
+ }, [onInMark, onInOutClear, onOutMark, setInAndOutFrames]);
215
215
  if (!videoConfig) {
216
216
  return null;
217
217
  }
@@ -14,15 +14,16 @@ const openEventSource = () => {
14
14
  source.addEventListener('open', () => {
15
15
  var _a;
16
16
  (_a = ServerDisconnected_1.serverDisconnectedRef.current) === null || _a === void 0 ? void 0 : _a.setServerConnected();
17
- });
18
- source.addEventListener('error', () => {
19
- var _a;
20
- // Display an error message that the preview server has disconnected.
21
- (_a = ServerDisconnected_1.serverDisconnectedRef.current) === null || _a === void 0 ? void 0 : _a.setServerDisconnected();
22
- // Retry later
23
- setTimeout(() => {
24
- (0, exports.openEventSource)();
25
- }, 1000);
17
+ source.addEventListener('error', () => {
18
+ var _a;
19
+ // Display an error message that the preview server has disconnected.
20
+ (_a = ServerDisconnected_1.serverDisconnectedRef.current) === null || _a === void 0 ? void 0 : _a.setServerDisconnected();
21
+ source === null || source === void 0 ? void 0 : source.close();
22
+ // Retry later
23
+ setTimeout(() => {
24
+ (0, exports.openEventSource)();
25
+ }, 1000);
26
+ }, { once: true });
26
27
  });
27
28
  };
28
29
  exports.openEventSource = openEventSource;
@@ -30,6 +30,6 @@ export declare const getCliOptions: (options: {
30
30
  port: number | null;
31
31
  muted: boolean;
32
32
  enforceAudioTrack: boolean;
33
- keyboardShortcutsEnables: boolean;
34
33
  publicDir: string | null;
34
+ ffmpegOverride: import("@remotion/renderer").FfmpegOverrideFn;
35
35
  }>;
@@ -181,8 +181,8 @@ const getCliOptions = async (options) => {
181
181
  port: port !== null && port !== void 0 ? port : null,
182
182
  muted: config_1.ConfigInternals.getMuted(),
183
183
  enforceAudioTrack: config_1.ConfigInternals.getEnforceAudioTrack(),
184
- keyboardShortcutsEnables: config_1.ConfigInternals.getKeyboardShortcutsEnabled(),
185
184
  publicDir: config_1.ConfigInternals.getPublicDir(),
185
+ ffmpegOverride: config_1.ConfigInternals.getFfmpegOverrideFunction(),
186
186
  };
187
187
  };
188
188
  exports.getCliOptions = getCliOptions;
package/dist/index.d.ts CHANGED
@@ -97,8 +97,8 @@ export declare const CliInternals: {
97
97
  port: number | null;
98
98
  muted: boolean;
99
99
  enforceAudioTrack: boolean;
100
- keyboardShortcutsEnables: boolean;
101
100
  publicDir: string | null;
101
+ ffmpegOverride: import("@remotion/renderer").FfmpegOverrideFn;
102
102
  }>;
103
103
  parseCommandLine: (type: "sequence" | "still" | "lambda" | "preview" | "versions") => void;
104
104
  loadConfig: (remotionRoot: string) => Promise<string | null>;
package/dist/render.js CHANGED
@@ -36,7 +36,7 @@ const render = async (remotionRoot) => {
36
36
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
37
37
  await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'sequence');
38
38
  log_1.Log.verbose('Asset dirs', downloadMap.assetDir);
39
- const { codec, proResProfile, concurrency, frameRange, shouldOutputImageSequence, overwrite, inputProps, envVariables, quality, browser, crf, pixelFormat, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, numberOfGifLoops, everyNthFrame, puppeteerTimeout, muted, enforceAudioTrack, publicDir, } = await (0, get_cli_options_1.getCliOptions)({
39
+ const { codec, proResProfile, concurrency, frameRange, shouldOutputImageSequence, overwrite, inputProps, envVariables, quality, browser, crf, pixelFormat, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, numberOfGifLoops, everyNthFrame, puppeteerTimeout, muted, enforceAudioTrack, publicDir, ffmpegOverride, } = await (0, get_cli_options_1.getCliOptions)({
40
40
  isLambda: false,
41
41
  type: 'series',
42
42
  });
@@ -235,6 +235,8 @@ const render = async (remotionRoot) => {
235
235
  downloadMap,
236
236
  muted,
237
237
  enforceAudioTrack,
238
+ browserExecutable,
239
+ ffmpegOverride,
238
240
  });
239
241
  log_1.Log.info();
240
242
  log_1.Log.info();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.2.21",
3
+ "version": "3.2.23",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -23,15 +23,15 @@
23
23
  "author": "Jonny Burger <jonny@remotion.dev>",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@remotion/bundler": "3.2.21",
27
- "@remotion/media-utils": "3.2.21",
28
- "@remotion/player": "3.2.21",
29
- "@remotion/renderer": "3.2.21",
26
+ "@remotion/bundler": "3.2.23",
27
+ "@remotion/media-utils": "3.2.23",
28
+ "@remotion/player": "3.2.23",
29
+ "@remotion/renderer": "3.2.23",
30
30
  "better-opn": "2.1.1",
31
31
  "dotenv": "9.0.2",
32
32
  "memfs": "3.4.3",
33
33
  "minimist": "1.2.6",
34
- "remotion": "3.2.21",
34
+ "remotion": "3.2.23",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1"
37
37
  },
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "7236c416c1efcc6079ad262d6d5afa10e6775b81"
74
+ "gitHead": "34a407a825ded88c9058bcf0e9ec4fe04024b7ce"
75
75
  }
package/dist/bundle.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const bundleCommand: (remotionRoot: string) => Promise<void>;
package/dist/bundle.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleCommand = void 0;
4
- const get_cli_options_1 = require("./get-cli-options");
5
- const initialize_render_cli_1 = require("./initialize-render-cli");
6
- const log_1 = require("./log");
7
- const parse_command_line_1 = require("./parse-command-line");
8
- const prepare_entry_point_1 = require("./prepare-entry-point");
9
- const bundleCommand = async (remotionRoot) => {
10
- const file = parse_command_line_1.parsedCli._[1];
11
- if (!file) {
12
- log_1.Log.error('No entry point specified. Pass more arguments:');
13
- log_1.Log.error(' npx remotion bundle [entry-point]');
14
- log_1.Log.error('Documentation: https://www.remotion.dev/docs/cli/bundle');
15
- process.exit(1);
16
- }
17
- await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'bundle');
18
- const { publicPath, bundleOutDir } = await (0, get_cli_options_1.getCliOptions)({
19
- isLambda: false,
20
- type: 'get-compositions-or-bundle',
21
- });
22
- const { urlOrBundle } = await (0, prepare_entry_point_1.prepareEntryPoint)({
23
- file,
24
- otherSteps: [],
25
- outDir: bundleOutDir,
26
- publicPath,
27
- remotionRoot,
28
- });
29
- log_1.Log.info();
30
- log_1.Log.info(urlOrBundle);
31
- };
32
- exports.bundleCommand = bundleCommand;
@@ -1,2 +0,0 @@
1
- export declare const getBundleOutDir: () => string | null;
2
- export declare const setBundleDir: (path: string) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setBundleDir = exports.getBundleOutDir = void 0;
4
- let bundleOutDir = null;
5
- const getBundleOutDir = () => {
6
- return bundleOutDir;
7
- };
8
- exports.getBundleOutDir = getBundleOutDir;
9
- const setBundleDir = (path) => {
10
- bundleOutDir = path;
11
- };
12
- exports.setBundleDir = setBundleDir;
@@ -1,2 +0,0 @@
1
- export declare const getPublicPath: () => string | null;
2
- export declare const setPublicPath: (path: string) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setPublicPath = exports.getPublicPath = void 0;
4
- let publicPath = null;
5
- const getPublicPath = () => {
6
- return publicPath;
7
- };
8
- exports.getPublicPath = getPublicPath;
9
- const setPublicPath = (path) => {
10
- publicPath = path;
11
- };
12
- exports.setPublicPath = setPublicPath;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const Button: React.FC<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> & {
3
- children: React.ReactNode;
4
- }>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Button = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const colors_1 = require("../helpers/colors");
6
- const layout_1 = require("./layout");
7
- const container = {
8
- padding: 10,
9
- cursor: 'pointer',
10
- fontSize: 14,
11
- };
12
- const button = {
13
- border: `1px solid ${colors_1.INPUT_BORDER_COLOR_UNHOVERED}`,
14
- borderRadius: 4,
15
- backgroundColor: colors_1.INPUT_BACKGROUND,
16
- appearance: 'none',
17
- fontFamily: 'inherit',
18
- fontSize: 14,
19
- color: 'white',
20
- };
21
- const Button = ({ children, ...props }) => {
22
- return ((0, jsx_runtime_1.jsx)("button", { ...props, style: button, type: "button", children: (0, jsx_runtime_1.jsx)(layout_1.Row, { style: container, children: children }) }));
23
- };
24
- exports.Button = Button;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const PreviewZoomControls: React.FC;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreviewZoomControls = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const minus_1 = require("../icons/minus");
7
- const plus_1 = require("../icons/plus");
8
- const preview_size_1 = require("../state/preview-size");
9
- const ControlButton_1 = require("./ControlButton");
10
- const layout_1 = require("./layout");
11
- const container = {
12
- color: 'black',
13
- flexDirection: 'row',
14
- display: 'flex',
15
- };
16
- const buttonStyle = {
17
- fontSize: 24,
18
- };
19
- const iconStyle = {
20
- color: 'white',
21
- width: 14,
22
- };
23
- const PreviewZoomControls = () => {
24
- const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
25
- const onZoomOutClicked = (0, react_1.useCallback)(() => {
26
- setSize((z) => {
27
- // TODO: Don't assume 1
28
- const newSize = Number((z.size === 'auto' ? 1 : z.size - preview_size_1.ZOOM_BUTTON_STEP).toFixed(2));
29
- return { ...z, size: Math.max(preview_size_1.PREVIEW_MIN_ZOOM, newSize) };
30
- });
31
- }, [setSize]);
32
- const onZoomInClicked = (0, react_1.useCallback)(() => {
33
- setSize((z) => {
34
- // TODO: Don't assume 1
35
- if (z.size === 'auto')
36
- return {
37
- size: 1 + preview_size_1.ZOOM_BUTTON_STEP,
38
- translation: {
39
- x: 0,
40
- y: 0,
41
- },
42
- };
43
- const newSize = Number((Number(z) + preview_size_1.ZOOM_BUTTON_STEP).toFixed(2));
44
- return { ...z, size: Math.min(preview_size_1.PREVIEW_MAX_ZOOM, newSize) };
45
- });
46
- }, [setSize]);
47
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onZoomOutClicked, style: buttonStyle, title: "Zoom out preview", role: 'ControlButton', type: "button", disabled: size.size !== 'auto' && preview_size_1.PREVIEW_MIN_ZOOM === size.size, children: (0, jsx_runtime_1.jsx)(minus_1.Minus, { style: iconStyle }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onZoomInClicked, style: buttonStyle, title: "Zoom in preview", role: 'button', type: "button", disabled: size.size !== 'auto' && preview_size_1.PREVIEW_MAX_ZOOM === size.size, children: (0, jsx_runtime_1.jsx)(plus_1.Plus, { style: iconStyle }) })] }));
48
- };
49
- exports.PreviewZoomControls = PreviewZoomControls;
@@ -1,5 +0,0 @@
1
- export declare function normalizeWheel(event: WheelEvent): {
2
- deltaX: number;
3
- deltaY: number;
4
- deltaZ: number;
5
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeWheel = void 0;
4
- // Taken from https://github.com/tldraw/tldraw/blob/254dfdfd77c4abde53240f7d8ca3558e08688493/packages/core/src/hooks/useZoomEvents.ts which is adapted from https://stackoverflow.com/a/13650579
5
- const MAX_ZOOM_STEP = 10;
6
- function normalizeWheel(event) {
7
- const { deltaY, deltaX } = event;
8
- let deltaZ = 0;
9
- if (event.ctrlKey || event.metaKey) {
10
- const signY = Math.sign(event.deltaY);
11
- const absDeltaY = Math.abs(event.deltaY);
12
- let dy = deltaY;
13
- if (absDeltaY > MAX_ZOOM_STEP) {
14
- dy = MAX_ZOOM_STEP * signY;
15
- }
16
- deltaZ = dy;
17
- }
18
- return { deltaX, deltaY, deltaZ };
19
- }
20
- exports.normalizeWheel = normalizeWheel;
@@ -1,12 +0,0 @@
1
- import type { RenderStep } from './step';
2
- export declare const prepareEntryPoint: ({ file, otherSteps, publicPath, outDir, remotionRoot, }: {
3
- file: string;
4
- otherSteps: RenderStep[];
5
- outDir: string | null;
6
- publicPath: string | null;
7
- remotionRoot: string;
8
- }) => Promise<{
9
- urlOrBundle: string;
10
- steps: RenderStep[];
11
- shouldDelete: boolean;
12
- }>;
@@ -1,37 +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.prepareEntryPoint = void 0;
7
- const renderer_1 = require("@remotion/renderer");
8
- const promises_1 = require("fs/promises");
9
- const path_1 = __importDefault(require("path"));
10
- const process_1 = require("process");
11
- const log_1 = require("./log");
12
- const setup_cache_1 = require("./setup-cache");
13
- const prepareEntryPoint = async ({ file, otherSteps, publicPath, outDir, remotionRoot, }) => {
14
- if (renderer_1.RenderInternals.isServeUrl(file)) {
15
- return { urlOrBundle: file, steps: otherSteps, shouldDelete: false };
16
- }
17
- const joined = path_1.default.resolve(process.cwd(), file);
18
- try {
19
- const stats = await (0, promises_1.stat)(joined);
20
- if (stats.isDirectory()) {
21
- return { urlOrBundle: joined, steps: otherSteps, shouldDelete: false };
22
- }
23
- }
24
- catch (err) {
25
- log_1.Log.error(`No file or directory exists at ${joined}.`);
26
- (0, process_1.exit)(1);
27
- }
28
- const urlOrBundle = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
29
- fullPath: joined,
30
- steps: ['bundling', ...otherSteps],
31
- outDir,
32
- publicPath,
33
- remotionRoot,
34
- });
35
- return { urlOrBundle, steps: ['bundling', ...otherSteps], shouldDelete: true };
36
- };
37
- exports.prepareEntryPoint = prepareEntryPoint;
@@ -1,12 +0,0 @@
1
- declare type Environment = 'development' | 'production';
2
- declare global {
3
- namespace NodeJS {
4
- interface ProcessVersions {
5
- pnp?: string;
6
- }
7
- }
8
- }
9
- export declare const clearCache: (environment: Environment, inputProps: object | null) => Promise<void>;
10
- export declare const getWebpackCacheName: (environment: Environment, inputProps: object | null) => string;
11
- export declare const cacheExists: (environment: Environment, inputProps: object | null) => boolean;
12
- export {};
@@ -1,66 +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.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const remotion_1 = require("remotion");
10
- // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
11
- // An algorithm to determine where Webpack will cache the depencies
12
- const getWebpackCacheDir = () => {
13
- const cwd = process.cwd();
14
- let dir = cwd;
15
- for (;;) {
16
- try {
17
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
18
- break;
19
- }
20
- // eslint-disable-next-line no-empty
21
- }
22
- catch (e) { }
23
- const parent = path_1.default.dirname(dir);
24
- if (dir === parent) {
25
- dir = undefined;
26
- break;
27
- }
28
- dir = parent;
29
- }
30
- if (!dir) {
31
- return path_1.default.resolve(cwd, '.cache/webpack');
32
- }
33
- if (process.versions.pnp === '1') {
34
- return path_1.default.resolve(dir, '.pnp/.cache/webpack');
35
- }
36
- if (process.versions.pnp === '3') {
37
- return path_1.default.resolve(dir, '.yarn/.cache/webpack');
38
- }
39
- return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
40
- };
41
- const remotionCacheLocation = (environment, inputProps) => {
42
- return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
43
- };
44
- const clearCache = (environment, inputProps) => {
45
- var _a;
46
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
47
- recursive: true,
48
- });
49
- };
50
- exports.clearCache = clearCache;
51
- const getWebpackCacheName = (environment, inputProps) => {
52
- // In development, let's reset the cache when input props
53
- // are changing, because they are injected using Webpack and if changed,
54
- // it will get the cached version
55
- if (environment === 'development') {
56
- return `remotion-v3-${environment}-${(0, remotion_1.random)(JSON.stringify(inputProps))}`;
57
- }
58
- // In production, the cache is independent from input props because
59
- // they are passed over URL params. Speed is mostly important in production.
60
- return `remotion-v3-${environment}`;
61
- };
62
- exports.getWebpackCacheName = getWebpackCacheName;
63
- const cacheExists = (environment, inputProps) => {
64
- return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
65
- };
66
- exports.cacheExists = cacheExists;