@remotion/cli 3.2.29 → 3.2.31

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 (36) hide show
  1. package/dist/config/log.d.ts +1 -1
  2. package/dist/determine-image-format.d.ts +0 -0
  3. package/dist/determine-image-format.js +0 -0
  4. package/dist/editor/components/PlayPause.d.ts +5 -0
  5. package/dist/get-cli-options.d.ts +1 -1
  6. package/dist/get-cli-options.js +2 -3
  7. package/dist/get-final-output-codec.js +3 -0
  8. package/dist/get-network-address.d.ts +1 -0
  9. package/dist/get-network-address.js +16 -0
  10. package/dist/index.d.ts +1 -1
  11. package/dist/list-of-remotion-packages.js +1 -0
  12. package/dist/preview-server/dev-middleware/setup-hooks.js +15 -4
  13. package/dist/preview-server/hot-middleware/index.js +1 -2
  14. package/dist/preview.js +9 -1
  15. package/dist/render.js +7 -0
  16. package/package.json +7 -7
  17. package/dist/bundle.d.ts +0 -1
  18. package/dist/bundle.js +0 -32
  19. package/dist/config/bundle-out-dir.d.ts +0 -2
  20. package/dist/config/bundle-out-dir.js +0 -12
  21. package/dist/config/get-public-path.d.ts +0 -2
  22. package/dist/config/get-public-path.js +0 -12
  23. package/dist/editor/components/Button.d.ts +0 -4
  24. package/dist/editor/components/Button.js +0 -24
  25. package/dist/editor/components/PreviewZoomControls.d.ts +0 -2
  26. package/dist/editor/components/PreviewZoomControls.js +0 -49
  27. package/dist/editor/helpers/normalize-wheel.d.ts +0 -5
  28. package/dist/editor/helpers/normalize-wheel.js +0 -20
  29. package/dist/initialize-render-cli.d.ts +0 -1
  30. package/dist/initialize-render-cli.js +0 -22
  31. package/dist/prepare-entry-point.d.ts +0 -12
  32. package/dist/prepare-entry-point.js +0 -37
  33. package/dist/validate-image-format.d.ts +0 -2
  34. package/dist/validate-image-format.js +0 -15
  35. package/dist/webpack-cache.d.ts +0 -12
  36. package/dist/webpack-cache.js +0 -66
