@remotion/studio-server 4.0.526 → 4.0.527
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/codemods/apply-codemod-to-file.js +3 -2
- package/dist/codemods/{delete-jsx-node.d.ts → delete-jsx-nodes.d.ts} +1 -10
- package/dist/codemods/delete-jsx-nodes.js +10 -0
- package/dist/codemods/paste-effects.d.ts +15 -1
- package/dist/codemods/paste-effects.js +3 -2
- package/dist/codemods/split-jsx-sequence.d.ts +14 -0
- package/dist/codemods/split-jsx-sequence.js +10 -3
- package/dist/codemods/update-effect-props/update-effect-props.d.ts +36 -1
- package/dist/codemods/update-effect-props/update-effect-props.js +4 -7
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +64 -2
- package/dist/codemods/update-keyframes/update-keyframes.js +5 -6
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +13 -1
- package/dist/codemods/update-sequence-props/update-sequence-props.js +3 -3
- package/dist/helpers/resolve-composition-component.d.ts +1 -1
- package/dist/helpers/resolve-composition-component.js +5 -4
- package/dist/index.d.ts +6 -3
- package/dist/index.js +5 -4
- package/dist/preview-server/api-routes.js +4 -2
- package/dist/preview-server/routes/add-effect.js +3 -2
- package/dist/preview-server/routes/apply-codemod.js +4 -3
- package/dist/preview-server/routes/apply-visual-control-change.js +3 -2
- package/dist/preview-server/routes/can-update-default-props.d.ts +1 -1
- package/dist/preview-server/routes/can-update-default-props.js +3 -4
- package/dist/preview-server/routes/can-update-sequence-props.js +34 -1
- package/dist/preview-server/routes/delete-effect.js +3 -2
- package/dist/preview-server/routes/delete-jsx-nodes.d.ts +3 -0
- package/dist/preview-server/routes/{delete-jsx-node.js → delete-jsx-nodes.js} +10 -10
- package/dist/preview-server/routes/duplicate-effect.js +3 -2
- package/dist/preview-server/routes/duplicate-jsx-node.js +3 -2
- package/dist/preview-server/routes/element-install-plan.d.ts +1 -1
- package/dist/preview-server/routes/find-in-file.d.ts +9 -1
- package/dist/preview-server/routes/find-in-file.js +3 -4
- package/dist/preview-server/routes/insert-basic-captions.d.ts +3 -0
- package/dist/preview-server/routes/insert-basic-captions.js +119 -0
- package/dist/preview-server/routes/reorder-effect.js +3 -2
- package/dist/preview-server/routes/reorder-sequence.js +3 -2
- package/dist/preview-server/routes/save-sequence-props.js +3 -2
- package/dist/preview-server/routes/split-jsx-sequence.js +73 -41
- package/dist/preview-server/routes/split-video-from-audio.js +3 -2
- package/dist/preview-server/routes/update-default-props.js +4 -3
- package/dist/preview-server/undo-stack.d.ts +1 -1
- package/package.json +8 -8
- package/dist/canvas-capture/generate-canvas-capture-composition.d.ts +0 -14
- package/dist/canvas-capture/generate-canvas-capture-composition.js +0 -239
- package/dist/codemods/add-effect.d.ts +0 -1
- package/dist/codemods/add-effect.js +0 -8
- package/dist/codemods/apply-visual-control.d.ts +0 -8
- package/dist/codemods/apply-visual-control.js +0 -89
- package/dist/codemods/delete-effect.d.ts +0 -1
- package/dist/codemods/delete-effect.js +0 -6
- package/dist/codemods/delete-jsx-node.js +0 -17
- package/dist/codemods/duplicate-composition.d.ts +0 -2
- package/dist/codemods/duplicate-composition.js +0 -64
- package/dist/codemods/duplicate-effect.d.ts +0 -1
- package/dist/codemods/duplicate-effect.js +0 -6
- package/dist/codemods/duplicate-jsx-node.d.ts +0 -25
- package/dist/codemods/duplicate-jsx-node.js +0 -26
- package/dist/codemods/format-file-content.d.ts +0 -7
- package/dist/codemods/format-file-content.js +0 -80
- package/dist/codemods/format-inline-content.d.ts +0 -18
- package/dist/codemods/format-inline-content.js +0 -78
- package/dist/codemods/recast-mods.d.ts +0 -13
- package/dist/codemods/recast-mods.js +0 -902
- package/dist/codemods/reorder-effect.d.ts +0 -1
- package/dist/codemods/reorder-effect.js +0 -5
- package/dist/codemods/reorder-sequence.d.ts +0 -1
- package/dist/codemods/reorder-sequence.js +0 -5
- package/dist/codemods/simple-diff.d.ts +0 -5
- package/dist/codemods/simple-diff.js +0 -39
- package/dist/codemods/split-video-from-audio.d.ts +0 -1
- package/dist/codemods/split-video-from-audio.js +0 -5
- package/dist/codemods/update-default-props.d.ts +0 -1
- package/dist/codemods/update-default-props.js +0 -6
- package/dist/codemods/update-inline-caption-patches.d.ts +0 -1
- package/dist/codemods/update-inline-caption-patches.js +0 -5
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +0 -1
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +0 -7
- package/dist/preview-server/routes/delete-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/update-public-license.d.ts +0 -11
- package/dist/preview-server/routes/update-public-license.js +0 -97
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteEffectHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const delete_effect_1 = require("../../codemods/delete-effect");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -11,6 +11,7 @@ const undo_stack_1 = require("../undo-stack");
|
|
|
11
11
|
const formatting_1 = require("./log-updates/formatting");
|
|
12
12
|
const log_update_1 = require("./log-updates/log-update");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { deleteEffects } = codemods_1.CodemodsInternals;
|
|
14
15
|
const getDeletedEffectDescription = (effectLabels) => {
|
|
15
16
|
if (effectLabels.length === 1) {
|
|
16
17
|
return effectLabels[0];
|
|
@@ -38,7 +39,7 @@ const deleteEffectHandler = ({ input: effects, remotionRoot, logLevel }) => {
|
|
|
38
39
|
action: 'modify',
|
|
39
40
|
});
|
|
40
41
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
41
|
-
const { output, formatted, effectLabels, logLines } = await
|
|
42
|
+
const { output, formatted, effectLabels, logLines } = await deleteEffects({
|
|
42
43
|
input: fileContents,
|
|
43
44
|
effects: fileItems.map((item) => item.type === 'single-effect'
|
|
44
45
|
? {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deleteJsxNodesHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const
|
|
6
|
+
const delete_jsx_nodes_1 = require("../../codemods/delete-jsx-nodes");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -17,19 +17,19 @@ const getDeletedNodeDescription = (nodeLabels) => {
|
|
|
17
17
|
}
|
|
18
18
|
return `${nodeLabels.length} JSX nodes`;
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const deleteJsxNodesHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
21
21
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
22
22
|
var _a;
|
|
23
23
|
try {
|
|
24
24
|
(0, hmr_timing_1.logHmrTiming)({
|
|
25
25
|
detail: null,
|
|
26
26
|
logLevel,
|
|
27
|
-
stage: 'delete-jsx-
|
|
27
|
+
stage: 'delete-jsx-nodes-request-start',
|
|
28
28
|
});
|
|
29
29
|
if (nodes.length === 0) {
|
|
30
30
|
throw new Error('No JSX nodes were specified for deletion');
|
|
31
31
|
}
|
|
32
|
-
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[delete-jsx-
|
|
32
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[delete-jsx-nodes] Received request to delete ${nodes.length} JSX node${nodes.length === 1 ? '' : 's'}`);
|
|
33
33
|
const itemsByFileName = new Map();
|
|
34
34
|
for (const item of nodes) {
|
|
35
35
|
const fileItems = (_a = itemsByFileName.get(item.fileName)) !== null && _a !== void 0 ? _a : [];
|
|
@@ -43,7 +43,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
|
43
43
|
action: 'modify',
|
|
44
44
|
});
|
|
45
45
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
46
|
-
const { output, nodeLabels, logLines, nodePathRemappings } = await (0,
|
|
46
|
+
const { output, nodeLabels, logLines, nodePathRemappings } = await (0, delete_jsx_nodes_1.deleteJsxNodes)({
|
|
47
47
|
input: fileContents,
|
|
48
48
|
nodePaths: fileItems.map((item) => item.nodePath),
|
|
49
49
|
});
|
|
@@ -60,7 +60,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
|
60
60
|
(0, hmr_timing_1.logHmrTiming)({
|
|
61
61
|
detail: `files=${updates.length}`,
|
|
62
62
|
logLevel,
|
|
63
|
-
stage: 'delete-jsx-
|
|
63
|
+
stage: 'delete-jsx-nodes-codemod-complete',
|
|
64
64
|
});
|
|
65
65
|
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
|
|
66
66
|
absolutePath: update.absolutePath,
|
|
@@ -79,7 +79,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
|
79
79
|
undoMessage: `↩️ Deletion of ${deletedNodeDescription}`,
|
|
80
80
|
redoMessage: `↪️ Deletion of ${deletedNodeDescription}`,
|
|
81
81
|
},
|
|
82
|
-
entryType: 'delete-jsx-
|
|
82
|
+
entryType: 'delete-jsx-nodes',
|
|
83
83
|
suppressHmrOnFileRestore: false,
|
|
84
84
|
nodePathRemappings: update.nodePathRemappings,
|
|
85
85
|
});
|
|
@@ -106,7 +106,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
|
106
106
|
line: update.logLine,
|
|
107
107
|
});
|
|
108
108
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Deleted ${deletedNodeDescription}`);
|
|
109
|
-
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[delete-jsx-
|
|
109
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[delete-jsx-nodes] Wrote ${update.fileRelativeToRoot}`);
|
|
110
110
|
}
|
|
111
111
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
112
112
|
return {
|
|
@@ -123,4 +123,4 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
exports.
|
|
126
|
+
exports.deleteJsxNodesHandler = deleteJsxNodesHandler;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.duplicateEffectHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const duplicate_effect_1 = require("../../codemods/duplicate-effect");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -11,6 +11,7 @@ const undo_stack_1 = require("../undo-stack");
|
|
|
11
11
|
const formatting_1 = require("./log-updates/formatting");
|
|
12
12
|
const log_update_1 = require("./log-updates/log-update");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { duplicateEffects } = codemods_1.CodemodsInternals;
|
|
14
15
|
const getDuplicatedEffectDescription = (effectLabels) => {
|
|
15
16
|
if (effectLabels.length === 1) {
|
|
16
17
|
return effectLabels[0];
|
|
@@ -38,7 +39,7 @@ const duplicateEffectHandler = ({ input: effects, remotionRoot, logLevel }) => {
|
|
|
38
39
|
action: 'modify',
|
|
39
40
|
});
|
|
40
41
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
41
|
-
const { output, formatted, effectLabels, logLines } = await
|
|
42
|
+
const { output, formatted, effectLabels, logLines } = await duplicateEffects({
|
|
42
43
|
input: fileContents,
|
|
43
44
|
effects: fileItems.map((item) => ({
|
|
44
45
|
sequenceNodePath: item.sequenceNodePath.nodePath,
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.duplicateJsxNodeHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
10
|
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
+
const { duplicateJsxNodes } = codemods_1.CodemodsInternals;
|
|
13
14
|
const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
14
15
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
15
16
|
var _a;
|
|
@@ -31,7 +32,7 @@ const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) =
|
|
|
31
32
|
action: 'modify',
|
|
32
33
|
});
|
|
33
34
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
34
|
-
const { output, nodeLabels, logLines, nodePathRemappings } = await
|
|
35
|
+
const { output, nodeLabels, logLines, nodePathRemappings } = await duplicateJsxNodes({
|
|
35
36
|
input: fileContents,
|
|
36
37
|
nodePaths: fileItems.map((item) => item.nodePath),
|
|
37
38
|
});
|
|
@@ -18,7 +18,7 @@ export declare const getElementInstallPlan: ({ destination, element, installatio
|
|
|
18
18
|
expectedFileState: ElementInstallExpectedFileState;
|
|
19
19
|
filePath: string;
|
|
20
20
|
importPath: string;
|
|
21
|
-
location: import("@remotion/
|
|
21
|
+
location: import("@remotion/codemods").ResolvedCompositionComponentWithFile | null;
|
|
22
22
|
safePaths: {
|
|
23
23
|
compositionFileName: string;
|
|
24
24
|
elementFileName: string;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { FindInFileRequest, FindInFileResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { ApiHandler } from '../api-types';
|
|
3
|
-
export
|
|
3
|
+
export declare const findSearchPosition: ({ contents, lineNumber, columnNumber, search, }: {
|
|
4
|
+
contents: string;
|
|
5
|
+
lineNumber: number;
|
|
6
|
+
columnNumber: number;
|
|
7
|
+
search: string;
|
|
8
|
+
}) => {
|
|
9
|
+
lineNumber: number;
|
|
10
|
+
columnNumber: number;
|
|
11
|
+
};
|
|
4
12
|
export declare const findInFileHandler: ApiHandler<FindInFileRequest, FindInFileResponse>;
|
|
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.findInFileHandler = exports.findSearchPosition = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "findSearchPosition", { enumerable: true, get: function () { return studio_codemods_2.findSearchPosition; } });
|
|
9
|
+
const codemods_1 = require("@remotion/codemods");
|
|
10
|
+
({ findSearchPosition: exports.findSearchPosition } = codemods_1.CodemodsInternals);
|
|
12
11
|
const findInFileHandler = async ({ input, remotionRoot }) => {
|
|
13
12
|
const { fileName, lineNumber, columnNumber, search } = input;
|
|
14
13
|
const contents = await node_fs_1.default.promises.readFile(node_path_1.default.resolve(remotionRoot, fileName), 'utf-8');
|
|
15
|
-
return (0,
|
|
14
|
+
return (0, exports.findSearchPosition)({
|
|
16
15
|
contents,
|
|
17
16
|
lineNumber,
|
|
18
17
|
columnNumber,
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insertBasicCaptionsHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
6
|
+
const renderer_1 = require("@remotion/renderer");
|
|
7
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
+
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
|
+
const undo_stack_1 = require("../undo-stack");
|
|
12
|
+
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
+
const { basicCaptionsElementSource, getBasicCaptionsElementFile, insertBasicCaptions, } = codemods_1.CodemodsInternals;
|
|
14
|
+
const insertBasicCaptionsHandler = ({ input: { fileName, nodePath, captions, durationInFrames }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
try {
|
|
17
|
+
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
18
|
+
remotionRoot,
|
|
19
|
+
fileName,
|
|
20
|
+
action: 'modify',
|
|
21
|
+
});
|
|
22
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
+
const elementFile = getBasicCaptionsElementFile({
|
|
24
|
+
fileName: absolutePath,
|
|
25
|
+
readFileContents: (candidate) => {
|
|
26
|
+
const { absolutePath: elementPath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
27
|
+
remotionRoot,
|
|
28
|
+
fileName: candidate,
|
|
29
|
+
action: 'create',
|
|
30
|
+
});
|
|
31
|
+
let stat;
|
|
32
|
+
try {
|
|
33
|
+
stat = (0, node_fs_1.lstatSync)(elementPath);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error.code === 'ENOENT') {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
if (!stat.isFile()) {
|
|
42
|
+
throw new Error(`Cannot use ${elementPath} for Basic captions`);
|
|
43
|
+
}
|
|
44
|
+
return (0, node_fs_1.readFileSync)(elementPath, 'utf-8');
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const { output, logLine, nodePathRemappings } = insertBasicCaptions({
|
|
48
|
+
input: fileContents,
|
|
49
|
+
nodePath,
|
|
50
|
+
captions,
|
|
51
|
+
durationInFrames,
|
|
52
|
+
importPath: elementFile.importPath,
|
|
53
|
+
});
|
|
54
|
+
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings: nodePathRemappings }], null);
|
|
55
|
+
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
56
|
+
snapshots: [
|
|
57
|
+
...(elementFile.shouldWrite
|
|
58
|
+
? [
|
|
59
|
+
{
|
|
60
|
+
filePath: elementFile.fileName,
|
|
61
|
+
oldContents: null,
|
|
62
|
+
newContents: basicCaptionsElementSource,
|
|
63
|
+
logLine: 1,
|
|
64
|
+
nodePathRemappings: null,
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
: []),
|
|
68
|
+
{
|
|
69
|
+
filePath: absolutePath,
|
|
70
|
+
oldContents: fileContents,
|
|
71
|
+
newContents: output,
|
|
72
|
+
logLine,
|
|
73
|
+
nodePathRemappings,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
logLevel,
|
|
77
|
+
remotionRoot,
|
|
78
|
+
description: {
|
|
79
|
+
undoMessage: '↩️ Insertion of Basic captions',
|
|
80
|
+
redoMessage: '↪️ Insertion of Basic captions',
|
|
81
|
+
},
|
|
82
|
+
entryType: 'insert-basic-captions',
|
|
83
|
+
suppressHmrOnFileRestore: false,
|
|
84
|
+
undoRedoNavigation: null,
|
|
85
|
+
});
|
|
86
|
+
if (elementFile.shouldWrite) {
|
|
87
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(elementFile.fileName);
|
|
88
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
89
|
+
file: elementFile.fileName,
|
|
90
|
+
content: basicCaptionsElementSource,
|
|
91
|
+
originatorClientId: undefined,
|
|
92
|
+
metadata: null,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
96
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
97
|
+
file: absolutePath,
|
|
98
|
+
content: output,
|
|
99
|
+
originatorClientId: undefined,
|
|
100
|
+
metadata: { skipSequencePropsUpdate: true },
|
|
101
|
+
});
|
|
102
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
103
|
+
remotionRoot,
|
|
104
|
+
absolutePath,
|
|
105
|
+
line: logLine,
|
|
106
|
+
});
|
|
107
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(locationLabel)} Inserted Basic captions`);
|
|
108
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
109
|
+
return Promise.resolve({ success: true, nodePathMutation });
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
return Promise.resolve({
|
|
113
|
+
success: false,
|
|
114
|
+
reason: error.message,
|
|
115
|
+
stack: (_a = error.stack) !== null && _a !== void 0 ? _a : '',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
exports.insertBasicCaptionsHandler = insertBasicCaptionsHandler;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reorderEffectHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const reorder_effect_1 = require("../../codemods/reorder-effect");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -11,6 +11,7 @@ const undo_stack_1 = require("../undo-stack");
|
|
|
11
11
|
const formatting_1 = require("./log-updates/formatting");
|
|
12
12
|
const log_update_1 = require("./log-updates/log-update");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { reorderEffect } = codemods_1.CodemodsInternals;
|
|
14
15
|
const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex, toIndex, clientId }, remotionRoot, logLevel, }) => {
|
|
15
16
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
17
|
try {
|
|
@@ -21,7 +22,7 @@ const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex,
|
|
|
21
22
|
action: 'modify',
|
|
22
23
|
});
|
|
23
24
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
-
const { output, formatted, effectLabel, logLine } = await
|
|
25
|
+
const { output, formatted, effectLabel, logLine } = await reorderEffect({
|
|
25
26
|
input: fileContents,
|
|
26
27
|
sequenceNodePath: sequenceNodePath.nodePath,
|
|
27
28
|
fromIndex,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reorderSequenceHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const reorder_sequence_1 = require("../../codemods/reorder-sequence");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -11,6 +11,7 @@ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const formatting_1 = require("./log-updates/formatting");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { reorderSequence } = codemods_1.CodemodsInternals;
|
|
14
15
|
const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodePath, position, clientId }, remotionRoot, logLevel, }) => {
|
|
15
16
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
17
|
try {
|
|
@@ -21,7 +22,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
|
|
|
21
22
|
action: 'modify',
|
|
22
23
|
});
|
|
23
24
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
-
const { output, sequenceLabel, logLine, nodePathRemappings } = await
|
|
25
|
+
const { output, sequenceLabel, logLine, nodePathRemappings } = await reorderSequence({
|
|
25
26
|
input: fileContents,
|
|
26
27
|
sourceNodePath: sourceNodePath.nodePath,
|
|
27
28
|
targetNodePath: targetNodePath.nodePath,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.saveSequencePropsHandler = exports.shouldSuppressHmrForSequencePropEdits = exports.convertSequencePropEditToCodemodChange = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
7
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
-
const update_inline_caption_patches_1 = require("../../codemods/update-inline-caption-patches");
|
|
8
8
|
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
9
9
|
const update_sequence_props_1 = require("../../codemods/update-sequence-props/update-sequence-props");
|
|
10
10
|
const file_watcher_1 = require("../../file-watcher");
|
|
@@ -15,6 +15,7 @@ const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
|
15
15
|
const log_effect_update_1 = require("./log-updates/log-effect-update");
|
|
16
16
|
const log_update_1 = require("./log-updates/log-update");
|
|
17
17
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
18
|
+
const { updateInlineCaptionPatches } = codemods_1.CodemodsInternals;
|
|
18
19
|
const parseSequencePropEditValue = (value) => {
|
|
19
20
|
if (value.type === 'undefined') {
|
|
20
21
|
return undefined;
|
|
@@ -230,7 +231,7 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
for (const captionPatchRequest of group.captionPatches) {
|
|
233
|
-
const result =
|
|
234
|
+
const result = updateInlineCaptionPatches({
|
|
234
235
|
input: output,
|
|
235
236
|
nodePath: captionPatchRequest.nodePath.nodePath,
|
|
236
237
|
patches: captionPatchRequest.patches,
|
|
@@ -10,56 +10,88 @@ const format_log_file_location_1 = require("../format-log-file-location");
|
|
|
10
10
|
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
-
const splitJsxSequenceHandler = ({ input: {
|
|
13
|
+
const splitJsxSequenceHandler = ({ input: { sequences }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
14
|
+
var _a;
|
|
14
15
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
if (sequences.length === 0) {
|
|
17
|
+
throw new Error('No JSX sequences were specified for splitting');
|
|
18
|
+
}
|
|
19
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[split-jsx-sequence] Received request to split ${sequences.length} JSX sequence${sequences.length === 1 ? '' : 's'}`);
|
|
20
|
+
const sequencesByFileName = new Map();
|
|
21
|
+
for (const sequence of sequences) {
|
|
22
|
+
const fileSequences = (_a = sequencesByFileName.get(sequence.fileName)) !== null && _a !== void 0 ? _a : [];
|
|
23
|
+
fileSequences.push(sequence);
|
|
24
|
+
sequencesByFileName.set(sequence.fileName, fileSequences);
|
|
25
|
+
}
|
|
26
|
+
const updates = await Promise.all([...sequencesByFileName].map(async ([fileName, fileSequences]) => {
|
|
27
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
28
|
+
remotionRoot,
|
|
29
|
+
fileName,
|
|
30
|
+
action: 'modify',
|
|
31
|
+
});
|
|
32
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
33
|
+
const { output, nodeLabels, logLines, nodePathRemappings } = await (0, split_jsx_sequence_1.splitJsxSequences)({
|
|
34
|
+
input: fileContents,
|
|
35
|
+
splits: fileSequences.map(({ nodePath, sequenceKeys, splitFrame }) => ({
|
|
36
|
+
nodePath,
|
|
37
|
+
sequenceKeys,
|
|
38
|
+
splitFrame,
|
|
39
|
+
})),
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
30
42
|
absolutePath,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
fileContents,
|
|
44
|
+
fileRelativeToRoot,
|
|
45
|
+
logLine: Math.min(...logLines),
|
|
46
|
+
nodeLabels,
|
|
47
|
+
nodePathRemappings,
|
|
48
|
+
output,
|
|
49
|
+
};
|
|
50
|
+
}));
|
|
51
|
+
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
|
|
52
|
+
absolutePath: update.absolutePath,
|
|
53
|
+
remappings: update.nodePathRemappings,
|
|
54
|
+
})), null);
|
|
55
|
+
const splitDescription = sequences.length === 1
|
|
56
|
+
? updates[0].nodeLabels[0]
|
|
57
|
+
: `${sequences.length} JSX sequences`;
|
|
58
|
+
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
59
|
+
snapshots: updates.map((update) => ({
|
|
60
|
+
filePath: update.absolutePath,
|
|
61
|
+
oldContents: update.fileContents,
|
|
62
|
+
newContents: null,
|
|
63
|
+
logLine: update.logLine,
|
|
64
|
+
nodePathRemappings: update.nodePathRemappings,
|
|
65
|
+
})),
|
|
38
66
|
logLevel,
|
|
39
67
|
remotionRoot,
|
|
40
|
-
logLine,
|
|
41
68
|
description: {
|
|
42
|
-
undoMessage: `↩️ Split of ${
|
|
43
|
-
redoMessage: `↪️ Split of ${
|
|
69
|
+
undoMessage: `↩️ Split of ${splitDescription}`,
|
|
70
|
+
redoMessage: `↪️ Split of ${splitDescription}`,
|
|
44
71
|
},
|
|
45
72
|
entryType: 'split-jsx-sequence',
|
|
46
73
|
suppressHmrOnFileRestore: false,
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
50
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
51
|
-
file: absolutePath,
|
|
52
|
-
content: output,
|
|
53
|
-
originatorClientId: undefined,
|
|
54
|
-
metadata: { skipSequencePropsUpdate: true },
|
|
55
|
-
});
|
|
56
|
-
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
57
|
-
remotionRoot,
|
|
58
|
-
absolutePath,
|
|
59
|
-
line: logLine,
|
|
74
|
+
undoRedoNavigation: null,
|
|
60
75
|
});
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
for (const update of updates) {
|
|
77
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
|
|
78
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
79
|
+
file: update.absolutePath,
|
|
80
|
+
content: update.output,
|
|
81
|
+
originatorClientId: undefined,
|
|
82
|
+
metadata: { skipSequencePropsUpdate: true },
|
|
83
|
+
});
|
|
84
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
85
|
+
remotionRoot,
|
|
86
|
+
absolutePath: update.absolutePath,
|
|
87
|
+
line: update.logLine,
|
|
88
|
+
});
|
|
89
|
+
const fileDescription = update.nodeLabels.length === 1
|
|
90
|
+
? update.nodeLabels[0]
|
|
91
|
+
: `${update.nodeLabels.length} JSX sequences`;
|
|
92
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split ${fileDescription}`);
|
|
93
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[split-jsx-sequence] Wrote ${update.fileRelativeToRoot}`);
|
|
94
|
+
}
|
|
63
95
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
64
96
|
return {
|
|
65
97
|
success: true,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitVideoFromAudioHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const split_video_from_audio_1 = require("../../codemods/split-video-from-audio");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
9
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
@@ -11,6 +11,7 @@ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const log_update_1 = require("./log-updates/log-update");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { splitVideoFromAudio } = codemods_1.CodemodsInternals;
|
|
14
15
|
const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
15
16
|
try {
|
|
16
17
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[split-video-from-audio] Received request for fileName="${fileName}"`);
|
|
@@ -20,7 +21,7 @@ const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoo
|
|
|
20
21
|
action: 'modify',
|
|
21
22
|
});
|
|
22
23
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
-
const { output, formatted, nodeLabel, logLine, nodePathRemappings } = await
|
|
24
|
+
const { output, formatted, nodeLabel, logLine, nodePathRemappings } = await splitVideoFromAudio({
|
|
24
25
|
input: fileContents,
|
|
25
26
|
nodePath,
|
|
26
27
|
});
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateDefaultPropsHandler = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
6
|
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const update_default_props_1 = require("../../codemods/update-default-props");
|
|
7
7
|
const file_watcher_1 = require("../../file-watcher");
|
|
8
8
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
9
9
|
const project_info_1 = require("../project-info");
|
|
@@ -11,6 +11,7 @@ const undo_stack_1 = require("../undo-stack");
|
|
|
11
11
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
12
12
|
const can_update_default_props_1 = require("./can-update-default-props");
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { getCompositionDefaultPropsLine, updateDefaultProps } = codemods_1.CodemodsInternals;
|
|
14
15
|
const updateDefaultPropsHandler = ({ input: { compositionId, defaultProps, enumPaths }, remotionRoot, entryPoint, logLevel, }) => {
|
|
15
16
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
17
|
try {
|
|
@@ -21,11 +22,11 @@ const updateDefaultPropsHandler = ({ input: { compositionId, defaultProps, enumP
|
|
|
21
22
|
}
|
|
22
23
|
(0, can_update_default_props_1.checkIfTypeScriptFile)(projectInfo.rootFile);
|
|
23
24
|
const fileContents = (0, node_fs_1.readFileSync)(projectInfo.rootFile, 'utf-8');
|
|
24
|
-
const logLine =
|
|
25
|
+
const logLine = getCompositionDefaultPropsLine({
|
|
25
26
|
input: fileContents,
|
|
26
27
|
compositionId,
|
|
27
28
|
});
|
|
28
|
-
const { output } =
|
|
29
|
+
const { output } = updateDefaultProps({
|
|
29
30
|
compositionId,
|
|
30
31
|
input: fileContents,
|
|
31
32
|
newDefaultProps: JSON.parse(defaultProps),
|
|
@@ -4,7 +4,7 @@ export interface UndoEntryDescription {
|
|
|
4
4
|
undoMessage: string;
|
|
5
5
|
redoMessage: string;
|
|
6
6
|
}
|
|
7
|
-
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-jsx-
|
|
7
|
+
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-jsx-nodes' | 'duplicate-jsx-node' | 'split-jsx-sequence' | 'split-video-from-audio' | 'insert-basic-captions' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'update-composition-metadata' | 'new-composition' | 'duplicate-composition' | 'move-composition-to-folder' | 'move-composition-or-folder' | 'new-folder' | 'delete-folder' | 'rename-folder';
|
|
8
8
|
type UndoEntrySnapshot = {
|
|
9
9
|
filePath: string;
|
|
10
10
|
oldContents: string | null;
|