@remotion/cli 3.3.19 → 3.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/log.d.ts +1 -1
- package/dist/editor/components/InlineAction.d.ts +1 -1
- package/dist/editor/components/InlineAction.js +3 -1
- package/dist/editor/components/NewComposition/RemInput.d.ts +3 -1
- package/dist/editor/components/RenderModal/RenderModal.js +98 -30
- package/dist/editor/components/RenderQueue/actions.d.ts +4 -2
- package/dist/editor/components/RenderQueue/actions.js +7 -4
- package/dist/editor/helpers/client-id.d.ts +17 -0
- package/dist/editor/helpers/client-id.js +46 -0
- package/dist/editor/helpers/use-file-existence.js +12 -3
- package/dist/event-source-events.d.ts +4 -0
- package/dist/event-source.js +3 -0
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/preview-server/file-existence-watchers.d.ts +5 -2
- package/dist/preview-server/file-existence-watchers.js +23 -7
- package/dist/preview-server/public-folder.d.ts +8 -3
- package/dist/preview-server/public-folder.js +11 -10
- package/dist/preview-server/render-queue/job.d.ts +2 -0
- package/dist/preview-server/render-queue/process-still.d.ts +2 -1
- package/dist/preview-server/render-queue/process-still.js +2 -1
- package/dist/preview-server/render-queue/process-video.d.ts +2 -1
- package/dist/preview-server/render-queue/process-video.js +7 -3
- package/dist/preview-server/render-queue/queue.d.ts +2 -1
- package/dist/preview-server/render-queue/queue.js +22 -3
- package/dist/preview-server/routes/add-render.js +1 -2
- package/dist/preview-server/routes/subscribe-to-file-existence.js +2 -2
- package/dist/preview-server/routes/unsubscribe-from-file-existence.js +5 -1
- package/dist/preview-server/routes.d.ts +2 -2
- package/dist/preview-server/routes.js +6 -5
- package/dist/preview-server/start-server.d.ts +6 -1
- package/dist/preview-server/start-server.js +6 -9
- package/dist/preview.js +29 -2
- package/dist/render-flows/render.d.ts +7 -3
- package/dist/render-flows/render.js +40 -37
- package/dist/render-flows/still.d.ts +2 -1
- package/dist/render-flows/still.js +4 -6
- package/package.json +9 -10
|
@@ -4,10 +4,10 @@ exports.processVideoJob = void 0;
|
|
|
4
4
|
const convert_entry_point_to_serve_url_1 = require("../../convert-entry-point-to-serve-url");
|
|
5
5
|
const get_cli_options_1 = require("../../get-cli-options");
|
|
6
6
|
const render_1 = require("../../render-flows/render");
|
|
7
|
-
const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, }) => {
|
|
7
|
+
const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }) => {
|
|
8
8
|
var _a;
|
|
9
9
|
if (job.type !== 'video') {
|
|
10
|
-
throw new Error('Expected
|
|
10
|
+
throw new Error('Expected video job');
|
|
11
11
|
}
|
|
12
12
|
const { publicDir, browserExecutable, ffmpegExecutable, ffprobeExecutable, chromiumOptions, envVariables, inputProps, port, browser, puppeteerTimeout, } = await (0, get_cli_options_1.getCliOptions)({
|
|
13
13
|
isLambda: false,
|
|
@@ -39,7 +39,7 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, }) =
|
|
|
39
39
|
configFileImageFormat: undefined,
|
|
40
40
|
logLevel: job.verbose ? 'verbose' : 'info',
|
|
41
41
|
onProgress,
|
|
42
|
-
|
|
42
|
+
indent: true,
|
|
43
43
|
// TODO: Make configurable
|
|
44
44
|
concurrency: null,
|
|
45
45
|
// TODO: Make configurable
|
|
@@ -48,6 +48,10 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, }) =
|
|
|
48
48
|
frameRange: null,
|
|
49
49
|
quiet: false,
|
|
50
50
|
shouldOutputImageSequence: false,
|
|
51
|
+
addCleanupCallback,
|
|
52
|
+
outputLocationFromUI: job.outName,
|
|
53
|
+
uiCodec: job.codec,
|
|
54
|
+
uiImageFormat: job.imageFormat,
|
|
51
55
|
});
|
|
52
56
|
// TODO: Allow cancel signal
|
|
53
57
|
// TODO: Accept CLI options
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { JobProgressCallback, RenderJob, RenderJobWithCleanup } from './job';
|
|
2
2
|
export declare const getRenderQueue: () => RenderJob[];
|
|
3
3
|
export declare const notifyClientsOfJobUpdate: () => void;
|
|
4
|
-
export declare const processJob: ({ job, remotionRoot, entryPoint, onProgress, }: {
|
|
4
|
+
export declare const processJob: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }: {
|
|
5
5
|
job: RenderJob;
|
|
6
6
|
remotionRoot: string;
|
|
7
7
|
entryPoint: string;
|
|
8
8
|
onProgress: JobProgressCallback;
|
|
9
|
+
addCleanupCallback: (cb: () => Promise<void>) => void;
|
|
9
10
|
}) => Promise<void>;
|
|
10
11
|
export declare const addJob: ({ job, entryPoint, remotionRoot, }: {
|
|
11
12
|
job: RenderJobWithCleanup;
|
|
@@ -37,13 +37,25 @@ const notifyClientsOfJobUpdate = () => {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
exports.notifyClientsOfJobUpdate = notifyClientsOfJobUpdate;
|
|
40
|
-
const processJob = async ({ job, remotionRoot, entryPoint, onProgress, }) => {
|
|
40
|
+
const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }) => {
|
|
41
41
|
if (job.type === 'still') {
|
|
42
|
-
await (0, process_still_1.processStill)({
|
|
42
|
+
await (0, process_still_1.processStill)({
|
|
43
|
+
job,
|
|
44
|
+
remotionRoot,
|
|
45
|
+
entryPoint,
|
|
46
|
+
onProgress,
|
|
47
|
+
addCleanupCallback,
|
|
48
|
+
});
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
if (job.type === 'video') {
|
|
46
|
-
await (0, process_video_1.processVideoJob)({
|
|
52
|
+
await (0, process_video_1.processVideoJob)({
|
|
53
|
+
job,
|
|
54
|
+
remotionRoot,
|
|
55
|
+
entryPoint,
|
|
56
|
+
onProgress,
|
|
57
|
+
addCleanupCallback,
|
|
58
|
+
});
|
|
47
59
|
return;
|
|
48
60
|
}
|
|
49
61
|
throw new Error(`Unknown job ${JSON.stringify(job)}`);
|
|
@@ -75,6 +87,7 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
|
75
87
|
if (!nextJob) {
|
|
76
88
|
return;
|
|
77
89
|
}
|
|
90
|
+
const jobCleanups = [];
|
|
78
91
|
try {
|
|
79
92
|
updateJob(nextJob.id, (job) => {
|
|
80
93
|
return {
|
|
@@ -100,6 +113,9 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
|
100
113
|
};
|
|
101
114
|
});
|
|
102
115
|
},
|
|
116
|
+
addCleanupCallback: (cleanup) => {
|
|
117
|
+
jobCleanups.push(cleanup);
|
|
118
|
+
},
|
|
103
119
|
});
|
|
104
120
|
log_1.Log.info(chalk_1.chalk.gray('╰─ Done in ' + (Date.now() - startTime) + 'ms.'));
|
|
105
121
|
const { unwatch } = (0, file_watcher_1.installFileWatcher)({
|
|
@@ -146,5 +162,8 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
|
146
162
|
});
|
|
147
163
|
});
|
|
148
164
|
}
|
|
165
|
+
finally {
|
|
166
|
+
await Promise.all(jobCleanups.map((c) => c()));
|
|
167
|
+
}
|
|
149
168
|
};
|
|
150
169
|
exports.processJobIfPossible = processJobIfPossible;
|
|
@@ -10,8 +10,7 @@ const handleAddRender = ({ input, entryPoint, remotionRoot, }) => {
|
|
|
10
10
|
remotionRoot,
|
|
11
11
|
job: {
|
|
12
12
|
cleanup: [],
|
|
13
|
-
|
|
14
|
-
codec: 'h264',
|
|
13
|
+
codec: input.codec,
|
|
15
14
|
compositionId: input.compositionId,
|
|
16
15
|
deletedOutputLocation: false,
|
|
17
16
|
type: 'video',
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribeToFileExistence = void 0;
|
|
4
4
|
const file_existence_watchers_1 = require("../file-existence-watchers");
|
|
5
|
-
const subscribeToFileExistence = ({ input: { file }, remotionRoot }) => {
|
|
6
|
-
// TODO: What if the user reloads the page? The file watcher doesn't get cleared
|
|
5
|
+
const subscribeToFileExistence = ({ input: { file, clientId }, remotionRoot }) => {
|
|
7
6
|
const { exists } = (0, file_existence_watchers_1.subscribeToFileExistenceWatchers)({
|
|
8
7
|
file,
|
|
9
8
|
remotionRoot,
|
|
9
|
+
clientId,
|
|
10
10
|
});
|
|
11
11
|
return Promise.resolve({ exists });
|
|
12
12
|
};
|
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unsubscribeFromFileExistence = void 0;
|
|
4
4
|
const file_existence_watchers_1 = require("../file-existence-watchers");
|
|
5
5
|
const unsubscribeFromFileExistence = ({ input, remotionRoot }) => {
|
|
6
|
-
(0, file_existence_watchers_1.unsubscribeFromFileExistenceWatchers)({
|
|
6
|
+
(0, file_existence_watchers_1.unsubscribeFromFileExistenceWatchers)({
|
|
7
|
+
file: input.file,
|
|
8
|
+
clientId: input.clientId,
|
|
9
|
+
remotionRoot,
|
|
10
|
+
});
|
|
7
11
|
return Promise.resolve(undefined);
|
|
8
12
|
};
|
|
9
13
|
exports.unsubscribeFromFileExistence = unsubscribeFromFileExistence;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
2
|
import type { LiveEventsServer } from './live-events';
|
|
3
|
-
export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot,
|
|
3
|
+
export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, publicDir, }: {
|
|
4
4
|
hash: string;
|
|
5
5
|
hashPrefix: string;
|
|
6
6
|
request: IncomingMessage;
|
|
@@ -9,5 +9,5 @@ export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveE
|
|
|
9
9
|
getCurrentInputProps: () => object;
|
|
10
10
|
getEnvVariables: () => Record<string, string>;
|
|
11
11
|
remotionRoot: string;
|
|
12
|
-
|
|
12
|
+
publicDir: string;
|
|
13
13
|
}) => void | Promise<void>;
|
|
@@ -14,6 +14,7 @@ const get_file_source_1 = require("./error-overlay/react-overlay/utils/get-file-
|
|
|
14
14
|
const open_in_editor_1 = require("./error-overlay/react-overlay/utils/open-in-editor");
|
|
15
15
|
const get_package_manager_1 = require("./get-package-manager");
|
|
16
16
|
const project_info_1 = require("./project-info");
|
|
17
|
+
const public_folder_1 = require("./public-folder");
|
|
17
18
|
const serve_static_1 = require("./serve-static");
|
|
18
19
|
const update_available_1 = require("./update-available");
|
|
19
20
|
const handleUpdate = async (remotionRoot, _, response) => {
|
|
@@ -27,13 +28,14 @@ const static404 = (response) => {
|
|
|
27
28
|
response.writeHead(404);
|
|
28
29
|
response.end('The static/ prefix has been changed, this URL is no longer valid.');
|
|
29
30
|
};
|
|
30
|
-
const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputProps, getEnvVariables, }) => {
|
|
31
|
+
const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputProps, getEnvVariables, publicDir, }) => {
|
|
31
32
|
var _a;
|
|
32
33
|
const [edit] = await editorGuess;
|
|
33
34
|
const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit ? edit.command : null);
|
|
34
35
|
response.setHeader('content-type', 'text/html');
|
|
35
36
|
response.writeHead(200);
|
|
36
37
|
const packageManager = (0, get_package_manager_1.getPackageManager)(remotionRoot, undefined);
|
|
38
|
+
(0, public_folder_1.fetchFolder)({ publicDir, staticHash: hash });
|
|
37
39
|
response.end(bundler_1.BundlerInternals.indexHtml({
|
|
38
40
|
staticHash: hash,
|
|
39
41
|
baseDir: '/',
|
|
@@ -43,6 +45,7 @@ const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputPro
|
|
|
43
45
|
remotionRoot,
|
|
44
46
|
previewServerCommand: packageManager === 'unknown' ? null : packageManager.startCommand,
|
|
45
47
|
numberOfAudioTags: (_a = parse_command_line_1.parsedCli['number-of-shared-audio-tags']) !== null && _a !== void 0 ? _a : (0, number_of_shared_audio_tags_1.getNumberOfSharedAudioTags)(),
|
|
48
|
+
publicFiles: (0, public_folder_1.getFiles)(),
|
|
46
49
|
includeFavicon: true,
|
|
47
50
|
title: 'Remotion Preview',
|
|
48
51
|
}));
|
|
@@ -124,7 +127,7 @@ const handleFavicon = (_, response) => {
|
|
|
124
127
|
const readStream = (0, fs_1.createReadStream)(filePath);
|
|
125
128
|
readStream.pipe(response);
|
|
126
129
|
};
|
|
127
|
-
const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot,
|
|
130
|
+
const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, publicDir, }) => {
|
|
128
131
|
const url = new URL(request.url, 'http://localhost');
|
|
129
132
|
if (url.pathname === '/api/update') {
|
|
130
133
|
return handleUpdate(remotionRoot, request, response);
|
|
@@ -150,9 +153,6 @@ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, g
|
|
|
150
153
|
return liveEventsServer.router(request, response);
|
|
151
154
|
}
|
|
152
155
|
if (url.pathname.startsWith(hash)) {
|
|
153
|
-
const publicDir = userPassedPublicDir
|
|
154
|
-
? path_1.default.resolve(remotionRoot, userPassedPublicDir)
|
|
155
|
-
: path_1.default.join(remotionRoot, 'public');
|
|
156
156
|
return (0, serve_static_1.serveStatic)(publicDir, hash, request, response);
|
|
157
157
|
}
|
|
158
158
|
if (url.pathname.startsWith(hashPrefix)) {
|
|
@@ -164,6 +164,7 @@ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, g
|
|
|
164
164
|
response,
|
|
165
165
|
getCurrentInputProps,
|
|
166
166
|
getEnvVariables,
|
|
167
|
+
publicDir,
|
|
167
168
|
});
|
|
168
169
|
};
|
|
169
170
|
exports.handleRoutes = handleRoutes;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { WebpackOverrideFn } from 'remotion';
|
|
2
2
|
import type { LiveEventsServer } from './live-events';
|
|
3
|
-
export declare const startServer: (
|
|
3
|
+
export declare const startServer: (options: {
|
|
4
|
+
entry: string;
|
|
5
|
+
userDefinedComponent: string;
|
|
4
6
|
webpackOverride: WebpackOverrideFn;
|
|
5
7
|
getCurrentInputProps: () => object;
|
|
6
8
|
getEnvVariables: () => Record<string, string>;
|
|
@@ -8,8 +10,11 @@ export declare const startServer: (entry: string, userDefinedComponent: string,
|
|
|
8
10
|
maxTimelineTracks?: number;
|
|
9
11
|
remotionRoot: string;
|
|
10
12
|
keyboardShortcutsEnabled: boolean;
|
|
13
|
+
publicDir: string;
|
|
11
14
|
userPassedPublicDir: string | null;
|
|
12
15
|
poll: number | null;
|
|
16
|
+
hash: string;
|
|
17
|
+
hashPrefix: string;
|
|
13
18
|
}) => Promise<{
|
|
14
19
|
port: number;
|
|
15
20
|
liveEventsServer: LiveEventsServer;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.startServer = void 0;
|
|
7
7
|
const bundler_1 = require("@remotion/bundler");
|
|
8
8
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
10
9
|
const fs_1 = __importDefault(require("fs"));
|
|
11
10
|
const http_1 = __importDefault(require("http"));
|
|
12
11
|
const os_1 = __importDefault(require("os"));
|
|
@@ -17,12 +16,12 @@ const dev_middleware_1 = require("./dev-middleware");
|
|
|
17
16
|
const hot_middleware_1 = require("./hot-middleware");
|
|
18
17
|
const live_events_1 = require("./live-events");
|
|
19
18
|
const routes_1 = require("./routes");
|
|
20
|
-
const startServer = async (
|
|
19
|
+
const startServer = async (options) => {
|
|
21
20
|
var _a, _b, _c, _d;
|
|
22
21
|
const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
|
|
23
22
|
const [, config] = bundler_1.BundlerInternals.webpackConfig({
|
|
24
|
-
entry,
|
|
25
|
-
userDefinedComponent,
|
|
23
|
+
entry: options.entry,
|
|
24
|
+
userDefinedComponent: options.userDefinedComponent,
|
|
26
25
|
outDir: tmpDir,
|
|
27
26
|
environment: 'development',
|
|
28
27
|
webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : config_1.ConfigInternals.getWebpackOverrideFn(),
|
|
@@ -37,8 +36,6 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
37
36
|
poll: options.poll,
|
|
38
37
|
});
|
|
39
38
|
const compiler = (0, bundler_1.webpack)(config);
|
|
40
|
-
const hashPrefix = '/static-';
|
|
41
|
-
const hash = `${hashPrefix}${crypto_1.default.randomBytes(6).toString('hex')}`;
|
|
42
39
|
const wdmMiddleware = (0, dev_middleware_1.wdm)(compiler);
|
|
43
40
|
const whm = (0, hot_middleware_1.webpackHotMiddleware)(compiler);
|
|
44
41
|
const liveEventsServer = (0, live_events_1.makeLiveEventsRouter)();
|
|
@@ -57,15 +54,15 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
57
54
|
})
|
|
58
55
|
.then(() => {
|
|
59
56
|
return (0, routes_1.handleRoutes)({
|
|
60
|
-
hash,
|
|
61
|
-
hashPrefix,
|
|
57
|
+
hash: options.hash,
|
|
58
|
+
hashPrefix: options.hashPrefix,
|
|
62
59
|
request,
|
|
63
60
|
response,
|
|
64
61
|
liveEventsServer,
|
|
65
62
|
getCurrentInputProps: options.getCurrentInputProps,
|
|
66
63
|
getEnvVariables: options.getEnvVariables,
|
|
67
64
|
remotionRoot: options.remotionRoot,
|
|
68
|
-
|
|
65
|
+
publicDir: options.publicDir,
|
|
69
66
|
});
|
|
70
67
|
})
|
|
71
68
|
.catch((err) => {
|
package/dist/preview.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.previewCommand = void 0;
|
|
7
7
|
const better_opn_1 = __importDefault(require("better-opn"));
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const chalk_1 = require("./chalk");
|
|
10
11
|
const config_1 = require("./config");
|
|
@@ -14,6 +15,8 @@ const get_input_props_1 = require("./get-input-props");
|
|
|
14
15
|
const get_network_address_1 = require("./get-network-address");
|
|
15
16
|
const log_1 = require("./log");
|
|
16
17
|
const parse_command_line_1 = require("./parse-command-line");
|
|
18
|
+
const get_absolute_public_dir_1 = require("./preview-server/get-absolute-public-dir");
|
|
19
|
+
const public_folder_1 = require("./preview-server/public-folder");
|
|
17
20
|
const start_server_1 = require("./preview-server/start-server");
|
|
18
21
|
const noop = () => undefined;
|
|
19
22
|
let liveEventsListener = null;
|
|
@@ -79,16 +82,40 @@ const previewCommand = async (remotionRoot, args) => {
|
|
|
79
82
|
});
|
|
80
83
|
});
|
|
81
84
|
});
|
|
82
|
-
const
|
|
85
|
+
const publicDir = (0, get_absolute_public_dir_1.getAbsolutePublicDir)({
|
|
86
|
+
userPassedPublicDir: config_1.ConfigInternals.getPublicDir(),
|
|
87
|
+
remotionRoot,
|
|
88
|
+
});
|
|
89
|
+
const hashPrefix = '/static-';
|
|
90
|
+
const staticHash = `${hashPrefix}${crypto_1.default.randomBytes(6).toString('hex')}`;
|
|
91
|
+
(0, public_folder_1.initPublicFolderWatch)({
|
|
92
|
+
publicDir,
|
|
93
|
+
remotionRoot,
|
|
94
|
+
onUpdate: () => {
|
|
95
|
+
waitForLiveEventsListener().then((listener) => {
|
|
96
|
+
listener.sendEventToClient({
|
|
97
|
+
type: 'new-public-folder',
|
|
98
|
+
files: (0, public_folder_1.getFiles)(),
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
staticHash,
|
|
103
|
+
});
|
|
104
|
+
const { port, liveEventsServer } = await (0, start_server_1.startServer)({
|
|
105
|
+
entry: path_1.default.resolve(__dirname, 'previewEntry.js'),
|
|
106
|
+
userDefinedComponent: fullPath,
|
|
83
107
|
getCurrentInputProps: () => inputProps,
|
|
84
108
|
getEnvVariables: () => envVariables,
|
|
85
109
|
port: desiredPort,
|
|
86
110
|
maxTimelineTracks: config_1.ConfigInternals.getMaxTimelineTracks(),
|
|
87
111
|
remotionRoot,
|
|
88
112
|
keyboardShortcutsEnabled: config_1.ConfigInternals.getKeyboardShortcutsEnabled(),
|
|
89
|
-
|
|
113
|
+
publicDir,
|
|
90
114
|
webpackOverride: config_1.ConfigInternals.getWebpackOverrideFn(),
|
|
91
115
|
poll: config_1.ConfigInternals.getWebpackPolling(),
|
|
116
|
+
userPassedPublicDir: config_1.ConfigInternals.getPublicDir(),
|
|
117
|
+
hash: staticHash,
|
|
118
|
+
hashPrefix,
|
|
92
119
|
});
|
|
93
120
|
setLiveEventsListener(liveEventsServer);
|
|
94
121
|
const networkAddress = (0, get_network_address_1.getNetworkAddress)();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Browser, BrowserExecutable, ChromiumOptions, FfmpegExecutable, FrameRange, ImageFormat, LogLevel } from '@remotion/renderer';
|
|
1
|
+
import type { Browser, BrowserExecutable, ChromiumOptions, Codec, FfmpegExecutable, FrameRange, ImageFormat, LogLevel } from '@remotion/renderer';
|
|
2
2
|
import type { JobProgressCallback } from '../preview-server/render-queue/job';
|
|
3
|
-
export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable,
|
|
3
|
+
export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, uiCodec, uiImageFormat, }: {
|
|
4
4
|
remotionRoot: string;
|
|
5
5
|
fullEntryPoint: string;
|
|
6
6
|
entryPointReason: string;
|
|
@@ -11,7 +11,7 @@ export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExec
|
|
|
11
11
|
logLevel: LogLevel;
|
|
12
12
|
browser: Browser;
|
|
13
13
|
scale: number;
|
|
14
|
-
|
|
14
|
+
indent: boolean;
|
|
15
15
|
shouldOutputImageSequence: boolean;
|
|
16
16
|
publicDir: string | null;
|
|
17
17
|
inputProps: object;
|
|
@@ -22,6 +22,7 @@ export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExec
|
|
|
22
22
|
width: number | null;
|
|
23
23
|
remainingArgs: string[];
|
|
24
24
|
compositionIdFromUi: string | null;
|
|
25
|
+
outputLocationFromUI: string | null;
|
|
25
26
|
overwrite: boolean;
|
|
26
27
|
quiet: boolean;
|
|
27
28
|
concurrency: number | null;
|
|
@@ -30,4 +31,7 @@ export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExec
|
|
|
30
31
|
configFileImageFormat: ImageFormat | undefined;
|
|
31
32
|
quality: number | undefined;
|
|
32
33
|
onProgress: JobProgressCallback;
|
|
34
|
+
addCleanupCallback: (cb: () => Promise<void>) => void;
|
|
35
|
+
uiCodec: Codec | null;
|
|
36
|
+
uiImageFormat: ImageFormat | null;
|
|
33
37
|
}) => Promise<void>;
|
|
@@ -9,32 +9,37 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const chalk_1 = require("../chalk");
|
|
12
|
+
const config_1 = require("../config");
|
|
12
13
|
const get_cli_options_1 = require("../get-cli-options");
|
|
13
14
|
const get_composition_with_dimension_override_1 = require("../get-composition-with-dimension-override");
|
|
14
15
|
const get_filename_1 = require("../get-filename");
|
|
16
|
+
const get_final_output_codec_1 = require("../get-final-output-codec");
|
|
15
17
|
const get_render_media_options_1 = require("../get-render-media-options");
|
|
16
18
|
const image_formats_1 = require("../image-formats");
|
|
17
19
|
const log_1 = require("../log");
|
|
20
|
+
const parse_command_line_1 = require("../parse-command-line");
|
|
18
21
|
const progress_bar_1 = require("../progress-bar");
|
|
19
22
|
const setup_cache_1 = require("../setup-cache");
|
|
20
23
|
const truthy_1 = require("../truthy");
|
|
21
24
|
const user_passed_output_location_1 = require("../user-passed-output-location");
|
|
22
|
-
const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable,
|
|
25
|
+
const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, uiCodec, uiImageFormat, }) => {
|
|
26
|
+
var _a;
|
|
23
27
|
const downloads = [];
|
|
24
28
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
29
|
+
addCleanupCallback(() => renderer_1.RenderInternals.cleanDownloadMap(downloadMap));
|
|
25
30
|
const ffmpegVersion = await renderer_1.RenderInternals.getFfmpegVersion({
|
|
26
31
|
ffmpegExecutable,
|
|
27
32
|
remotionRoot,
|
|
28
33
|
});
|
|
29
|
-
log_1.Log.verboseAdvanced({ indent
|
|
30
|
-
log_1.Log.verboseAdvanced({ indent
|
|
31
|
-
log_1.Log.verboseAdvanced({ indent
|
|
34
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, 'FFMPEG Version:', ffmpegVersion ? ffmpegVersion.join('.') : 'Built from source');
|
|
35
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, 'Browser executable: ', browserExecutable);
|
|
36
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, 'Asset dirs', downloadMap.assetDir);
|
|
32
37
|
const browserInstance = (0, renderer_1.openBrowser)(browser, {
|
|
33
38
|
browserExecutable,
|
|
34
39
|
shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
35
40
|
chromiumOptions,
|
|
36
41
|
forceDeviceScaleFactor: scale,
|
|
37
|
-
indentationString:
|
|
42
|
+
indentationString: indent ? log_1.INDENT_TOKEN + ' ' : '',
|
|
38
43
|
});
|
|
39
44
|
const steps = [
|
|
40
45
|
renderer_1.RenderInternals.isServeUrl(fullEntryPoint) ? null : 'bundling',
|
|
@@ -48,9 +53,10 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
48
53
|
publicDir,
|
|
49
54
|
// TODO: Implement onProgress
|
|
50
55
|
onProgress: () => undefined,
|
|
51
|
-
indentOutput,
|
|
56
|
+
indentOutput: indent,
|
|
52
57
|
logLevel,
|
|
53
58
|
});
|
|
59
|
+
addCleanupCallback(cleanupBundle);
|
|
54
60
|
const onDownload = (src) => {
|
|
55
61
|
const id = Math.random();
|
|
56
62
|
const download = {
|
|
@@ -70,6 +76,7 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
70
76
|
};
|
|
71
77
|
};
|
|
72
78
|
const puppeteerInstance = await browserInstance;
|
|
79
|
+
addCleanupCallback(() => puppeteerInstance.close(false));
|
|
73
80
|
const comps = await (0, renderer_1.getCompositions)(urlOrBundle, {
|
|
74
81
|
inputProps,
|
|
75
82
|
puppeteerInstance,
|
|
@@ -87,10 +94,12 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
87
94
|
args: remainingArgs,
|
|
88
95
|
compositionIdFromUi,
|
|
89
96
|
});
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
const { codec, reason: codecReason } = (0, get_final_output_codec_1.getFinalOutputCodec)({
|
|
98
|
+
cliFlag: parse_command_line_1.parsedCli.codec,
|
|
99
|
+
configFile: (_a = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _a !== void 0 ? _a : null,
|
|
92
100
|
downloadName: null,
|
|
93
101
|
outName: (0, user_passed_output_location_1.getUserPassedOutputLocation)(argsAfterComposition),
|
|
102
|
+
uiCodec,
|
|
94
103
|
});
|
|
95
104
|
(0, get_cli_options_1.validateFfmepgCanUseCodec)(codec, remotionRoot);
|
|
96
105
|
renderer_1.RenderInternals.validateEvenDimensionsWithCodec({
|
|
@@ -99,20 +108,22 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
99
108
|
codec,
|
|
100
109
|
scale,
|
|
101
110
|
});
|
|
102
|
-
// TODO: Should use output location from UI if explicitly specified
|
|
103
111
|
const relativeOutputLocation = (0, get_filename_1.getOutputFilename)({
|
|
104
112
|
codec,
|
|
105
113
|
imageSequence: shouldOutputImageSequence,
|
|
106
114
|
compositionName: compositionId,
|
|
107
115
|
defaultExtension: renderer_1.RenderInternals.getFileExtensionFromCodec(codec, 'final'),
|
|
108
116
|
args: argsAfterComposition,
|
|
117
|
+
indent,
|
|
118
|
+
fromUi: outputLocationFromUI,
|
|
119
|
+
logLevel,
|
|
109
120
|
});
|
|
110
|
-
log_1.Log.infoAdvanced({ indent
|
|
121
|
+
log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.gray(`Entry point = ${fullEntryPoint} (${entryPointReason}), Composition = ${compositionId} (${reason}), Codec = ${codec} (${codecReason}), Output = ${relativeOutputLocation}`));
|
|
111
122
|
const absoluteOutputFile = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
|
|
112
123
|
const outputDir = shouldOutputImageSequence
|
|
113
124
|
? absoluteOutputFile
|
|
114
125
|
: await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-render'));
|
|
115
|
-
log_1.Log.verboseAdvanced({ indent
|
|
126
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, 'Output dir', outputDir);
|
|
116
127
|
const renderProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
|
|
117
128
|
quiet,
|
|
118
129
|
});
|
|
@@ -150,12 +161,15 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
150
161
|
message: 'Bundled',
|
|
151
162
|
progress: 1,
|
|
152
163
|
},
|
|
153
|
-
},
|
|
164
|
+
}, indent);
|
|
154
165
|
onProgress({ progress, message });
|
|
155
166
|
return renderProgress.update(output);
|
|
156
167
|
};
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
const imageFormat = (0, image_formats_1.getImageFormat)({
|
|
169
|
+
codec: shouldOutputImageSequence ? undefined : codec,
|
|
170
|
+
configFileImageFormat,
|
|
171
|
+
uiImageFormat,
|
|
172
|
+
});
|
|
159
173
|
if (shouldOutputImageSequence) {
|
|
160
174
|
fs_1.default.mkdirSync(absoluteOutputFile, {
|
|
161
175
|
recursive: true,
|
|
@@ -174,10 +188,10 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
174
188
|
onStart: () => undefined,
|
|
175
189
|
onDownload: (src) => {
|
|
176
190
|
if (src.startsWith('data:')) {
|
|
177
|
-
log_1.Log.infoAdvanced({ indent
|
|
191
|
+
log_1.Log.infoAdvanced({ indent, logLevel }, '\nWriting Data URL to file: ', src.substring(0, 30) + '...');
|
|
178
192
|
}
|
|
179
193
|
else {
|
|
180
|
-
log_1.Log.infoAdvanced({ indent
|
|
194
|
+
log_1.Log.infoAdvanced({ indent, logLevel }, '\nDownloading asset... ', src);
|
|
181
195
|
}
|
|
182
196
|
},
|
|
183
197
|
outputDir,
|
|
@@ -199,8 +213,8 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
199
213
|
downloadMap,
|
|
200
214
|
});
|
|
201
215
|
updateRenderProgress();
|
|
202
|
-
log_1.Log.infoAdvanced({ indent
|
|
203
|
-
log_1.Log.infoAdvanced({ indent
|
|
216
|
+
log_1.Log.infoAdvanced({ indent, logLevel });
|
|
217
|
+
log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.cyan(`▶ ${absoluteOutputFile}`));
|
|
204
218
|
}
|
|
205
219
|
const options = await (0, get_render_media_options_1.getRenderMediaOptions)({
|
|
206
220
|
config,
|
|
@@ -223,29 +237,18 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
|
|
|
223
237
|
onDownload,
|
|
224
238
|
downloadMap,
|
|
225
239
|
onSlowestFrames: (slowestFrames) => {
|
|
226
|
-
log_1.Log.verboseAdvanced({ indent
|
|
227
|
-
log_1.Log.verboseAdvanced({ indent
|
|
240
|
+
log_1.Log.verboseAdvanced({ indent, logLevel });
|
|
241
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, `Slowest frames:`);
|
|
228
242
|
slowestFrames.forEach(({ frame, time }) => {
|
|
229
|
-
log_1.Log.verboseAdvanced({ indent
|
|
243
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, `Frame ${frame} (${time.toFixed(3)}ms)`);
|
|
230
244
|
});
|
|
231
245
|
},
|
|
232
|
-
printLog: (...str) => log_1.Log.verboseAdvanced({ indent
|
|
246
|
+
printLog: (...str) => log_1.Log.verboseAdvanced({ indent, logLevel }, ...str),
|
|
233
247
|
});
|
|
234
|
-
log_1.Log.infoAdvanced({ indent
|
|
235
|
-
log_1.Log.infoAdvanced({ indent
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
await renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
|
|
239
|
-
log_1.Log.verboseAdvanced({ indent: indentOutput, logLevel }, 'Cleaned up', downloadMap.assetDir);
|
|
240
|
-
}
|
|
241
|
-
catch (err) {
|
|
242
|
-
log_1.Log.warnAdvanced({ indent: indentOutput, logLevel }, 'Could not clean up directory.');
|
|
243
|
-
log_1.Log.warnAdvanced({ indent: indentOutput, logLevel }, err);
|
|
244
|
-
log_1.Log.warnAdvanced({ indent: indentOutput, logLevel }, 'Do you have minimum required Node.js version?');
|
|
245
|
-
}
|
|
246
|
-
// TODO: This will not indent
|
|
247
|
-
if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose')) {
|
|
248
|
-
renderer_1.RenderInternals.perf.logPerf();
|
|
248
|
+
log_1.Log.infoAdvanced({ indent, logLevel });
|
|
249
|
+
log_1.Log.infoAdvanced({ indent, logLevel }, chalk_1.chalk.cyan(`▶ ${absoluteOutputFile}`));
|
|
250
|
+
for (const line of renderer_1.RenderInternals.perf.getPerf()) {
|
|
251
|
+
log_1.Log.verboseAdvanced({ indent, logLevel }, line);
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
254
|
exports.renderCompFlow = renderCompFlow;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Browser, BrowserExecutable, ChromiumOptions, FfmpegExecutable, ImageFormat, LogLevel, StillImageFormat } from '@remotion/renderer';
|
|
2
2
|
import type { JobProgressCallback } from '../preview-server/render-queue/job';
|
|
3
|
-
export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, ffmpegExecutable, ffprobeExecutable, height, inputProps, overwrite, port, publicDir, puppeteerTimeout, quality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, configFileImageFormat, onProgress, indentOutput, }: {
|
|
3
|
+
export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, ffmpegExecutable, ffprobeExecutable, height, inputProps, overwrite, port, publicDir, puppeteerTimeout, quality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, configFileImageFormat, onProgress, indentOutput, addCleanupCallback, }: {
|
|
4
4
|
remotionRoot: string;
|
|
5
5
|
fullEntryPoint: string;
|
|
6
6
|
entryPointReason: string;
|
|
@@ -27,4 +27,5 @@ export declare const renderStillFlow: ({ remotionRoot, fullEntryPoint, entryPoin
|
|
|
27
27
|
configFileImageFormat: ImageFormat | undefined;
|
|
28
28
|
onProgress: JobProgressCallback;
|
|
29
29
|
indentOutput: boolean;
|
|
30
|
+
addCleanupCallback: (cb: () => Promise<void>) => void;
|
|
30
31
|
}) => Promise<void>;
|
|
@@ -18,7 +18,7 @@ const progress_bar_1 = require("../progress-bar");
|
|
|
18
18
|
const setup_cache_1 = require("../setup-cache");
|
|
19
19
|
const truthy_1 = require("../truthy");
|
|
20
20
|
const user_passed_output_location_1 = require("../user-passed-output-location");
|
|
21
|
-
const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, ffmpegExecutable, ffprobeExecutable, height, inputProps, overwrite, port, publicDir, puppeteerTimeout, quality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, configFileImageFormat, onProgress, indentOutput, }) => {
|
|
21
|
+
const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason, remainingArgs, browser, browserExecutable, chromiumOptions, envVariables, ffmpegExecutable, ffprobeExecutable, height, inputProps, overwrite, port, publicDir, puppeteerTimeout, quality, scale, stillFrame, width, compositionIdFromUi, imageFormatFromUi, logLevel, configFileImageFormat, onProgress, indentOutput, addCleanupCallback, }) => {
|
|
22
22
|
var _a;
|
|
23
23
|
const downloads = [];
|
|
24
24
|
const aggregate = {
|
|
@@ -63,8 +63,11 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
|
|
|
63
63
|
indentOutput,
|
|
64
64
|
logLevel,
|
|
65
65
|
});
|
|
66
|
+
addCleanupCallback(cleanupBundle);
|
|
66
67
|
const puppeteerInstance = await browserInstance;
|
|
68
|
+
addCleanupCallback(() => puppeteerInstance.close(false));
|
|
67
69
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
70
|
+
addCleanupCallback(() => renderer_1.RenderInternals.cleanDownloadMap(downloadMap));
|
|
68
71
|
const comps = await (0, renderer_1.getCompositions)(urlOrBundle, {
|
|
69
72
|
inputProps,
|
|
70
73
|
puppeteerInstance,
|
|
@@ -160,11 +163,6 @@ const renderStillFlow = async ({ remotionRoot, fullEntryPoint, entryPointReason,
|
|
|
160
163
|
};
|
|
161
164
|
updateProgress();
|
|
162
165
|
log_1.Log.infoAdvanced({ indent: indentOutput, logLevel });
|
|
163
|
-
const closeBrowserPromise = puppeteerInstance.close(false);
|
|
164
166
|
log_1.Log.infoAdvanced({ indent: indentOutput, logLevel }, chalk_1.chalk.cyan(`▶️ ${absoluteOutputLocation}`));
|
|
165
|
-
await closeBrowserPromise;
|
|
166
|
-
await renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
|
|
167
|
-
await cleanupBundle();
|
|
168
|
-
log_1.Log.verboseAdvanced({ indent: indentOutput, logLevel }, 'Cleaned up', downloadMap.assetDir);
|
|
169
167
|
};
|
|
170
168
|
exports.renderStillFlow = renderStillFlow;
|