@@ -1,3 +1,3 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
- export declare const getLogLevel: () => "verbose" | "error" | "info" | "warn";
2
+ export declare const getLogLevel: () => "error" | "verbose" | "info" | "warn";
3
3
  export declare const setLogLevel: (newLogLevel: LogLevel) => void;
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const PlayPause: React.FC<{
3
+ playbackRate: number;
4
+ loop: boolean;
5
+ }>;
@@ -31,7 +31,7 @@ export declare const getCliOptions: (options: {
31
31
  browserExecutable: BrowserExecutable;
32
32
  ffmpegExecutable: import("@remotion/renderer").FfmpegExecutable;
33
33
  ffprobeExecutable: import("@remotion/renderer").FfmpegExecutable;
34
- logLevel: "verbose" | "error" | "info" | "warn";
34
+ logLevel: "error" | "verbose" | "info" | "warn";
35
35
  scale: number;
36
36
  chromiumOptions: ChromiumOptions;
37
37
  overwrite: boolean;
@@ -94,9 +94,8 @@ const getAndValidatePixelFormat = (codec) => {
94
94
  renderer_1.RenderInternals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
95
95
  return pixelFormat;
96
96
  };
97
- const getAndValidateProResProfile = (actualCodec) => {
97
+ const getProResProfile = () => {
98
98
  const proResProfile = config_1.ConfigInternals.getProResProfile();
99
- renderer_1.RenderInternals.validateSelectedCodecAndProResCombination(actualCodec, proResProfile);
100
99
  return proResProfile;
101
100
  };
102
101
  const getAndValidateImageFormat = ({ shouldOutputImageSequence, codec, pixelFormat, }) => {
@@ -135,7 +134,7 @@ const getCliOptions = async (options) => {
135
134
  codec: options.codec,
136
135
  pixelFormat,
137
136
  });
138
- const proResProfile = getAndValidateProResProfile(options.codec);
137
+ const proResProfile = getProResProfile();
139
138
  const browserExecutable = config_1.ConfigInternals.getBrowserExecutable();
140
139
  const ffmpegExecutable = config_1.ConfigInternals.getCustomFfmpegExecutable();
141
140
  const ffprobeExecutable = config_1.ConfigInternals.getCustomFfprobeExecutable();
@@ -44,6 +44,9 @@ const getFinalOutputCodec = ({ cliFlag, configFile, downloadName, outName, }) =>
44
44
  if (cliFlag && derivedOutNameCodec !== cliFlag) {
45
45
  throw new TypeError(`The out name is ${outName} but --codec=${cliFlag} was passed. The out name implies a codec of ${derivedOutNameCodec} which does not align with the --codec flag.`);
46
46
  }
47
+ if (configFile && derivedOutNameCodec !== configFile) {
48
+ throw new TypeError(`The out name is ${outName} but ${configFile} was set as the codec in the config file. The out name implies a codec of ${derivedOutNameCodec} which does not align with the codec set in the config file.`);
49
+ }
47
50
  return {
48
51
  codec: derivedOutNameCodec,
49
52
  reason: 'derived from out name',
@@ -0,0 +1 @@
1
+ export declare const getNetworkAddress: () => string | undefined;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNetworkAddress = void 0;
4
+ const os_1 = require("os");
5
+ const getNetworkAddress = () => {
6
+ for (const interfaceDetails of Object.values((0, os_1.networkInterfaces)())) {
7
+ if (!interfaceDetails)
8
+ continue;
9
+ for (const details of interfaceDetails) {
10
+ const { address, family, internal } = details;
11
+ if (family === 'IPv4' && !internal)
12
+ return address;
13
+ }
14
+ }
15
+ };
16
+ exports.getNetworkAddress = getNetworkAddress;
package/dist/index.d.ts CHANGED
@@ -90,7 +90,7 @@ export declare const CliInternals: {
90
90
  browserExecutable: import("@remotion/renderer").BrowserExecutable;
91
91
  ffmpegExecutable: import("@remotion/renderer").FfmpegExecutable;
92
92
  ffprobeExecutable: import("@remotion/renderer").FfmpegExecutable;
93
- logLevel: "verbose" | "error" | "info" | "warn";
93
+ logLevel: "error" | "verbose" | "info" | "warn";
94
94
  scale: number;
95
95
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
96
96
  overwrite: boolean;
@@ -9,6 +9,7 @@ exports.listOfRemotionPackages = [
9
9
  '@remotion/skia',
10
10
  '@remotion/lottie',
11
11
  '@remotion/media-utils',
12
+ '@remotion/motion-blur',
12
13
  '@remotion/paths',
13
14
  '@remotion/babel-loader',
14
15
  '@remotion/lambda',
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupHooks = void 0;
4
4
  const log_1 = require("../../log");
5
+ const truthy_1 = require("../../truthy");
5
6
  const is_color_supported_1 = require("./is-color-supported");
6
7
  function setupHooks(context) {
7
8
  function invalid() {
@@ -21,13 +22,23 @@ function setupHooks(context) {
21
22
  }
22
23
  logger.log('Compilation finished');
23
24
  const statsOptions = {
24
- preset: 'normal',
25
+ preset: 'errors-warnings',
25
26
  colors: is_color_supported_1.isColorSupported,
26
27
  };
27
28
  const printedStats = stats.toString(statsOptions);
28
- // Avoid extra empty line when `stats: 'none'`
29
- if (printedStats) {
30
- log_1.Log.info(printedStats);
29
+ const lines = printedStats
30
+ .split('\n')
31
+ .map((a) => a.trimEnd())
32
+ .filter(truthy_1.truthy)
33
+ .map((a) => {
34
+ if (a.startsWith('webpack compiled')) {
35
+ return `Built in ${stats.endTime - stats.startTime}ms`;
36
+ }
37
+ return a;
38
+ })
39
+ .join('\n');
40
+ if (lines) {
41
+ log_1.Log.info(lines);
31
42
  }
32
43
  context.callbacks = [];
33
44
  callbacks.forEach((callback) => {
@@ -24,7 +24,7 @@ const webpackHotMiddleware = (compiler) => {
24
24
  compiler.hooks.done.tap('remotion', onDone);
25
25
  function onInvalid() {
26
26
  latestStats = null;
27
- log_1.Log.info('webpack building...');
27
+ log_1.Log.info('Building...');
28
28
  eventStream === null || eventStream === void 0 ? void 0 : eventStream.publish({
29
29
  action: 'building',
30
30
  });
@@ -114,7 +114,6 @@ function publishStats(action, statsResult, eventStream) {
114
114
  if (bundles.length === 1 && !name && statsResult.compilation) {
115
115
  name = statsResult.compilation.name || '';
116
116
  }
117
- log_1.Log.info(`webpack built in ${_stats.time}ms`);
118
117
  eventStream === null || eventStream === void 0 ? void 0 : eventStream.publish({
119
118
  name,
120
119
  action,
package/dist/preview.js CHANGED
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.previewCommand = void 0;
7
7
  const better_opn_1 = __importDefault(require("better-opn"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const chalk_1 = require("./chalk");
9
10
  const config_1 = require("./config");
10
11
  const get_env_1 = require("./get-env");
11
12
  const get_input_props_1 = require("./get-input-props");
13
+ const get_network_address_1 = require("./get-network-address");
12
14
  const log_1 = require("./log");
13
15
  const parse_command_line_1 = require("./parse-command-line");
14
16
  const start_server_1 = require("./preview-server/start-server");
@@ -68,7 +70,13 @@ const previewCommand = async (remotionRoot) => {
68
70
  webpackOverride: config_1.ConfigInternals.getWebpackOverrideFn(),
69
71
  });
70
72
  setLiveEventsListener(liveEventsServer);
71
- log_1.Log.info(`Server running on http://localhost:${port}`);
73
+ const networkAddress = (0, get_network_address_1.getNetworkAddress)();
74
+ if (networkAddress) {
75
+ log_1.Log.info(`Server ready - Local: ${chalk_1.chalk.underline(`http://localhost:${port}`)}, Network: ${chalk_1.chalk.underline(`http://${networkAddress}:${port}`)}`);
76
+ }
77
+ else {
78
+ log_1.Log.info(`Running on http://localhost:${port}`);
79
+ }
72
80
  (0, better_opn_1.default)(`http://localhost:${port}`);
73
81
  await new Promise(noop);
74
82
  };
package/dist/render.js CHANGED
@@ -227,6 +227,13 @@ const render = async (remotionRoot) => {
227
227
  puppeteerInstance,
228
228
  onDownload,
229
229
  downloadMap,
230
+ onSlowestFrames: (slowestFrames) => {
231
+ log_1.Log.verbose();
232
+ log_1.Log.verbose(`Slowest frames:`);
233
+ slowestFrames.forEach(({ frame, time }) => {
234
+ log_1.Log.verbose(`Frame ${frame} (${time.toFixed(3)}ms)`);
235
+ });
236
+ },
230
237
  });
231
238
  log_1.Log.info();
232
239
  log_1.Log.info();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.2.29",
3
+ "version": "3.2.31",
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.29",
27
- "@remotion/media-utils": "3.2.29",
28
- "@remotion/player": "3.2.29",
29
- "@remotion/renderer": "3.2.29",
26
+ "@remotion/bundler": "3.2.31",
27
+ "@remotion/media-utils": "3.2.31",
28
+ "@remotion/player": "3.2.31",
29
+ "@remotion/renderer": "3.2.31",
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.29",
34
+ "remotion": "3.2.31",
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": "9a2ff4d68324af8d1fe55ebdf94bdadccf446a10"
74
+ "gitHead": "f011b454d78903e548c32f548d8fef642c5ff7a6"
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 +0,0 @@
1
- export declare const initializeRenderCli: (remotionRoot: string, type: 'still' | 'sequence' | 'lambda' | 'preview') => Promise<void>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeRenderCli = void 0;
4
- const get_config_file_name_1 = require("./get-config-file-name");
5
- const log_1 = require("./log");
6
- const parse_command_line_1 = require("./parse-command-line");
7
- const initializeRenderCli = async (remotionRoot, type) => {
8
- const appliedName = await (0, get_config_file_name_1.loadConfig)(remotionRoot);
9
- (0, parse_command_line_1.parseCommandLine)(type);
10
- // Only now Log.verbose is available
11
- log_1.Log.verbose('Remotion root directory:', remotionRoot);
12
- if (remotionRoot !== process.cwd()) {
13
- log_1.Log.warn(`Warning: The root directory of your project is ${remotionRoot}, but you are executing this command from ${process.cwd()}. The recommendation is to execute commands from the root directory.`);
14
- }
15
- if (appliedName) {
16
- log_1.Log.verbose(`Applied configuration from ${appliedName}.`);
17
- }
18
- else {
19
- log_1.Log.verbose('No config file loaded.');
20
- }
21
- };
22
- exports.initializeRenderCli = initializeRenderCli;
@@ -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,2 +0,0 @@
1
- import type { ImageFormat } from '@remotion/renderer';
2
- export declare const validateImageFormat: (imageFormat: ImageFormat, outName: string | null) => void;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateImageFormat = void 0;
4
- const log_1 = require("./log");
5
- const validateImageFormat = (imageFormat, outName) => {
6
- if (imageFormat === 'png' && (outName === null || outName === void 0 ? void 0 : outName.endsWith('.png'))) {
7
- log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${outName}`);
8
- }
9
- if (imageFormat === 'jpeg' &&
10
- !(outName === null || outName === void 0 ? void 0 : outName.endsWith('.jpg')) &&
11
- !(outName === null || outName === void 0 ? void 0 : outName.endsWith('.jpeg'))) {
12
- log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${outName}`);
13
- }
14
- };
15
- exports.validateImageFormat = validateImageFormat;
@@ -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;