@remotion/cli 3.0.24 → 3.0.27
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/chalk/index.d.ts +0 -0
- package/dist/chalk/index.js +0 -0
- package/dist/chalk/symbols.d.ts +0 -0
- package/dist/chalk/symbols.js +0 -0
- package/dist/chalk/utilities.d.ts +0 -0
- package/dist/chalk/utilities.js +0 -0
- package/dist/download-progress.d.ts +1 -0
- package/dist/download-progress.js +17 -5
- package/dist/event-source-events.d.ts +6 -0
- package/dist/event-source-events.js +2 -0
- package/dist/event-source.d.ts +1 -0
- package/dist/event-source.js +14 -0
- package/dist/format-bytes.d.ts +6 -0
- package/dist/format-bytes.js +103 -0
- package/dist/get-cli-options.js +1 -2
- package/dist/get-input-props.d.ts +1 -1
- package/dist/get-input-props.js +10 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -0
- package/dist/preview-server/live-events.d.ts +8 -0
- package/dist/preview-server/live-events.js +37 -0
- package/dist/preview-server/routes.d.ts +4 -1
- package/dist/preview-server/routes.js +7 -4
- package/dist/preview-server/start-server.d.ts +7 -3
- package/dist/preview-server/start-server.js +15 -7
- package/dist/preview.js +28 -3
- package/dist/previewEntry.js +2 -0
- package/dist/progress-bar.d.ts +3 -1
- package/dist/render.js +5 -1
- package/dist/setup-cache.js +3 -3
- package/dist/still.js +2 -0
- package/package.json +7 -7
package/dist/chalk/index.d.ts
CHANGED
|
File without changes
|
package/dist/chalk/index.js
CHANGED
|
File without changes
|
package/dist/chalk/symbols.d.ts
CHANGED
|
File without changes
|
package/dist/chalk/symbols.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/chalk/utilities.js
CHANGED
|
File without changes
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeMultiDownloadProgress = void 0;
|
|
3
|
+
exports.makeMultiDownloadProgress = exports.getFileSizeDownloadBar = void 0;
|
|
4
|
+
const format_bytes_1 = require("./format-bytes");
|
|
4
5
|
const make_progress_bar_1 = require("./make-progress-bar");
|
|
6
|
+
const getFileSizeDownloadBar = (downloaded) => {
|
|
7
|
+
const desiredLength = (0, make_progress_bar_1.makeProgressBar)(0).length;
|
|
8
|
+
return `[${(0, format_bytes_1.formatBytes)(downloaded).padEnd(desiredLength - 2, ' ')}]`;
|
|
9
|
+
};
|
|
10
|
+
exports.getFileSizeDownloadBar = getFileSizeDownloadBar;
|
|
5
11
|
const makeMultiDownloadProgress = (progresses) => {
|
|
6
12
|
if (progresses.length === 0) {
|
|
7
13
|
return null;
|
|
8
14
|
}
|
|
9
15
|
if (progresses.length === 1) {
|
|
10
16
|
const [progress] = progresses;
|
|
11
|
-
const truncatedFileName = progress.name.length >=
|
|
12
|
-
? progress.name.substring(0,
|
|
17
|
+
const truncatedFileName = progress.name.length >= 60
|
|
18
|
+
? progress.name.substring(0, 57) + '...'
|
|
13
19
|
: progress.name;
|
|
14
20
|
return [
|
|
15
21
|
` +`,
|
|
16
|
-
|
|
22
|
+
progress.progress
|
|
23
|
+
? (0, make_progress_bar_1.makeProgressBar)(progress.progress)
|
|
24
|
+
: (0, exports.getFileSizeDownloadBar)(progress.downloaded),
|
|
17
25
|
`Downloading ${truncatedFileName}`,
|
|
18
26
|
].join(' ');
|
|
19
27
|
}
|
|
28
|
+
const everyFileHasContentLength = progresses.every((p) => p.totalBytes !== null);
|
|
20
29
|
return [
|
|
21
30
|
` +`,
|
|
22
|
-
|
|
31
|
+
everyFileHasContentLength
|
|
32
|
+
? (0, make_progress_bar_1.makeProgressBar)(progresses.reduce((a, b) => a + b.progress, 0) /
|
|
33
|
+
progresses.length)
|
|
34
|
+
: (0, exports.getFileSizeDownloadBar)(progresses.reduce((a, b) => a + b.downloaded, 0)),
|
|
23
35
|
`Downloading ${progresses.length} files`,
|
|
24
36
|
].join(' ');
|
|
25
37
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const openEventSource: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openEventSource = void 0;
|
|
4
|
+
let source = null;
|
|
5
|
+
const openEventSource = () => {
|
|
6
|
+
source = new EventSource('/events');
|
|
7
|
+
source.addEventListener('message', (event) => {
|
|
8
|
+
const newEvent = JSON.parse(event.data);
|
|
9
|
+
if (newEvent.type === 'new-input-props') {
|
|
10
|
+
window.location.reload();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.openEventSource = openEventSource;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatBytes = void 0;
|
|
4
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
5
|
+
const BIBYTE_UNITS = [
|
|
6
|
+
'B',
|
|
7
|
+
'kiB',
|
|
8
|
+
'MiB',
|
|
9
|
+
'GiB',
|
|
10
|
+
'TiB',
|
|
11
|
+
'PiB',
|
|
12
|
+
'EiB',
|
|
13
|
+
'ZiB',
|
|
14
|
+
'YiB',
|
|
15
|
+
];
|
|
16
|
+
const BIT_UNITS = [
|
|
17
|
+
'b',
|
|
18
|
+
'kbit',
|
|
19
|
+
'Mbit',
|
|
20
|
+
'Gbit',
|
|
21
|
+
'Tbit',
|
|
22
|
+
'Pbit',
|
|
23
|
+
'Ebit',
|
|
24
|
+
'Zbit',
|
|
25
|
+
'Ybit',
|
|
26
|
+
];
|
|
27
|
+
const BIBIT_UNITS = [
|
|
28
|
+
'b',
|
|
29
|
+
'kibit',
|
|
30
|
+
'Mibit',
|
|
31
|
+
'Gibit',
|
|
32
|
+
'Tibit',
|
|
33
|
+
'Pibit',
|
|
34
|
+
'Eibit',
|
|
35
|
+
'Zibit',
|
|
36
|
+
'Yibit',
|
|
37
|
+
];
|
|
38
|
+
/*
|
|
39
|
+
Formats the given number using `Number#toLocaleString`.
|
|
40
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
41
|
+
- If locale is true, the system default locale is used for translation.
|
|
42
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
43
|
+
*/
|
|
44
|
+
const toLocaleString = (number, locale, options) => {
|
|
45
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
46
|
+
return number.toLocaleString(locale, options);
|
|
47
|
+
}
|
|
48
|
+
if (locale === true || options !== undefined) {
|
|
49
|
+
return number.toLocaleString(undefined, options);
|
|
50
|
+
}
|
|
51
|
+
return String(number);
|
|
52
|
+
};
|
|
53
|
+
const formatBytes = (number, options = {
|
|
54
|
+
locale: 'en-US',
|
|
55
|
+
signed: false,
|
|
56
|
+
maximumFractionDigits: 1,
|
|
57
|
+
}) => {
|
|
58
|
+
if (!Number.isFinite(number)) {
|
|
59
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
60
|
+
}
|
|
61
|
+
options = { bits: false, binary: false, ...options };
|
|
62
|
+
const UNITS = options.bits
|
|
63
|
+
? options.binary
|
|
64
|
+
? BIBIT_UNITS
|
|
65
|
+
: BIT_UNITS
|
|
66
|
+
: options.binary
|
|
67
|
+
? BIBYTE_UNITS
|
|
68
|
+
: BYTE_UNITS;
|
|
69
|
+
if (options.signed && number === 0) {
|
|
70
|
+
return `0 $ {
|
|
71
|
+
UNITS[0]
|
|
72
|
+
}`;
|
|
73
|
+
}
|
|
74
|
+
const isNegative = number < 0;
|
|
75
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
76
|
+
if (isNegative) {
|
|
77
|
+
number = -number;
|
|
78
|
+
}
|
|
79
|
+
let localeOptions;
|
|
80
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
81
|
+
localeOptions = {
|
|
82
|
+
minimumFractionDigits: options.minimumFractionDigits,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
86
|
+
localeOptions = {
|
|
87
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
88
|
+
...localeOptions,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (number < 1) {
|
|
92
|
+
const numString = toLocaleString(number, options.locale, localeOptions);
|
|
93
|
+
return prefix + numString + ' ' + UNITS[0];
|
|
94
|
+
}
|
|
95
|
+
const exponent = Math.min(Math.floor(options.binary
|
|
96
|
+
? Math.log(number) / Math.log(1024)
|
|
97
|
+
: Math.log10(number) / 3), UNITS.length - 1);
|
|
98
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
99
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
100
|
+
const unit = UNITS[exponent];
|
|
101
|
+
return prefix + numberString + ' ' + unit;
|
|
102
|
+
};
|
|
103
|
+
exports.formatBytes = formatBytes;
|
package/dist/get-cli-options.js
CHANGED
|
@@ -31,7 +31,6 @@ const getFinalCodec = async (options) => {
|
|
|
31
31
|
? null
|
|
32
32
|
: renderer_1.RenderInternals.getExtensionOfFilename((0, user_passed_output_location_1.getUserPassedOutputLocation)()),
|
|
33
33
|
emitWarning: true,
|
|
34
|
-
isLambda: options.isLambda,
|
|
35
34
|
});
|
|
36
35
|
const ffmpegExecutable = remotion_1.Internals.getCustomFfmpegExecutable();
|
|
37
36
|
if (codec === 'vp8' &&
|
|
@@ -160,7 +159,7 @@ const getCliOptions = async (options) => {
|
|
|
160
159
|
shouldOutputImageSequence,
|
|
161
160
|
codec,
|
|
162
161
|
overwrite: remotion_1.Internals.getShouldOverwrite(),
|
|
163
|
-
inputProps: (0, get_input_props_1.getInputProps)(),
|
|
162
|
+
inputProps: (0, get_input_props_1.getInputProps)(() => undefined),
|
|
164
163
|
envVariables: await (0, get_env_1.getEnvironmentVariables)(),
|
|
165
164
|
quality: remotion_1.Internals.getQuality(),
|
|
166
165
|
absoluteOutputFile: outputFile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getInputProps: () => object;
|
|
1
|
+
export declare const getInputProps: (onUpdate: (newProps: object) => void) => object;
|
package/dist/get-input-props.js
CHANGED
|
@@ -9,7 +9,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const log_1 = require("./log");
|
|
11
11
|
const parse_command_line_1 = require("./parse-command-line");
|
|
12
|
-
const getInputProps = () => {
|
|
12
|
+
const getInputProps = (onUpdate) => {
|
|
13
13
|
if (!parse_command_line_1.parsedCli.props) {
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
@@ -17,6 +17,15 @@ const getInputProps = () => {
|
|
|
17
17
|
try {
|
|
18
18
|
if (fs_1.default.existsSync(jsonFile)) {
|
|
19
19
|
const rawJsonData = fs_1.default.readFileSync(jsonFile, 'utf-8');
|
|
20
|
+
fs_1.default.watchFile(jsonFile, { interval: 100 }, () => {
|
|
21
|
+
try {
|
|
22
|
+
onUpdate(JSON.parse(fs_1.default.readFileSync(jsonFile, 'utf-8')));
|
|
23
|
+
log_1.Log.info(`Updated input props from ${jsonFile}.`);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
log_1.Log.error(`${jsonFile} contains invalid JSON. Did not apply new input props.`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
20
29
|
return JSON.parse(rawJsonData);
|
|
21
30
|
}
|
|
22
31
|
return JSON.parse(parse_command_line_1.parsedCli.props);
|
package/dist/index.d.ts
CHANGED
|
@@ -101,4 +101,11 @@ export declare const CliInternals: {
|
|
|
101
101
|
quietFlagProvided: () => boolean;
|
|
102
102
|
parsedCli: import("./parse-command-line").CommandLineOptions & import("minimist").ParsedArgs;
|
|
103
103
|
handleCommonError: (err: Error) => Promise<void>;
|
|
104
|
+
formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
|
|
105
|
+
locale: string;
|
|
106
|
+
bits?: boolean | undefined;
|
|
107
|
+
binary?: boolean | undefined;
|
|
108
|
+
signed: boolean;
|
|
109
|
+
}) => string;
|
|
110
|
+
getFileSizeDownloadBar: (downloaded: number) => string;
|
|
104
111
|
};
|
package/dist/index.js
CHANGED
|
@@ -15,9 +15,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.CliInternals = exports.cli = void 0;
|
|
18
|
+
const renderer_1 = require("@remotion/renderer");
|
|
18
19
|
const chalk_1 = require("./chalk");
|
|
19
20
|
const check_version_1 = require("./check-version");
|
|
20
21
|
const compositions_1 = require("./compositions");
|
|
22
|
+
const download_progress_1 = require("./download-progress");
|
|
23
|
+
const format_bytes_1 = require("./format-bytes");
|
|
21
24
|
const get_cli_options_1 = require("./get-cli-options");
|
|
22
25
|
const get_config_file_name_1 = require("./get-config-file-name");
|
|
23
26
|
const handle_common_errors_1 = require("./handle-common-errors");
|
|
@@ -46,6 +49,7 @@ const cli = async () => {
|
|
|
46
49
|
if (command !== versions_1.VERSIONS_COMMAND) {
|
|
47
50
|
await (0, versions_1.validateVersionsBeforeCommand)();
|
|
48
51
|
}
|
|
52
|
+
const errorSymbolicationLock = renderer_1.RenderInternals.registerErrorSymbolicationLock();
|
|
49
53
|
try {
|
|
50
54
|
if (command === 'compositions') {
|
|
51
55
|
await (0, compositions_1.listCompositionsCommand)();
|
|
@@ -83,6 +87,9 @@ const cli = async () => {
|
|
|
83
87
|
await (0, handle_common_errors_1.handleCommonError)(err);
|
|
84
88
|
process.exit(1);
|
|
85
89
|
}
|
|
90
|
+
finally {
|
|
91
|
+
renderer_1.RenderInternals.unlockErrorSymbolicationLock(errorSymbolicationLock);
|
|
92
|
+
}
|
|
86
93
|
};
|
|
87
94
|
exports.cli = cli;
|
|
88
95
|
__exportStar(require("./render"), exports);
|
|
@@ -100,4 +107,6 @@ exports.CliInternals = {
|
|
|
100
107
|
quietFlagProvided: parse_command_line_1.quietFlagProvided,
|
|
101
108
|
parsedCli: parse_command_line_1.parsedCli,
|
|
102
109
|
handleCommonError: handle_common_errors_1.handleCommonError,
|
|
110
|
+
formatBytes: format_bytes_1.formatBytes,
|
|
111
|
+
getFileSizeDownloadBar: download_progress_1.getFileSizeDownloadBar,
|
|
103
112
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
import type { EventSourceEvent } from '../event-source-events';
|
|
4
|
+
export declare type LiveEventsServer = {
|
|
5
|
+
sendEventToClient: (event: EventSourceEvent) => void;
|
|
6
|
+
router: (request: IncomingMessage, response: ServerResponse) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const makeLiveEventsRouter: () => LiveEventsServer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeLiveEventsRouter = void 0;
|
|
4
|
+
const serializeMessage = (message) => {
|
|
5
|
+
return `data: ${JSON.stringify(message)}\n\n`;
|
|
6
|
+
};
|
|
7
|
+
const makeLiveEventsRouter = () => {
|
|
8
|
+
let clients = [];
|
|
9
|
+
const router = (request, response) => {
|
|
10
|
+
const headers = {
|
|
11
|
+
'content-type': 'text/event-stream',
|
|
12
|
+
connection: 'keep-alive',
|
|
13
|
+
'cache-control': 'no-cache',
|
|
14
|
+
};
|
|
15
|
+
response.writeHead(200, headers);
|
|
16
|
+
response.write(serializeMessage({ type: 'init' }));
|
|
17
|
+
const clientId = String(Math.random());
|
|
18
|
+
const newClient = {
|
|
19
|
+
id: clientId,
|
|
20
|
+
response,
|
|
21
|
+
};
|
|
22
|
+
clients.push(newClient);
|
|
23
|
+
request.on('close', () => {
|
|
24
|
+
clients = clients.filter((client) => client.id !== clientId);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const sendEventToClient = (event) => {
|
|
28
|
+
clients.forEach((client) => {
|
|
29
|
+
client.response.write(serializeMessage(event));
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
sendEventToClient,
|
|
34
|
+
router,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.makeLiveEventsRouter = makeLiveEventsRouter;
|
|
@@ -1,7 +1,10 @@
|
|
|
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, }: {
|
|
3
4
|
hash: string;
|
|
4
5
|
hashPrefix: string;
|
|
5
6
|
request: IncomingMessage;
|
|
6
7
|
response: ServerResponse;
|
|
8
|
+
liveEventsServer: LiveEventsServer;
|
|
9
|
+
getCurrentInputProps: () => object;
|
|
7
10
|
}) => void | Promise<void>;
|
|
@@ -24,12 +24,12 @@ const static404 = (response) => {
|
|
|
24
24
|
response.writeHead(404);
|
|
25
25
|
response.end('The static/ prefix has been changed, this URL is no longer valid.');
|
|
26
26
|
};
|
|
27
|
-
const handleFallback = async (hash, _, response) => {
|
|
27
|
+
const handleFallback = async (hash, _, response, getCurrentInputProps) => {
|
|
28
28
|
const edit = await editorGuess;
|
|
29
29
|
const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit[0]);
|
|
30
30
|
response.setHeader('content-type', 'text/html');
|
|
31
31
|
response.writeHead(200);
|
|
32
|
-
response.end(bundler_1.BundlerInternals.indexHtml(hash, '/', displayName));
|
|
32
|
+
response.end(bundler_1.BundlerInternals.indexHtml(hash, '/', displayName, getCurrentInputProps()));
|
|
33
33
|
};
|
|
34
34
|
const handleProjectInfo = async (_, response) => {
|
|
35
35
|
const data = await (0, project_info_1.getProjectInfo)();
|
|
@@ -99,7 +99,7 @@ const handleFavicon = (_, response) => {
|
|
|
99
99
|
const readStream = (0, fs_1.createReadStream)(filePath);
|
|
100
100
|
readStream.pipe(response);
|
|
101
101
|
};
|
|
102
|
-
const handleRoutes = ({ hash, hashPrefix, request, response, }) => {
|
|
102
|
+
const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, }) => {
|
|
103
103
|
const url = new URL(request.url, 'http://localhost');
|
|
104
104
|
if (url.pathname === '/api/update') {
|
|
105
105
|
return handleUpdate(request, response);
|
|
@@ -116,6 +116,9 @@ const handleRoutes = ({ hash, hashPrefix, request, response, }) => {
|
|
|
116
116
|
if (url.pathname === '/remotion.png') {
|
|
117
117
|
return handleFavicon(request, response);
|
|
118
118
|
}
|
|
119
|
+
if (url.pathname === '/events') {
|
|
120
|
+
return liveEventsServer.router(request, response);
|
|
121
|
+
}
|
|
119
122
|
if (url.pathname.startsWith(hash)) {
|
|
120
123
|
const root = path_1.default.join(process.cwd(), 'public');
|
|
121
124
|
return (0, serve_static_1.serveStatic)(root, hash, request, response);
|
|
@@ -123,6 +126,6 @@ const handleRoutes = ({ hash, hashPrefix, request, response, }) => {
|
|
|
123
126
|
if (url.pathname.startsWith(hashPrefix)) {
|
|
124
127
|
return static404(response);
|
|
125
128
|
}
|
|
126
|
-
return handleFallback(hash, request, response);
|
|
129
|
+
return handleFallback(hash, request, response, getCurrentInputProps);
|
|
127
130
|
};
|
|
128
131
|
exports.handleRoutes = handleRoutes;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { WebpackOverrideFn } from 'remotion';
|
|
2
|
-
|
|
2
|
+
import type { LiveEventsServer } from './live-events';
|
|
3
|
+
export declare const startServer: (entry: string, userDefinedComponent: string, options: {
|
|
3
4
|
webpackOverride?: WebpackOverrideFn;
|
|
4
|
-
|
|
5
|
+
getCurrentInputProps: () => object;
|
|
5
6
|
envVariables?: Record<string, string>;
|
|
6
7
|
port: number | null;
|
|
7
8
|
maxTimelineTracks?: number;
|
|
8
|
-
}) => Promise<
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
port: number;
|
|
11
|
+
liveEventsServer: LiveEventsServer;
|
|
12
|
+
}>;
|
|
@@ -14,9 +14,10 @@ const path_1 = __importDefault(require("path"));
|
|
|
14
14
|
const remotion_1 = require("remotion");
|
|
15
15
|
const dev_middleware_1 = require("./dev-middleware");
|
|
16
16
|
const hot_middleware_1 = require("./hot-middleware");
|
|
17
|
+
const live_events_1 = require("./live-events");
|
|
17
18
|
const routes_1 = require("./routes");
|
|
18
19
|
const startServer = async (entry, userDefinedComponent, options) => {
|
|
19
|
-
var _a, _b, _c, _d
|
|
20
|
+
var _a, _b, _c, _d;
|
|
20
21
|
const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
|
|
21
22
|
const config = bundler_1.BundlerInternals.webpackConfig({
|
|
22
23
|
entry,
|
|
@@ -24,9 +25,8 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
24
25
|
outDir: tmpDir,
|
|
25
26
|
environment: 'development',
|
|
26
27
|
webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : remotion_1.Internals.getWebpackOverrideFn(),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
maxTimelineTracks: (_d = options === null || options === void 0 ? void 0 : options.maxTimelineTracks) !== null && _d !== void 0 ? _d : 15,
|
|
28
|
+
envVariables: (_b = options === null || options === void 0 ? void 0 : options.envVariables) !== null && _b !== void 0 ? _b : {},
|
|
29
|
+
maxTimelineTracks: (_c = options === null || options === void 0 ? void 0 : options.maxTimelineTracks) !== null && _c !== void 0 ? _c : 15,
|
|
30
30
|
entryPoints: [
|
|
31
31
|
require.resolve('./hot-middleware/client'),
|
|
32
32
|
require.resolve('./error-overlay/entry-basic.js'),
|
|
@@ -37,6 +37,7 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
37
37
|
const hash = `${hashPrefix}${crypto_1.default.randomBytes(6).toString('hex')}`;
|
|
38
38
|
const wdmMiddleware = (0, dev_middleware_1.wdm)(compiler);
|
|
39
39
|
const whm = (0, hot_middleware_1.webpackHotMiddleware)(compiler);
|
|
40
|
+
const liveEventsServer = (0, live_events_1.makeLiveEventsRouter)();
|
|
40
41
|
const server = http_1.default.createServer((request, response) => {
|
|
41
42
|
new Promise((resolve) => {
|
|
42
43
|
wdmMiddleware(request, response, () => {
|
|
@@ -51,7 +52,14 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
51
52
|
});
|
|
52
53
|
})
|
|
53
54
|
.then(() => {
|
|
54
|
-
(0, routes_1.handleRoutes)({
|
|
55
|
+
(0, routes_1.handleRoutes)({
|
|
56
|
+
hash,
|
|
57
|
+
hashPrefix,
|
|
58
|
+
request,
|
|
59
|
+
response,
|
|
60
|
+
liveEventsServer,
|
|
61
|
+
getCurrentInputProps: options.getCurrentInputProps,
|
|
62
|
+
});
|
|
55
63
|
})
|
|
56
64
|
.catch((err) => {
|
|
57
65
|
response.setHeader('content-type', 'application/json');
|
|
@@ -61,9 +69,9 @@ const startServer = async (entry, userDefinedComponent, options) => {
|
|
|
61
69
|
}));
|
|
62
70
|
});
|
|
63
71
|
});
|
|
64
|
-
const desiredPort = (
|
|
72
|
+
const desiredPort = (_d = options === null || options === void 0 ? void 0 : options.port) !== null && _d !== void 0 ? _d : undefined;
|
|
65
73
|
const port = await renderer_1.RenderInternals.getDesiredPort(desiredPort, 3000, 3100);
|
|
66
74
|
server.listen(port);
|
|
67
|
-
return port;
|
|
75
|
+
return { port, liveEventsServer };
|
|
68
76
|
};
|
|
69
77
|
exports.startServer = startServer;
|
package/dist/preview.js
CHANGED
|
@@ -14,6 +14,22 @@ const log_1 = require("./log");
|
|
|
14
14
|
const parse_command_line_1 = require("./parse-command-line");
|
|
15
15
|
const start_server_1 = require("./preview-server/start-server");
|
|
16
16
|
const noop = () => undefined;
|
|
17
|
+
let liveEventsListener = null;
|
|
18
|
+
const waiters = [];
|
|
19
|
+
const setLiveEventsListener = (listener) => {
|
|
20
|
+
liveEventsListener = listener;
|
|
21
|
+
waiters.forEach((w) => w(listener));
|
|
22
|
+
};
|
|
23
|
+
const waitForLiveEventsListener = () => {
|
|
24
|
+
if (liveEventsListener) {
|
|
25
|
+
return Promise.resolve(liveEventsListener);
|
|
26
|
+
}
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
waiters.push((list) => {
|
|
29
|
+
resolve(list);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
17
33
|
const previewCommand = async () => {
|
|
18
34
|
const file = parse_command_line_1.parsedCli._[1];
|
|
19
35
|
if (!file) {
|
|
@@ -25,14 +41,23 @@ const previewCommand = async () => {
|
|
|
25
41
|
const { port: desiredPort } = parse_command_line_1.parsedCli;
|
|
26
42
|
const fullPath = path_1.default.join(process.cwd(), file);
|
|
27
43
|
await (0, initialize_render_cli_1.initializeRenderCli)('preview');
|
|
28
|
-
|
|
44
|
+
let inputProps = (0, get_input_props_1.getInputProps)((newProps) => {
|
|
45
|
+
waitForLiveEventsListener().then((listener) => {
|
|
46
|
+
inputProps = newProps;
|
|
47
|
+
listener.sendEventToClient({
|
|
48
|
+
type: 'new-input-props',
|
|
49
|
+
newProps,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
29
53
|
const envVariables = await (0, get_env_1.getEnvironmentVariables)();
|
|
30
|
-
const port = await (0, start_server_1.startServer)(path_1.default.resolve(__dirname, 'previewEntry.js'), fullPath, {
|
|
31
|
-
inputProps,
|
|
54
|
+
const { port, liveEventsServer } = await (0, start_server_1.startServer)(path_1.default.resolve(__dirname, 'previewEntry.js'), fullPath, {
|
|
55
|
+
getCurrentInputProps: () => inputProps,
|
|
32
56
|
envVariables,
|
|
33
57
|
port: desiredPort,
|
|
34
58
|
maxTimelineTracks: remotion_1.Internals.getMaxTimelineTracks(),
|
|
35
59
|
});
|
|
60
|
+
setLiveEventsListener(liveEventsServer);
|
|
36
61
|
(0, better_opn_1.default)(`http://localhost:${port}`);
|
|
37
62
|
await new Promise(noop);
|
|
38
63
|
};
|
package/dist/previewEntry.js
CHANGED
|
@@ -8,6 +8,7 @@ const client_1 = __importDefault(require("react-dom/client"));
|
|
|
8
8
|
const remotion_1 = require("remotion");
|
|
9
9
|
require("../styles/styles.css");
|
|
10
10
|
const Editor_1 = require("./editor/components/Editor");
|
|
11
|
+
const event_source_1 = require("./event-source");
|
|
11
12
|
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#1f2428'));
|
|
12
13
|
const content = ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionRoot, { children: (0, jsx_runtime_1.jsx)(Editor_1.Editor, {}) }));
|
|
13
14
|
if (client_1.default.createRoot) {
|
|
@@ -16,3 +17,4 @@ if (client_1.default.createRoot) {
|
|
|
16
17
|
else {
|
|
17
18
|
client_1.default.render((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionRoot, { children: (0, jsx_runtime_1.jsx)(Editor_1.Editor, {}) }), remotion_1.Internals.getPreviewDomElement());
|
|
18
19
|
}
|
|
20
|
+
(0, event_source_1.openEventSource)();
|
package/dist/progress-bar.d.ts
CHANGED
|
@@ -30,7 +30,9 @@ export declare const makeStitchingProgress: ({ frames, totalFrames, steps, doneI
|
|
|
30
30
|
export declare type DownloadProgress = {
|
|
31
31
|
name: string;
|
|
32
32
|
id: number;
|
|
33
|
-
progress: number;
|
|
33
|
+
progress: number | null;
|
|
34
|
+
totalBytes: number | null;
|
|
35
|
+
downloaded: number;
|
|
34
36
|
};
|
|
35
37
|
export declare const makeRenderingAndStitchingProgress: ({ rendering, stitching, downloads, }: {
|
|
36
38
|
rendering: RenderingProgressInput;
|
package/dist/render.js
CHANGED
|
@@ -59,11 +59,15 @@ const render = async () => {
|
|
|
59
59
|
id,
|
|
60
60
|
name: src,
|
|
61
61
|
progress: 0,
|
|
62
|
+
downloaded: 0,
|
|
63
|
+
totalBytes: null,
|
|
62
64
|
};
|
|
63
65
|
downloads.push(download);
|
|
64
66
|
updateRenderProgress();
|
|
65
|
-
return ({ percent }) => {
|
|
67
|
+
return ({ percent, downloaded, totalSize }) => {
|
|
66
68
|
download.progress = percent;
|
|
69
|
+
download.totalBytes = totalSize;
|
|
70
|
+
download.downloaded = downloaded;
|
|
67
71
|
updateRenderProgress();
|
|
68
72
|
};
|
|
69
73
|
};
|
package/dist/setup-cache.js
CHANGED
|
@@ -9,10 +9,10 @@ const progress_bar_1 = require("./progress-bar");
|
|
|
9
9
|
const bundleOnCli = async (fullPath, steps) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const shouldCache = remotion_1.Internals.getWebpackCaching();
|
|
12
|
-
const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production'
|
|
12
|
+
const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production');
|
|
13
13
|
if (cacheExistedBefore && !shouldCache) {
|
|
14
14
|
log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
|
|
15
|
-
await bundler_1.BundlerInternals.clearCache('production'
|
|
15
|
+
await bundler_1.BundlerInternals.clearCache('production');
|
|
16
16
|
}
|
|
17
17
|
const bundleStartTime = Date.now();
|
|
18
18
|
const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
|
|
@@ -32,7 +32,7 @@ const bundleOnCli = async (fullPath, steps) => {
|
|
|
32
32
|
doneIn: Date.now() - bundleStartTime,
|
|
33
33
|
}) + '\n');
|
|
34
34
|
log_1.Log.verbose('Bundled under', bundled);
|
|
35
|
-
const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production'
|
|
35
|
+
const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production');
|
|
36
36
|
if (cacheExistedAfter && !cacheExistedBefore) {
|
|
37
37
|
log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
|
|
38
38
|
}
|
package/dist/still.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.27",
|
|
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.0.
|
|
27
|
-
"@remotion/media-utils": "3.0.
|
|
28
|
-
"@remotion/player": "3.0.
|
|
29
|
-
"@remotion/renderer": "3.0.
|
|
26
|
+
"@remotion/bundler": "3.0.27",
|
|
27
|
+
"@remotion/media-utils": "3.0.27",
|
|
28
|
+
"@remotion/player": "3.0.27",
|
|
29
|
+
"@remotion/renderer": "3.0.27",
|
|
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.0.
|
|
34
|
+
"remotion": "3.0.27",
|
|
35
35
|
"semver": "7.3.5",
|
|
36
36
|
"source-map": "0.6.1"
|
|
37
37
|
},
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "16f54241ee403a938c1af372bebc4ac83a4a24f0"
|
|
77
77
|
}
|