@remotion/cli 4.0.17 → 4.0.19

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.
@@ -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 Cloud Run 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;
@@ -29,6 +29,7 @@ const react_1 = __importStar(require("react"));
29
29
  const remotion_1 = require("remotion");
30
30
  const event_source_1 = require("../../event-source");
31
31
  const colors_1 = require("../helpers/colors");
32
+ const create_folder_tree_1 = require("../helpers/create-folder-tree");
32
33
  const z_index_1 = require("../state/z-index");
33
34
  const AssetSelectorItem_1 = require("./AssetSelectorItem");
34
35
  const styles_1 = require("./Menu/styles");
@@ -54,9 +55,8 @@ const label = {
54
55
  fontSize: 14,
55
56
  };
56
57
  const list = {
58
+ height: '100%',
57
59
  overflowY: 'auto',
58
- paddingTop: 4,
59
- paddingBottom: 4,
60
60
  };
61
61
  const AssetSelector = () => {
62
62
  const { tabIndex } = (0, z_index_1.useZIndex)();
@@ -66,6 +66,9 @@ const AssetSelector = () => {
66
66
  publicFolderExists: window.remotion_publicFolderExists,
67
67
  };
68
68
  });
69
+ const assetTree = (0, react_1.useMemo)(() => {
70
+ return (0, create_folder_tree_1.buildAssetFolderStructure)(staticFiles);
71
+ }, [staticFiles]);
69
72
  (0, react_1.useEffect)(() => {
70
73
  const onUpdate = () => {
71
74
  setState({
@@ -78,8 +81,6 @@ const AssetSelector = () => {
78
81
  unsub();
79
82
  };
80
83
  }, []);
81
- return ((0, jsx_runtime_1.jsx)("div", { style: container, children: staticFiles.length === 0 ? (publicFolderExists ? ((0, jsx_runtime_1.jsx)("div", { style: emptyState, children: (0, jsx_runtime_1.jsxs)("div", { style: label, children: ["To add assets, place a file in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "public" }), " folder of your project."] }) })) : ((0, jsx_runtime_1.jsx)("div", { style: emptyState, children: (0, jsx_runtime_1.jsxs)("div", { style: label, children: ["To add assets, create a folder called", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "public" }), " in the root of your project and place a file in it."] }) }))) : ((0, jsx_runtime_1.jsx)("div", { className: "__remotion-vertical-scrollbar", style: list, children: staticFiles.map((file) => {
82
- return ((0, jsx_runtime_1.jsx)(AssetSelectorItem_1.AssetSelectorItem, { item: file, tabIndex: tabIndex }, `${file.src}`));
83
- }) })) }));
84
+ return ((0, jsx_runtime_1.jsx)("div", { style: container, children: staticFiles.length === 0 ? (publicFolderExists ? ((0, jsx_runtime_1.jsx)("div", { style: emptyState, children: (0, jsx_runtime_1.jsxs)("div", { style: label, children: ["To add assets, place a file in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "public" }), " folder of your project."] }) })) : ((0, jsx_runtime_1.jsx)("div", { style: emptyState, children: (0, jsx_runtime_1.jsxs)("div", { style: label, children: ["To add assets, create a folder called", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "public" }), " in the root of your project and place a file in it."] }) }))) : ((0, jsx_runtime_1.jsx)("div", { className: "__remotion-vertical-scrollbar", style: list, children: (0, jsx_runtime_1.jsx)(AssetSelectorItem_1.FolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex }) })) }));
84
85
  };
85
86
  exports.AssetSelector = AssetSelector;
@@ -1,6 +1,22 @@
1
1
  import React from 'react';
2
2
  import type { StaticFile } from 'remotion';
3
+ import type { AssetFolder, Structure } from '../helpers/create-folder-tree';
4
+ export declare const AssetFolderItem: React.FC<{
5
+ item: AssetFolder;
6
+ tabIndex: number;
7
+ level: number;
8
+ parentFolder: string;
9
+ }>;
10
+ export declare const FolderTree: React.FC<{
11
+ item: Structure;
12
+ name: string | null;
13
+ parentFolder: string | null;
14
+ level: number;
15
+ tabIndex: number;
16
+ }>;
3
17
  export declare const AssetSelectorItem: React.FC<{
4
- item: StaticFile;
18
+ item: StaticFile | AssetFolder;
5
19
  tabIndex: number;
20
+ level: number;
21
+ parentFolder: string;
6
22
  }>;
@@ -23,9 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.AssetSelectorItem = void 0;
26
+ exports.AssetSelectorItem = exports.FolderTree = exports.AssetFolderItem = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
+ const truthy_1 = require("../../truthy");
29
30
  const colors_1 = require("../helpers/colors");
30
31
  const copy_text_1 = require("../helpers/copy-text");
31
32
  const clipboard_1 = require("../icons/clipboard");
@@ -36,6 +37,11 @@ const layout_1 = require("./layout");
36
37
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
37
38
  const actions_1 = require("./RenderQueue/actions");
38
39
  const ASSET_ITEM_HEIGHT = 32;
40
+ const iconStyle = {
41
+ width: 18,
42
+ height: 18,
43
+ flexShrink: 0,
44
+ };
39
45
  const itemStyle = {
40
46
  paddingRight: 10,
41
47
  paddingTop: 6,
@@ -62,30 +68,66 @@ const labelStyle = {
62
68
  overflow: 'hidden',
63
69
  textOverflow: 'ellipsis',
64
70
  };
65
- const iconStyle = {
66
- width: 18,
67
- height: 18,
68
- flexShrink: 0,
69
- };
70
71
  const revealIconStyle = {
71
72
  height: 12,
72
73
  color: 'currentColor',
73
74
  };
74
- const AssetSelectorItem = ({ item, tabIndex }) => {
75
+ const AssetFolderItem = ({ tabIndex, item, level, parentFolder }) => {
75
76
  const [hovered, setHovered] = (0, react_1.useState)(false);
77
+ const [expanded, setExpanded] = (0, react_1.useState)(false);
76
78
  const onPointerEnter = (0, react_1.useCallback)(() => {
77
79
  setHovered(true);
78
80
  }, []);
79
81
  const onPointerLeave = (0, react_1.useCallback)(() => {
80
82
  setHovered(false);
81
83
  }, []);
82
- const style = (0, react_1.useMemo)(() => {
84
+ const folderStyle = (0, react_1.useMemo)(() => {
83
85
  return {
84
86
  ...itemStyle,
85
- paddingLeft: 12,
87
+ paddingLeft: 4 + level * 8,
88
+ backgroundColor: hovered ? colors_1.CLEAR_HOVER : 'transparent',
89
+ };
90
+ }, [hovered, level]);
91
+ const label = (0, react_1.useMemo)(() => {
92
+ return {
93
+ ...labelStyle,
86
94
  color: colors_1.LIGHT_TEXT,
87
95
  };
88
96
  }, []);
97
+ const onClick = (0, react_1.useCallback)(() => {
98
+ setExpanded((e) => !e);
99
+ }, []);
100
+ const Icon = expanded ? folder_1.ExpandedFolderIcon : folder_1.CollapsedFolderIcon;
101
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, children: (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Icon, { style: iconStyle, color: colors_1.LIGHT_TEXT }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: item.name })] }) }), expanded ? ((0, jsx_runtime_1.jsx)(exports.FolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex }, item.name)) : null] }));
102
+ };
103
+ exports.AssetFolderItem = AssetFolderItem;
104
+ const FolderTree = ({ item, level, name, parentFolder, tabIndex }) => {
105
+ const combinedParents = (0, react_1.useMemo)(() => {
106
+ return [parentFolder, name].filter(truthy_1.truthy).join('/');
107
+ }, [name, parentFolder]);
108
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [item.folders.map((folder) => {
109
+ return ((0, jsx_runtime_1.jsx)(exports.AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents }, folder.name));
110
+ }), item.files.map((file) => {
111
+ return ((0, jsx_runtime_1.jsx)(exports.AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents }, file.src));
112
+ })] }));
113
+ };
114
+ exports.FolderTree = FolderTree;
115
+ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
116
+ const [hovered, setHovered] = (0, react_1.useState)(false);
117
+ const onPointerEnter = (0, react_1.useCallback)(() => {
118
+ setHovered(true);
119
+ }, []);
120
+ const onPointerLeave = (0, react_1.useCallback)(() => {
121
+ setHovered(false);
122
+ }, []);
123
+ const style = (0, react_1.useMemo)(() => {
124
+ return {
125
+ ...itemStyle,
126
+ color: colors_1.LIGHT_TEXT,
127
+ backgroundColor: hovered ? colors_1.CLEAR_HOVER : 'transparent',
128
+ paddingLeft: 12 + level * 8,
129
+ };
130
+ }, [hovered, level]);
89
131
  const label = (0, react_1.useMemo)(() => {
90
132
  return {
91
133
  ...labelStyle,
@@ -93,18 +135,22 @@ const AssetSelectorItem = ({ item, tabIndex }) => {
93
135
  };
94
136
  }, []);
95
137
  const renderFileExplorerAction = (0, react_1.useCallback)((color) => {
96
- return (0, jsx_runtime_1.jsx)(folder_1.ExpandedFolderIconSolid, { style: revealIconStyle, color: color });
138
+ return (0, jsx_runtime_1.jsx)(folder_1.ExpandedFolderIcon, { style: revealIconStyle, color: color });
97
139
  }, []);
98
140
  const renderCopyAction = (0, react_1.useCallback)((color) => {
99
141
  return (0, jsx_runtime_1.jsx)(clipboard_1.ClipboardIcon, { style: revealIconStyle, color: color });
100
142
  }, []);
101
143
  const revealInExplorer = react_1.default.useCallback(() => {
102
144
  (0, actions_1.openInFileExplorer)({
103
- directory: window.remotion_publicFolderExists + '/' + item.name,
145
+ directory: window.remotion_publicFolderExists +
146
+ '/' +
147
+ parentFolder +
148
+ '/' +
149
+ item.name,
104
150
  }).catch((err) => {
105
151
  (0, NotificationCenter_1.sendErrorNotification)(`Could not open file: ${err.message}`);
106
152
  });
107
- }, [item.name]);
153
+ }, [item.name, parentFolder]);
108
154
  const copyToClipboard = (0, react_1.useCallback)(() => {
109
155
  (0, copy_text_1.copyText)(`staticFile("${item.name}")`)
110
156
  .then(() => {
@@ -1,5 +1,14 @@
1
- import type { AnyComposition, TFolder } from 'remotion';
1
+ import type { AnyComposition, StaticFile, TFolder } from 'remotion';
2
2
  import type { CompositionSelectorItemType } from '../components/CompositionSelectorItem';
3
+ export type AssetFolder = {
4
+ name: string;
5
+ items: Structure;
6
+ };
7
+ export type Structure = {
8
+ files: StaticFile[];
9
+ folders: AssetFolder[];
10
+ };
11
+ export declare const buildAssetFolderStructure: (files: StaticFile[]) => Structure;
3
12
  export declare const splitParentIntoNameAndParent: (name: string | null) => {
4
13
  name: string | null;
5
14
  parent: string | null;
@@ -1,7 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFolderTree = exports.splitParentIntoNameAndParent = void 0;
3
+ exports.createFolderTree = exports.splitParentIntoNameAndParent = exports.buildAssetFolderStructure = void 0;
4
4
  const persist_open_folders_1 = require("./persist-open-folders");
5
+ const buildAssetFolderStructure = (files) => {
6
+ const notInFolder = files.filter((f) => !f.name.includes('/'));
7
+ const inFolder = files.filter((f) => f.name.includes('/'));
8
+ const groupedByFolder = {};
9
+ for (const item of inFolder) {
10
+ const folderName = item.name.split('/')[0];
11
+ if (!groupedByFolder[folderName]) {
12
+ groupedByFolder[folderName] = [];
13
+ }
14
+ groupedByFolder[folderName].push(item);
15
+ }
16
+ return {
17
+ files: notInFolder,
18
+ folders: Object.keys(groupedByFolder).map((folderName) => {
19
+ const filesInFolder = groupedByFolder[folderName];
20
+ const filesWithoutFolderName = filesInFolder.map((f) => {
21
+ return {
22
+ ...f,
23
+ name: f.name.substring(folderName.length + 1),
24
+ };
25
+ });
26
+ return {
27
+ name: folderName,
28
+ items: (0, exports.buildAssetFolderStructure)(filesWithoutFolderName),
29
+ expanded: false,
30
+ };
31
+ }),
32
+ };
33
+ };
34
+ exports.buildAssetFolderStructure = buildAssetFolderStructure;
5
35
  const splitParentIntoNameAndParent = (name) => {
6
36
  if (name === null) {
7
37
  return {
@@ -12,7 +12,7 @@ export declare const getCliOptions: (options: {
12
12
  inputProps: Record<string, unknown>;
13
13
  envVariables: Record<string, string>;
14
14
  jpegQuality: number;
15
- browser: import("@remotion/renderer").Browser;
15
+ browser: "chrome";
16
16
  crf: import("@remotion/renderer").Crf | null;
17
17
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
18
18
  proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
@@ -47,7 +47,7 @@ const getProResProfile = () => {
47
47
  const getAndValidateBrowser = async (browserExecutable) => {
48
48
  const browser = getBrowser();
49
49
  try {
50
- await renderer_1.RenderInternals.ensureLocalBrowser(browser, browserExecutable);
50
+ await renderer_1.RenderInternals.ensureLocalBrowser(browserExecutable);
51
51
  }
52
52
  catch (err) {
53
53
  log_1.Log.error('Could not download a browser for rendering frames.');
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare const CliInternals: {
97
97
  inputProps: Record<string, unknown>;
98
98
  envVariables: Record<string, string>;
99
99
  jpegQuality: number;
100
- browser: import("@remotion/renderer").Browser;
100
+ browser: "chrome";
101
101
  crf: import("@remotion/renderer").Crf | null;
102
102
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
103
103
  proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ const minimist_1 = __importDefault(require("minimist"));
23
23
  const benchmark_1 = require("./benchmark");
24
24
  const chalk_1 = require("./chalk");
25
25
  const cleanup_before_quit_1 = require("./cleanup-before-quit");
26
+ const cloudrun_command_1 = require("./cloudrun-command");
26
27
  const compositions_1 = require("./compositions");
27
28
  const config_1 = require("./config");
28
29
  const determine_image_format_1 = require("./determine-image-format");
@@ -77,6 +78,9 @@ const cli = async () => {
77
78
  else if (command === 'lambda') {
78
79
  await (0, lambda_command_1.lambdaCommand)(remotionRoot, args);
79
80
  }
81
+ else if (command === 'cloudrun') {
82
+ await (0, cloudrun_command_1.cloudrunCommand)(remotionRoot, args);
83
+ }
80
84
  else if (command === 'render') {
81
85
  await (0, render_1.render)(remotionRoot, args);
82
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.17",
3
+ "version": "4.0.19",
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.17",
39
- "remotion": "4.0.17",
40
- "@remotion/renderer": "4.0.17",
41
- "@remotion/media-utils": "4.0.17",
42
- "@remotion/player": "4.0.17"
38
+ "@remotion/bundler": "4.0.19",
39
+ "@remotion/media-utils": "4.0.19",
40
+ "@remotion/player": "4.0.19",
41
+ "@remotion/renderer": "4.0.19",
42
+ "remotion": "4.0.19"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
@@ -62,11 +62,10 @@
62
62
  "prettier-plugin-organize-imports": "^3.2.2",
63
63
  "react": "^18.0.0",
64
64
  "react-dom": "^18.0.0",
65
- "typescript": "4.9.5",
66
65
  "vitest": "0.31.1",
67
66
  "zod": "^3.21.4",
68
- "@remotion/zod-types": "4.0.17",
69
- "@remotion/tailwind": "4.0.17"
67
+ "@remotion/zod-types": "4.0.19",
68
+ "@remotion/tailwind": "4.0.19"
70
69
  },
71
70
  "keywords": [
72
71
  "remotion",