@remotion/studio-server 4.0.525 → 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 +5 -11
- 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 +8 -7
- package/dist/index.js +5 -5
- 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 +7 -34
- 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 +4 -8
- 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 +4 -7
- 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 -7
- package/dist/preview-server/undo-stack.d.ts +1 -1
- package/dist/start-studio.d.ts +1 -0
- package/dist/start-studio.js +1 -1
- package/package.json +9 -9
- 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 -15
- package/dist/codemods/reorder-sequence.js +0 -17
- 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 -12
- package/dist/codemods/split-video-from-audio.js +0 -15
- package/dist/codemods/update-default-props.d.ts +0 -11
- package/dist/codemods/update-default-props.js +0 -16
- 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,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.computeCanUpdateDefaultProps = exports.checkIfTypeScriptFile = exports.computeCanUpdateDefaultPropsFromContent = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
-
const
|
|
5
|
+
const codemods_1 = require("@remotion/codemods");
|
|
6
6
|
const project_info_1 = require("../project-info");
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "computeCanUpdateDefaultPropsFromContent", { enumerable: true, get: function () { return studio_codemods_2.computeCanUpdateDefaultPropsFromContent; } });
|
|
7
|
+
({ computeCanUpdateDefaultPropsFromContent: exports.computeCanUpdateDefaultPropsFromContent } = codemods_1.CodemodsInternals);
|
|
9
8
|
const checkIfTypeScriptFile = (file) => {
|
|
10
9
|
if (!file.endsWith('.tsx') &&
|
|
11
10
|
!file.endsWith('.ts') &&
|
|
@@ -23,7 +22,7 @@ const computeCanUpdateDefaultProps = async ({ compositionId, remotionRoot, entry
|
|
|
23
22
|
}
|
|
24
23
|
(0, exports.checkIfTypeScriptFile)(projectInfo.rootFile);
|
|
25
24
|
const input = (0, node_fs_1.readFileSync)(projectInfo.rootFile, 'utf-8');
|
|
26
|
-
const result = (0,
|
|
25
|
+
const result = (0, exports.computeCanUpdateDefaultPropsFromContent)(input, compositionId);
|
|
27
26
|
return {
|
|
28
27
|
result,
|
|
29
28
|
rootFile: projectInfo.rootFile,
|
|
@@ -257,6 +257,22 @@ const getInterpolateOutputOption = (node) => {
|
|
|
257
257
|
}
|
|
258
258
|
return null;
|
|
259
259
|
};
|
|
260
|
+
const getInterpolateOutputType = (node) => {
|
|
261
|
+
if (node.type === 'StringLiteral') {
|
|
262
|
+
if (node.value === 'font-weight' ||
|
|
263
|
+
node.value === 'scale' ||
|
|
264
|
+
node.value === 'translate' ||
|
|
265
|
+
node.value === 'rotate' ||
|
|
266
|
+
node.value === 'transform-origin') {
|
|
267
|
+
return node.value;
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
if (node.type === 'TSAsExpression') {
|
|
272
|
+
return getInterpolateOutputType(node.expression);
|
|
273
|
+
}
|
|
274
|
+
return null;
|
|
275
|
+
};
|
|
260
276
|
const getKeyframeEasing = (node) => (0, parse_keyframe_easing_expression_1.parseKeyframeEasingExpression)(node);
|
|
261
277
|
const getKeyframeEasingArray = ({ easingNode, segments, }) => {
|
|
262
278
|
if (segments === 0) {
|
|
@@ -376,6 +392,13 @@ const getInterpolationMetadata = (interpolationFunction, callExpression, keyfram
|
|
|
376
392
|
output = parsedOutput;
|
|
377
393
|
continue;
|
|
378
394
|
}
|
|
395
|
+
if (key === 'outputType') {
|
|
396
|
+
if (interpolationFunction === 'interpolateColors' ||
|
|
397
|
+
getInterpolateOutputType(value) === null) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
379
402
|
return null;
|
|
380
403
|
}
|
|
381
404
|
return {
|
|
@@ -1279,7 +1302,7 @@ const computeSequenceOnlyPropsRecord = ({ jsxElement, jsxElementNode, ast, keys,
|
|
|
1279
1302
|
}
|
|
1280
1303
|
const dotIndex = key.indexOf('.');
|
|
1281
1304
|
if (dotIndex !== -1) {
|
|
1282
|
-
|
|
1305
|
+
const status = getNestedPropStatus({
|
|
1283
1306
|
jsxElement,
|
|
1284
1307
|
ast,
|
|
1285
1308
|
parentKey: key.slice(0, dotIndex),
|
|
@@ -1288,6 +1311,16 @@ const computeSequenceOnlyPropsRecord = ({ jsxElement, jsxElementNode, ast, keys,
|
|
|
1288
1311
|
allowSpecialValues: assetKeys.includes(key),
|
|
1289
1312
|
lastSpreadIndex,
|
|
1290
1313
|
});
|
|
1314
|
+
filteredProps[key] =
|
|
1315
|
+
key === 'style.translate' &&
|
|
1316
|
+
((status.status === 'static' &&
|
|
1317
|
+
typeof status.codeValue === 'string' &&
|
|
1318
|
+
status.codeValue.includes('%')) ||
|
|
1319
|
+
(status.status === 'keyframed' &&
|
|
1320
|
+
status.keyframes.some((keyframe) => typeof keyframe.value === 'string' &&
|
|
1321
|
+
keyframe.value.includes('%'))))
|
|
1322
|
+
? computedStatus()
|
|
1323
|
+
: status;
|
|
1291
1324
|
}
|
|
1292
1325
|
else if (key in allProps) {
|
|
1293
1326
|
filteredProps[key] = allProps[key];
|
|
@@ -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,15 +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 duplicate_jsx_node_1 = require("../../codemods/duplicate-jsx-node");
|
|
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
|
-
const log_update_1 = require("./log-updates/log-update");
|
|
13
12
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
+
const { duplicateJsxNodes } = codemods_1.CodemodsInternals;
|
|
14
14
|
const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
|
|
15
15
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
16
|
var _a;
|
|
@@ -32,7 +32,7 @@ const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) =
|
|
|
32
32
|
action: 'modify',
|
|
33
33
|
});
|
|
34
34
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
35
|
-
const { output,
|
|
35
|
+
const { output, nodeLabels, logLines, nodePathRemappings } = await duplicateJsxNodes({
|
|
36
36
|
input: fileContents,
|
|
37
37
|
nodePaths: fileItems.map((item) => item.nodePath),
|
|
38
38
|
});
|
|
@@ -40,7 +40,6 @@ const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) =
|
|
|
40
40
|
absolutePath,
|
|
41
41
|
fileRelativeToRoot,
|
|
42
42
|
fileContents,
|
|
43
|
-
formatted,
|
|
44
43
|
logLine: Math.min(...logLines),
|
|
45
44
|
nodeLabels,
|
|
46
45
|
nodePathRemappings,
|
|
@@ -89,10 +88,7 @@ const duplicateJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) =
|
|
|
89
88
|
? update.nodeLabels[0]
|
|
90
89
|
: `${update.nodeLabels.length} JSX nodes`;
|
|
91
90
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Duplicated ${fileDescription}`);
|
|
92
|
-
|
|
93
|
-
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
94
|
-
}
|
|
95
|
-
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[duplicate-jsx-node] Wrote ${update.fileRelativeToRoot}${update.formatted ? ' (formatted)' : ''}`);
|
|
91
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[duplicate-jsx-node] Wrote ${update.fileRelativeToRoot}`);
|
|
96
92
|
}
|
|
97
93
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
98
94
|
return {
|
|
@@ -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,16 +2,16 @@
|
|
|
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");
|
|
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 formatting_1 = require("./log-updates/formatting");
|
|
13
|
-
const log_update_1 = require("./log-updates/log-update");
|
|
14
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const { reorderSequence } = codemods_1.CodemodsInternals;
|
|
15
15
|
const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodePath, position, clientId }, remotionRoot, logLevel, }) => {
|
|
16
16
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
17
17
|
try {
|
|
@@ -22,7 +22,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
|
|
|
22
22
|
action: 'modify',
|
|
23
23
|
});
|
|
24
24
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
25
|
-
const { output,
|
|
25
|
+
const { output, sequenceLabel, logLine, nodePathRemappings } = await reorderSequence({
|
|
26
26
|
input: fileContents,
|
|
27
27
|
sourceNodePath: sourceNodePath.nodePath,
|
|
28
28
|
targetNodePath: targetNodePath.nodePath,
|
|
@@ -62,10 +62,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
|
|
|
62
62
|
line: logLine,
|
|
63
63
|
});
|
|
64
64
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(sequenceLabel)}`);
|
|
65
|
-
|
|
66
|
-
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
67
|
-
}
|
|
68
|
-
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[reorder-sequence] Wrote ${fileRelativeToRoot}${formatted ? ' (formatted)' : ''}`);
|
|
65
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[reorder-sequence] Wrote ${fileRelativeToRoot}`);
|
|
69
66
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
70
67
|
return {
|
|
71
68
|
success: true,
|
|
@@ -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,
|