@remotion/cli 3.1.1 → 3.1.4
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/editor/components/PlayPause.js +1 -0
- package/dist/editor/state/render-frame.js +12 -3
- package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.d.ts +7 -3
- package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.js +52 -20
- package/dist/preview-server/routes.js +2 -2
- package/dist/preview-server/start-server.js +1 -1
- package/dist/setup-cache.js +26 -10
- package/dist/upgrade.js +1 -0
- package/dist/versions.js +1 -0
- package/package.json +7 -7
|
@@ -24,6 +24,7 @@ const PlayPause = ({ playbackRate, loop }) => {
|
|
|
24
24
|
player_1.PlayerInternals.usePlayback({
|
|
25
25
|
loop,
|
|
26
26
|
playbackRate,
|
|
27
|
+
moveToBeginningWhenEnded: true,
|
|
27
28
|
});
|
|
28
29
|
const { playing, play, pause, pauseAndReturnToPlayStart, frameBack, seek, frameForward, isLastFrame, } = player_1.PlayerInternals.usePlayer();
|
|
29
30
|
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderFrame = void 0;
|
|
4
4
|
const renderFrame = (frame, fps) => {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const hours = Math.floor(frame / fps / 3600);
|
|
6
|
+
const remainingMinutes = frame - hours * fps * 3600;
|
|
7
|
+
const minutes = Math.floor(remainingMinutes / 60 / fps);
|
|
8
|
+
const remainingSec = frame - hours * fps * 3600 - minutes * fps * 60;
|
|
7
9
|
const seconds = Math.floor(remainingSec / fps);
|
|
8
10
|
const frameAfterSec = Math.round(frame % fps);
|
|
9
|
-
|
|
11
|
+
const hoursStr = String(hours);
|
|
12
|
+
const minutesStr = String(minutes).padStart(2, '0');
|
|
13
|
+
const secondsStr = String(seconds).padStart(2, '0');
|
|
14
|
+
const frameStr = String(frameAfterSec).padStart(2, '0');
|
|
15
|
+
if (hours > 0) {
|
|
16
|
+
return `${hoursStr}:${minutesStr}:${secondsStr}.${frameStr}`;
|
|
17
|
+
}
|
|
18
|
+
return `${minutesStr}:${secondsStr}.${frameStr}`;
|
|
10
19
|
};
|
|
11
20
|
exports.renderFrame = renderFrame;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
declare const editorNames: readonly ["atom", "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta", "brackets", "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl", "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl", "code", "code-insiders", "vscodium", "/Applications/AppCode.app/Contents/MacOS/appcode", "/Applications/CLion.app/Contents/MacOS/clion", "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea", "/Applications/PhpStorm.app/Contents/MacOS/phpstorm", "/Applications/PyCharm.app/Contents/MacOS/pycharm", "/Applications/PyCharm CE.app/Contents/MacOS/pycharm", "/Applications/RubyMine.app/Contents/MacOS/rubymine", "/Applications/WebStorm.app/Contents/MacOS/webstorm", "/Applications/GoLand.app/Contents/MacOS/goland", "/Applications/Rider.app/Contents/MacOS/rider", "mvim", "emacs", "gvim", "idea", "phpstorm", "pycharm", "rubymine", "sublime_text", "vim", "webstorm", "goland", "rider", "Brackets.exe", "Code.exe", "Code - Insiders.exe", "VSCodium.exe", "atom.exe", "sublime_text.exe", "notepad++.exe", "clion.exe", "clion64.exe", "idea.exe", "idea64.exe", "phpstorm.exe", "phpstorm64.exe", "pycharm.exe", "pycharm64.exe", "rubymine.exe", "rubymine64.exe", "webstorm.exe", "webstorm64.exe", "goland.exe", "goland64.exe", "rider.exe", "rider64.exe", "nano"];
|
|
2
|
-
export declare const getDisplayNameForEditor: (editor: Editor |
|
|
2
|
+
export declare const getDisplayNameForEditor: (editor: Editor | null) => string | null;
|
|
3
3
|
declare type Editor = typeof editorNames[number];
|
|
4
|
-
|
|
4
|
+
declare type ProcessAndCommand = {
|
|
5
|
+
process: string;
|
|
6
|
+
command: Editor;
|
|
7
|
+
};
|
|
8
|
+
export declare function guessEditor(): Promise<ProcessAndCommand[]>;
|
|
5
9
|
export declare function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }: {
|
|
6
10
|
fileName: string;
|
|
7
11
|
lineNumber: number;
|
|
8
12
|
colNumber: number;
|
|
9
|
-
editor:
|
|
13
|
+
editor: ProcessAndCommand;
|
|
10
14
|
vsCodeNewWindow: boolean;
|
|
11
15
|
}): Promise<boolean>;
|
|
12
16
|
export {};
|
|
@@ -321,7 +321,10 @@ async function guessEditor() {
|
|
|
321
321
|
for (let i = 0; i < processNames.length; i++) {
|
|
322
322
|
const processName = processNames[i];
|
|
323
323
|
if (output.indexOf(processName) !== -1) {
|
|
324
|
-
availableEditors.push(
|
|
324
|
+
availableEditors.push({
|
|
325
|
+
process: processName,
|
|
326
|
+
command: COMMON_EDITORS_OSX[processName],
|
|
327
|
+
});
|
|
325
328
|
}
|
|
326
329
|
}
|
|
327
330
|
return availableEditors;
|
|
@@ -335,7 +338,10 @@ async function guessEditor() {
|
|
|
335
338
|
const processPath = runningProcesses[i].trim();
|
|
336
339
|
const processName = path_1.default.basename(processPath);
|
|
337
340
|
if (COMMON_EDITORS_WIN.indexOf(processName) !== -1) {
|
|
338
|
-
availableEditors.push(
|
|
341
|
+
availableEditors.push({
|
|
342
|
+
process: processPath,
|
|
343
|
+
command: processPath,
|
|
344
|
+
});
|
|
339
345
|
}
|
|
340
346
|
}
|
|
341
347
|
return availableEditors;
|
|
@@ -349,7 +355,10 @@ async function guessEditor() {
|
|
|
349
355
|
for (let i = 0; i < processNames.length; i++) {
|
|
350
356
|
const processName = processNames[i];
|
|
351
357
|
if (output.indexOf(processName) !== -1) {
|
|
352
|
-
availableEditors.push(
|
|
358
|
+
availableEditors.push({
|
|
359
|
+
process: processName,
|
|
360
|
+
command: COMMON_EDITORS_LINUX[processName],
|
|
361
|
+
});
|
|
353
362
|
}
|
|
354
363
|
}
|
|
355
364
|
return availableEditors;
|
|
@@ -360,32 +369,42 @@ async function guessEditor() {
|
|
|
360
369
|
}
|
|
361
370
|
// Last resort, use old skool env vars
|
|
362
371
|
if (process.env.VISUAL) {
|
|
363
|
-
return [
|
|
372
|
+
return [
|
|
373
|
+
{
|
|
374
|
+
process: process.env.VISUAL,
|
|
375
|
+
command: process.env.VISUAL,
|
|
376
|
+
},
|
|
377
|
+
];
|
|
364
378
|
}
|
|
365
379
|
if (process.env.EDITOR) {
|
|
366
|
-
return [
|
|
380
|
+
return [
|
|
381
|
+
{
|
|
382
|
+
process: process.env.EDITOR,
|
|
383
|
+
command: process.env.EDITOR,
|
|
384
|
+
},
|
|
385
|
+
];
|
|
367
386
|
}
|
|
368
387
|
return [];
|
|
369
388
|
}
|
|
370
389
|
exports.guessEditor = guessEditor;
|
|
371
390
|
let _childProcess = null;
|
|
372
|
-
function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
|
|
391
|
+
async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, }) {
|
|
373
392
|
if (!fs_1.default.existsSync(fileName)) {
|
|
374
|
-
return
|
|
393
|
+
return false;
|
|
375
394
|
}
|
|
376
395
|
// Sanitize lineNumber to prevent malicious use on win32
|
|
377
396
|
// via: https://github.com/nodejs/node/blob/c3bb4b1aa5e907d489619fb43d233c3336bfc03d/lib/child_process.js#L333
|
|
378
397
|
// and it should be a positive integer
|
|
379
398
|
if (!(Number.isInteger(lineNumber) && lineNumber > 0)) {
|
|
380
|
-
return
|
|
399
|
+
return false;
|
|
381
400
|
}
|
|
382
401
|
// colNumber is optional, but should be a positive integer too
|
|
383
402
|
// default is 1
|
|
384
403
|
if (!(Number.isInteger(colNumber) && colNumber > 0)) {
|
|
385
404
|
colNumber = 1;
|
|
386
405
|
}
|
|
387
|
-
if (editor.toLowerCase() === 'none') {
|
|
388
|
-
return
|
|
406
|
+
if (editor.command.toLowerCase() === 'none') {
|
|
407
|
+
return false;
|
|
389
408
|
}
|
|
390
409
|
if (process.platform === 'linux' &&
|
|
391
410
|
fileName.startsWith('/mnt/') &&
|
|
@@ -412,30 +431,43 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
|
|
|
412
431
|
'consist only of alphanumeric characters (all languages), periods, ' +
|
|
413
432
|
'dashes, slashes, and underscores.');
|
|
414
433
|
log_1.Log.error();
|
|
415
|
-
return
|
|
434
|
+
return false;
|
|
416
435
|
}
|
|
417
|
-
const shouldOpenVsCodeNewWindow = isVsCodeDerivative(editor) && vsCodeNewWindow;
|
|
436
|
+
const shouldOpenVsCodeNewWindow = isVsCodeDerivative(editor.command) && vsCodeNewWindow;
|
|
418
437
|
const args = shouldOpenVsCodeNewWindow
|
|
419
438
|
? ['--new-window', fileName]
|
|
420
439
|
: lineNumber
|
|
421
|
-
? getArgumentsForLineNumber(editor, fileName, String(lineNumber), colNumber)
|
|
440
|
+
? getArgumentsForLineNumber(editor.command, fileName, String(lineNumber), colNumber)
|
|
422
441
|
: [fileName];
|
|
423
|
-
if (_childProcess && isTerminalEditor(editor)) {
|
|
442
|
+
if (_childProcess && isTerminalEditor(editor.command)) {
|
|
424
443
|
// There's an existing editor process already and it's attached
|
|
425
444
|
// to the terminal, so go kill it. Otherwise two separate editor
|
|
426
445
|
// instances attach to the stdin/stdout which gets confusing.
|
|
427
446
|
_childProcess.kill('SIGKILL');
|
|
428
447
|
}
|
|
448
|
+
const isWin = os_1.default.platform() === 'win32';
|
|
449
|
+
const where = isWin ? 'where' : 'which';
|
|
450
|
+
const binaryToUse = await new Promise((resolve) => {
|
|
451
|
+
if (editor.command === editor.process) {
|
|
452
|
+
resolve(editor.command);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
child_process_1.default.exec(`${where} "${editor.command}"`, (err) => {
|
|
456
|
+
if (err) {
|
|
457
|
+
resolve(editor.process);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
resolve(editor.command);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
});
|
|
429
464
|
if (process.platform === 'win32') {
|
|
430
465
|
// On Windows, launch the editor in a shell because spawn can only
|
|
431
466
|
// launch .exe files.
|
|
432
|
-
_childProcess = child_process_1.default.spawn('cmd.exe', ['/C',
|
|
467
|
+
_childProcess = child_process_1.default.spawn('cmd.exe', ['/C', binaryToUse].concat(args), { stdio: 'inherit', detached: true });
|
|
433
468
|
}
|
|
434
469
|
else {
|
|
435
|
-
_childProcess = child_process_1.default.spawn(
|
|
436
|
-
stdio: 'inherit',
|
|
437
|
-
detached: true,
|
|
438
|
-
});
|
|
470
|
+
_childProcess = child_process_1.default.spawn(binaryToUse, args, { stdio: 'inherit' });
|
|
439
471
|
}
|
|
440
472
|
_childProcess.on('exit', (errorCode) => {
|
|
441
473
|
_childProcess = null;
|
|
@@ -446,6 +478,6 @@ function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow
|
|
|
446
478
|
_childProcess.on('error', (error) => {
|
|
447
479
|
log_1.Log.error('Error opening file in editor', fileName, error.message);
|
|
448
480
|
});
|
|
449
|
-
return
|
|
481
|
+
return true;
|
|
450
482
|
}
|
|
451
483
|
exports.launchEditor = launchEditor;
|
|
@@ -25,8 +25,8 @@ const static404 = (response) => {
|
|
|
25
25
|
response.end('The static/ prefix has been changed, this URL is no longer valid.');
|
|
26
26
|
};
|
|
27
27
|
const handleFallback = async (hash, _, response, getCurrentInputProps) => {
|
|
28
|
-
const edit = await editorGuess;
|
|
29
|
-
const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit
|
|
28
|
+
const [edit] = await editorGuess;
|
|
29
|
+
const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit ? edit.command : null);
|
|
30
30
|
response.setHeader('content-type', 'text/html');
|
|
31
31
|
response.writeHead(200);
|
|
32
32
|
response.end(bundler_1.BundlerInternals.indexHtml(hash, '/', displayName, getCurrentInputProps()));
|
|
@@ -19,7 +19,7 @@ const routes_1 = require("./routes");
|
|
|
19
19
|
const startServer = async (entry, userDefinedComponent, options) => {
|
|
20
20
|
var _a, _b, _c, _d;
|
|
21
21
|
const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
|
|
22
|
-
const config = bundler_1.BundlerInternals.webpackConfig({
|
|
22
|
+
const [, config] = bundler_1.BundlerInternals.webpackConfig({
|
|
23
23
|
entry,
|
|
24
24
|
userDefinedComponent,
|
|
25
25
|
outDir: tmpDir,
|
package/dist/setup-cache.js
CHANGED
|
@@ -9,10 +9,26 @@ 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
|
|
13
|
-
|
|
12
|
+
const onProgress = (progress) => {
|
|
13
|
+
bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
|
|
14
|
+
progress: progress / 100,
|
|
15
|
+
steps,
|
|
16
|
+
doneIn: null,
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
const options = {
|
|
20
|
+
enableCaching: shouldCache,
|
|
21
|
+
webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
|
|
22
|
+
};
|
|
23
|
+
const [hash] = bundler_1.BundlerInternals.getConfig('', fullPath, onProgress, options);
|
|
24
|
+
const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production', hash);
|
|
25
|
+
if (cacheExistedBefore !== 'does-not-exist' && !shouldCache) {
|
|
14
26
|
log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
|
|
15
|
-
await bundler_1.BundlerInternals.clearCache(
|
|
27
|
+
await bundler_1.BundlerInternals.clearCache();
|
|
28
|
+
}
|
|
29
|
+
if (cacheExistedBefore === 'other-exists' && shouldCache) {
|
|
30
|
+
log_1.Log.info('🧹 Webpack config change detected. Clearing cache... ');
|
|
31
|
+
await bundler_1.BundlerInternals.clearCache();
|
|
16
32
|
}
|
|
17
33
|
const bundleStartTime = Date.now();
|
|
18
34
|
const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
|
|
@@ -22,19 +38,19 @@ const bundleOnCli = async ({ fullPath, steps, }) => {
|
|
|
22
38
|
steps,
|
|
23
39
|
doneIn: null,
|
|
24
40
|
}));
|
|
25
|
-
},
|
|
26
|
-
enableCaching: shouldCache,
|
|
27
|
-
webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
|
|
28
|
-
});
|
|
41
|
+
}, options);
|
|
29
42
|
bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
|
|
30
43
|
progress: 1,
|
|
31
44
|
steps,
|
|
32
45
|
doneIn: Date.now() - bundleStartTime,
|
|
33
46
|
}) + '\n');
|
|
34
47
|
log_1.Log.verbose('Bundled under', bundled);
|
|
35
|
-
const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production');
|
|
36
|
-
if (cacheExistedAfter
|
|
37
|
-
|
|
48
|
+
const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production', hash) === 'exists';
|
|
49
|
+
if (cacheExistedAfter) {
|
|
50
|
+
if (cacheExistedBefore === 'does-not-exist' ||
|
|
51
|
+
cacheExistedBefore === 'other-exists') {
|
|
52
|
+
log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
|
|
53
|
+
}
|
|
38
54
|
}
|
|
39
55
|
return bundled;
|
|
40
56
|
};
|
package/dist/upgrade.js
CHANGED
package/dist/versions.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
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.1.
|
|
27
|
-
"@remotion/media-utils": "3.1.
|
|
28
|
-
"@remotion/player": "3.1.
|
|
29
|
-
"@remotion/renderer": "3.1.
|
|
26
|
+
"@remotion/bundler": "3.1.4",
|
|
27
|
+
"@remotion/media-utils": "3.1.4",
|
|
28
|
+
"@remotion/player": "3.1.4",
|
|
29
|
+
"@remotion/renderer": "3.1.4",
|
|
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.1.
|
|
34
|
+
"remotion": "3.1.4",
|
|
35
35
|
"semver": "7.3.5",
|
|
36
36
|
"source-map": "0.6.1",
|
|
37
37
|
"vitest": "^0.18.0"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "cb662e72c635e5e70c5541d85e276ce2f4075099"
|
|
75
75
|
}
|