@remotion/studio-server 4.0.526 → 4.0.528
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.d.ts +2 -1
- package/dist/codemods/apply-codemod-to-file.js +142 -8
- 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 +11 -3
- package/dist/codemods/update-effect-props/update-effect-props.js +17 -10
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +31 -10
- package/dist/codemods/update-keyframes/update-keyframes.js +24 -7
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +3 -6
- package/dist/codemods/update-sequence-props/update-sequence-props.js +16 -9
- package/dist/helpers/open-file-for-writing-without-symlinks.d.ts +6 -1
- package/dist/helpers/open-file-for-writing-without-symlinks.js +9 -6
- package/dist/helpers/resolve-composition-component.d.ts +1 -1
- package/dist/helpers/resolve-composition-component.js +5 -4
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -6
- package/dist/preview-server/api-routes.js +8 -2
- package/dist/preview-server/hot-middleware/index.js +13 -46
- package/dist/preview-server/routes/add-effect.js +17 -8
- package/dist/preview-server/routes/apply-codemod.d.ts +0 -19
- package/dist/preview-server/routes/apply-codemod.js +24 -26
- package/dist/preview-server/routes/apply-visual-control-change.js +13 -65
- 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.d.ts +0 -10
- package/dist/preview-server/routes/can-update-sequence-props.js +62 -495
- package/dist/preview-server/routes/delete-effect.js +15 -13
- 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} +23 -12
- package/dist/preview-server/routes/download-remote-asset.d.ts +5 -0
- package/dist/preview-server/routes/download-remote-asset.js +25 -20
- package/dist/preview-server/routes/duplicate-effect.js +12 -4
- package/dist/preview-server/routes/duplicate-jsx-node.js +15 -4
- 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/insert-element.js +399 -280
- package/dist/preview-server/routes/install-dependency.js +14 -4
- package/dist/preview-server/routes/prepare-element-install.js +3 -0
- package/dist/preview-server/routes/reorder-effect.js +12 -5
- package/dist/preview-server/routes/reorder-sequence.js +10 -5
- package/dist/preview-server/routes/replace-video-source.d.ts +3 -0
- package/dist/preview-server/routes/replace-video-source.js +81 -0
- package/dist/preview-server/routes/save-sequence-props.js +8 -28
- package/dist/preview-server/routes/split-jsx-sequence.js +82 -42
- package/dist/preview-server/routes/split-video-from-audio.js +9 -4
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +6 -10
- package/dist/preview-server/routes/update-config.js +38 -2
- package/dist/preview-server/routes/update-default-props.js +12 -8
- package/dist/preview-server/routes/wrap-jsx-node.d.ts +3 -0
- package/dist/preview-server/routes/wrap-jsx-node.js +97 -0
- package/dist/preview-server/studio-protocol/handle-discovery.js +1 -1
- package/dist/preview-server/studio-protocol/handle-element-library.js +3 -3
- package/dist/preview-server/undo-stack.d.ts +2 -1
- package/dist/preview-server/undo-stack.js +19 -0
- package/dist/routes.js +2 -0
- 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
|
@@ -72,16 +72,26 @@ const handleInstallPackage = async ({ logLevel, remotionRoot, input: { dependenc
|
|
|
72
72
|
YARN_ENABLE_SCRIPTS: 'false',
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
|
+
let stderr = '';
|
|
75
76
|
cmd.on('error', reject);
|
|
76
77
|
cmd.stdout.on('data', (d) => d
|
|
77
78
|
.toString()
|
|
78
79
|
.trim()
|
|
79
80
|
.split('\n')
|
|
80
81
|
.forEach((line) => renderer_1.RenderInternals.Log.info({ indent: true, logLevel }, line)));
|
|
81
|
-
cmd.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
cmd.stderr.on('data', (data) => {
|
|
83
|
+
stderr += data.toString();
|
|
84
|
+
});
|
|
85
|
+
cmd.on('close', (code, signal) => {
|
|
86
|
+
if (code === 0) {
|
|
87
|
+
resolve();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const packageManagerError = stderr.trim();
|
|
91
|
+
reject(new Error(packageManagerError.length > 0
|
|
92
|
+
? `Package installation failed:\n${packageManagerError}`
|
|
93
|
+
: `Package installation failed: Command exited with code ${code} and signal ${signal}`));
|
|
94
|
+
});
|
|
85
95
|
});
|
|
86
96
|
await invalidateBundle();
|
|
87
97
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray('╰─ '), `Done in ${Date.now() - time}ms`);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareElementInstallHandler = void 0;
|
|
4
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
4
5
|
const element_install_plan_1 = require("./element-install-plan");
|
|
5
6
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
6
7
|
const prepareElementInstallHandler = ({ entryPoint, input, remotionRoot }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
7
8
|
try {
|
|
9
|
+
studio_protocol_1.StudioProtocolInternals.assertElementAssets(input.element.assets);
|
|
10
|
+
studio_protocol_1.StudioProtocolInternals.assertElementAssetReferences(input.element);
|
|
8
11
|
const plan = await (0, element_install_plan_1.getElementInstallPlan)({
|
|
9
12
|
...input,
|
|
10
13
|
entryPoint,
|
|
@@ -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");
|
|
@@ -13,6 +13,8 @@ const log_update_1 = require("./log-updates/log-update");
|
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
14
|
const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex, toIndex, clientId }, remotionRoot, logLevel, }) => {
|
|
15
15
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
|
+
var _a;
|
|
17
|
+
var _b;
|
|
16
18
|
try {
|
|
17
19
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[reorder-effect] Received request for fileName="${fileName}" fromIndex=${fromIndex} toIndex=${toIndex}`);
|
|
18
20
|
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
@@ -21,12 +23,17 @@ const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex,
|
|
|
21
23
|
action: 'modify',
|
|
22
24
|
});
|
|
23
25
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const result = await (0, codemods_1.reorderEffect)({
|
|
27
|
+
project: { files: { [absolutePath]: fileContents }, rootDir: remotionRoot },
|
|
28
|
+
effect: {
|
|
29
|
+
filePath: absolutePath,
|
|
30
|
+
nodePath: sequenceNodePath.nodePath,
|
|
31
|
+
effectIndex: fromIndex,
|
|
32
|
+
},
|
|
28
33
|
toIndex,
|
|
29
34
|
});
|
|
35
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
36
|
+
const { formatted, effectLabel, logLine } = result.editDetails[0];
|
|
30
37
|
(0, undo_stack_1.pushToUndoStack)({
|
|
31
38
|
filePath: absolutePath,
|
|
32
39
|
oldContents: fileContents,
|
|
@@ -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");
|
|
@@ -13,6 +13,8 @@ const formatting_1 = require("./log-updates/formatting");
|
|
|
13
13
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
14
|
const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodePath, position, clientId }, remotionRoot, logLevel, }) => {
|
|
15
15
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
16
|
+
var _a;
|
|
17
|
+
var _b;
|
|
16
18
|
try {
|
|
17
19
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[reorder-sequence] Received request for fileName="${fileName}" position=${position}`);
|
|
18
20
|
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
@@ -21,12 +23,15 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
|
|
|
21
23
|
action: 'modify',
|
|
22
24
|
});
|
|
23
25
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const result = await (0, codemods_1.reorderJsxNode)({
|
|
27
|
+
project: { files: { [absolutePath]: fileContents }, rootDir: remotionRoot },
|
|
28
|
+
node: { filePath: absolutePath, nodePath: sourceNodePath.nodePath },
|
|
29
|
+
target: { filePath: absolutePath, nodePath: targetNodePath.nodePath },
|
|
28
30
|
position,
|
|
29
31
|
});
|
|
32
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
33
|
+
const { sequenceLabel, logLine } = result.editDetails[0];
|
|
34
|
+
const nodePathRemappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
30
35
|
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
|
|
31
36
|
{
|
|
32
37
|
absolutePath,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceVideoSourceHandler = 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 no_react_1 = require("remotion/no-react");
|
|
8
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
9
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
10
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
11
|
+
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
12
|
+
const undo_stack_1 = require("../undo-stack");
|
|
13
|
+
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const replaceVideoSourceHandler = ({ input: { fileName, nodePath, src }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
var _b, _c;
|
|
17
|
+
try {
|
|
18
|
+
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
19
|
+
remotionRoot,
|
|
20
|
+
fileName,
|
|
21
|
+
action: 'modify',
|
|
22
|
+
});
|
|
23
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
+
const result = (0, codemods_1.updateJsxNodeProps)({
|
|
25
|
+
project: {
|
|
26
|
+
files: { [absolutePath]: fileContents },
|
|
27
|
+
rootDir: remotionRoot,
|
|
28
|
+
},
|
|
29
|
+
node: { filePath: absolutePath, nodePath },
|
|
30
|
+
updates: [
|
|
31
|
+
{
|
|
32
|
+
key: 'src',
|
|
33
|
+
value: `${no_react_1.NoReactInternals.FILE_TOKEN}${src.split('/').map(encodeURIComponent).join('/')}`,
|
|
34
|
+
defaultValue: null,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
39
|
+
const { logLine } = result;
|
|
40
|
+
const nodePathRemappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
41
|
+
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings: nodePathRemappings }], null);
|
|
42
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
43
|
+
filePath: absolutePath,
|
|
44
|
+
oldContents: fileContents,
|
|
45
|
+
newContents: null,
|
|
46
|
+
logLevel,
|
|
47
|
+
remotionRoot,
|
|
48
|
+
logLine,
|
|
49
|
+
description: {
|
|
50
|
+
undoMessage: '↩️ Removed video background',
|
|
51
|
+
redoMessage: '↪️ Removed video background',
|
|
52
|
+
},
|
|
53
|
+
entryType: 'replace-video-source',
|
|
54
|
+
suppressHmrOnFileRestore: false,
|
|
55
|
+
nodePathRemappings,
|
|
56
|
+
});
|
|
57
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
58
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
59
|
+
file: absolutePath,
|
|
60
|
+
content: output,
|
|
61
|
+
originatorClientId: undefined,
|
|
62
|
+
metadata: { skipSequencePropsUpdate: true },
|
|
63
|
+
});
|
|
64
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
65
|
+
remotionRoot,
|
|
66
|
+
absolutePath,
|
|
67
|
+
line: logLine,
|
|
68
|
+
});
|
|
69
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(locationLabel)} Replaced video source`);
|
|
70
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
71
|
+
return Promise.resolve({ success: true, nodePathMutation });
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return Promise.resolve({
|
|
75
|
+
success: false,
|
|
76
|
+
reason: error.message,
|
|
77
|
+
stack: (_c = error.stack) !== null && _c !== void 0 ? _c : '',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
exports.replaceVideoSourceHandler = replaceVideoSourceHandler;
|
|
@@ -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;
|
|
@@ -190,7 +191,6 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
190
191
|
}
|
|
191
192
|
const snapshots = [];
|
|
192
193
|
const outputByPath = new Map();
|
|
193
|
-
const statusAstByPath = new Map();
|
|
194
194
|
const resultByIndex = new Map();
|
|
195
195
|
const updatedNodePaths = new Map();
|
|
196
196
|
const sequenceKeyframeLogs = [];
|
|
@@ -199,20 +199,14 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
199
199
|
for (const [absolutePath, group] of editGroups) {
|
|
200
200
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
201
201
|
let output = fileContents;
|
|
202
|
-
const cachedStatusAst = group.edits.length > 0
|
|
203
|
-
? (0, can_update_sequence_props_1.takeCachedSequencePropsStatusAst)(fileContents)
|
|
204
|
-
: null;
|
|
205
|
-
let sequencePropsAst = null;
|
|
206
202
|
let firstLogLine = Number.POSITIVE_INFINITY;
|
|
207
203
|
if (group.edits.length > 0) {
|
|
208
|
-
const { output: sequencePropsOutput, formatted, results: updateResults,
|
|
204
|
+
const { output: sequencePropsOutput, formatted, results: updateResults, } = await (0, update_sequence_props_1.updateMultipleSequenceProps)({
|
|
209
205
|
input: output,
|
|
210
206
|
changes: group.edits.map(exports.convertSequencePropEditToCodemodChange),
|
|
211
207
|
prettierConfigOverride: null,
|
|
212
|
-
ast: cachedStatusAst !== null && cachedStatusAst !== void 0 ? cachedStatusAst : undefined,
|
|
213
208
|
});
|
|
214
209
|
output = sequencePropsOutput;
|
|
215
|
-
sequencePropsAst = ast;
|
|
216
210
|
const firstUpdate = updateResults[0];
|
|
217
211
|
if (firstUpdate) {
|
|
218
212
|
firstLogLine = Math.min(firstLogLine, firstUpdate.logLine);
|
|
@@ -230,7 +224,7 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
230
224
|
}
|
|
231
225
|
}
|
|
232
226
|
for (const captionPatchRequest of group.captionPatches) {
|
|
233
|
-
const result =
|
|
227
|
+
const result = updateInlineCaptionPatches({
|
|
234
228
|
input: output,
|
|
235
229
|
nodePath: captionPatchRequest.nodePath.nodePath,
|
|
236
230
|
patches: captionPatchRequest.patches,
|
|
@@ -372,13 +366,6 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
372
366
|
});
|
|
373
367
|
}
|
|
374
368
|
}
|
|
375
|
-
if (sequencePropsAst &&
|
|
376
|
-
group.captionPatches.length === 0 &&
|
|
377
|
-
group.addedKeyframes.length === 0 &&
|
|
378
|
-
group.movedSequenceKeyframes.length === 0 &&
|
|
379
|
-
group.effectKeyframes.length === 0) {
|
|
380
|
-
statusAstByPath.set(absolutePath, sequencePropsAst);
|
|
381
|
-
}
|
|
382
369
|
outputByPath.set(absolutePath, output);
|
|
383
370
|
snapshots.push({
|
|
384
371
|
filePath: absolutePath,
|
|
@@ -504,16 +491,10 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
504
491
|
effects: [],
|
|
505
492
|
videoConfigValues: target.nodePath.videoConfigValues,
|
|
506
493
|
};
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
ast: statusAst,
|
|
512
|
-
})
|
|
513
|
-
: (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
514
|
-
...statusInput,
|
|
515
|
-
fileContents: output,
|
|
516
|
-
});
|
|
494
|
+
const newStatus = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
495
|
+
...statusInput,
|
|
496
|
+
fileContents: output,
|
|
497
|
+
});
|
|
517
498
|
return {
|
|
518
499
|
fileName: target.fileName,
|
|
519
500
|
nodePath: target.nodePath,
|
|
@@ -526,7 +507,6 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
526
507
|
}
|
|
527
508
|
return {
|
|
528
509
|
canUpdate: true,
|
|
529
|
-
props: firstResult.props,
|
|
530
510
|
results,
|
|
531
511
|
};
|
|
532
512
|
});
|
|
@@ -2,64 +2,104 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitJsxSequenceHandler = 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_jsx_sequence_1 = require("../../codemods/split-jsx-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 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
|
+
var _a;
|
|
28
|
+
var _b;
|
|
29
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
30
|
+
remotionRoot,
|
|
31
|
+
fileName,
|
|
32
|
+
action: 'modify',
|
|
33
|
+
});
|
|
34
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
35
|
+
const result = await (0, codemods_1.splitSequences)({
|
|
36
|
+
project: {
|
|
37
|
+
files: { [absolutePath]: fileContents },
|
|
38
|
+
rootDir: remotionRoot,
|
|
39
|
+
},
|
|
40
|
+
splits: fileSequences.map(({ nodePath, sequenceKeys, splitFrame }) => ({
|
|
41
|
+
node: { filePath: absolutePath, nodePath },
|
|
42
|
+
sequenceKeys,
|
|
43
|
+
frame: splitFrame,
|
|
44
|
+
})),
|
|
45
|
+
});
|
|
46
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
47
|
+
const { nodeLabels, logLines } = result.editDetails[0];
|
|
48
|
+
const nodePathRemappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
49
|
+
return {
|
|
30
50
|
absolutePath,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
fileContents,
|
|
52
|
+
fileRelativeToRoot,
|
|
53
|
+
logLine: Math.min(...logLines),
|
|
54
|
+
nodeLabels,
|
|
55
|
+
nodePathRemappings,
|
|
56
|
+
output,
|
|
57
|
+
};
|
|
58
|
+
}));
|
|
59
|
+
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
|
|
60
|
+
absolutePath: update.absolutePath,
|
|
61
|
+
remappings: update.nodePathRemappings,
|
|
62
|
+
})), null);
|
|
63
|
+
const splitDescription = sequences.length === 1
|
|
64
|
+
? updates[0].nodeLabels[0]
|
|
65
|
+
: `${sequences.length} JSX sequences`;
|
|
66
|
+
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
67
|
+
snapshots: updates.map((update) => ({
|
|
68
|
+
filePath: update.absolutePath,
|
|
69
|
+
oldContents: update.fileContents,
|
|
70
|
+
newContents: null,
|
|
71
|
+
logLine: update.logLine,
|
|
72
|
+
nodePathRemappings: update.nodePathRemappings,
|
|
73
|
+
})),
|
|
38
74
|
logLevel,
|
|
39
75
|
remotionRoot,
|
|
40
|
-
logLine,
|
|
41
76
|
description: {
|
|
42
|
-
undoMessage: `↩️ Split of ${
|
|
43
|
-
redoMessage: `↪️ Split of ${
|
|
77
|
+
undoMessage: `↩️ Split of ${splitDescription}`,
|
|
78
|
+
redoMessage: `↪️ Split of ${splitDescription}`,
|
|
44
79
|
},
|
|
45
80
|
entryType: 'split-jsx-sequence',
|
|
46
81
|
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,
|
|
82
|
+
undoRedoNavigation: null,
|
|
60
83
|
});
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
for (const update of updates) {
|
|
85
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
|
|
86
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
87
|
+
file: update.absolutePath,
|
|
88
|
+
content: update.output,
|
|
89
|
+
originatorClientId: undefined,
|
|
90
|
+
metadata: { skipSequencePropsUpdate: true },
|
|
91
|
+
});
|
|
92
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
93
|
+
remotionRoot,
|
|
94
|
+
absolutePath: update.absolutePath,
|
|
95
|
+
line: update.logLine,
|
|
96
|
+
});
|
|
97
|
+
const fileDescription = update.nodeLabels.length === 1
|
|
98
|
+
? update.nodeLabels[0]
|
|
99
|
+
: `${update.nodeLabels.length} JSX sequences`;
|
|
100
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split ${fileDescription}`);
|
|
101
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[split-jsx-sequence] Wrote ${update.fileRelativeToRoot}`);
|
|
102
|
+
}
|
|
63
103
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
64
104
|
return {
|
|
65
105
|
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");
|
|
@@ -12,6 +12,8 @@ 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
14
|
const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
15
|
+
var _a;
|
|
16
|
+
var _b;
|
|
15
17
|
try {
|
|
16
18
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[split-video-from-audio] Received request for fileName="${fileName}"`);
|
|
17
19
|
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
@@ -20,10 +22,13 @@ const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoo
|
|
|
20
22
|
action: 'modify',
|
|
21
23
|
});
|
|
22
24
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
nodePath,
|
|
25
|
+
const result = await (0, codemods_1.detachAudio)({
|
|
26
|
+
project: { files: { [absolutePath]: fileContents }, rootDir: remotionRoot },
|
|
27
|
+
node: { filePath: absolutePath, nodePath },
|
|
26
28
|
});
|
|
29
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
30
|
+
const { formatted, nodeLabel, logLine } = result.editDetails[0];
|
|
31
|
+
const nodePathRemappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
27
32
|
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
|
|
28
33
|
{
|
|
29
34
|
absolutePath,
|
|
@@ -4,14 +4,13 @@ exports.subscribeToSequenceProps = void 0;
|
|
|
4
4
|
const sequence_props_watchers_1 = require("../sequence-props-watchers");
|
|
5
5
|
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
6
6
|
const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
7
|
-
var _a
|
|
8
|
-
const requests = (_a = input.requests) !== null && _a !== void 0 ? _a : [input];
|
|
7
|
+
var _a;
|
|
9
8
|
const unresolvedByFile = new Map();
|
|
10
|
-
for (const [index, request] of requests.entries()) {
|
|
9
|
+
for (const [index, request] of input.requests.entries()) {
|
|
11
10
|
if (request.nodePath !== null) {
|
|
12
11
|
continue;
|
|
13
12
|
}
|
|
14
|
-
const unresolved = (
|
|
13
|
+
const unresolved = (_a = unresolvedByFile.get(request.fileName)) !== null && _a !== void 0 ? _a : [];
|
|
15
14
|
unresolved.push({ index, line: request.line, column: request.column });
|
|
16
15
|
unresolvedByFile.set(request.fileName, unresolved);
|
|
17
16
|
}
|
|
@@ -29,11 +28,11 @@ const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
catch (
|
|
31
|
+
catch (_b) {
|
|
33
32
|
// Let each subscription produce its usual not-found response.
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
const results = requests.map(({ fileName, line, column, nodePath, componentIdentity, keys, assetKeys
|
|
35
|
+
const results = input.requests.map(({ fileName, line, column, nodePath, componentIdentity, keys, assetKeys, effects, clientId, videoConfigValues, }, index) => (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
|
|
37
36
|
fileName,
|
|
38
37
|
line,
|
|
39
38
|
column,
|
|
@@ -48,9 +47,6 @@ const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
|
48
47
|
videoConfigValues,
|
|
49
48
|
logLevel,
|
|
50
49
|
}));
|
|
51
|
-
return Promise.resolve({
|
|
52
|
-
...results[0],
|
|
53
|
-
results,
|
|
54
|
-
});
|
|
50
|
+
return Promise.resolve({ results });
|
|
55
51
|
};
|
|
56
52
|
exports.subscribeToSequenceProps = subscribeToSequenceProps;
|
|
@@ -83,6 +83,22 @@ const validateUpdates = (updates) => {
|
|
|
83
83
|
}
|
|
84
84
|
setters.add(setter);
|
|
85
85
|
if (setter === 'addElementLibrary') {
|
|
86
|
+
if (type === 'delete') {
|
|
87
|
+
if (typeof update.value !== 'string') {
|
|
88
|
+
return 'Deleting an Element Library requires its URL.';
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const parsedUrl = new URL(update.value);
|
|
92
|
+
if (parsedUrl.protocol !== 'http:' &&
|
|
93
|
+
parsedUrl.protocol !== 'https:') {
|
|
94
|
+
return 'Deleting an Element Library requires an HTTP or HTTPS URL.';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (_a) {
|
|
98
|
+
return 'Deleting an Element Library requires an HTTP or HTTPS URL.';
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
86
102
|
if (type !== 'set' ||
|
|
87
103
|
!('value' in update) ||
|
|
88
104
|
typeof update.value !== 'object' ||
|
|
@@ -101,7 +117,7 @@ const validateUpdates = (updates) => {
|
|
|
101
117
|
return 'Config.addElementLibrary() expects an HTTP or HTTPS URL.';
|
|
102
118
|
}
|
|
103
119
|
}
|
|
104
|
-
catch (
|
|
120
|
+
catch (_b) {
|
|
105
121
|
return 'Config.addElementLibrary() expects an HTTP or HTTPS URL.';
|
|
106
122
|
}
|
|
107
123
|
if (displayName !== undefined &&
|
|
@@ -111,6 +127,9 @@ const validateUpdates = (updates) => {
|
|
|
111
127
|
continue;
|
|
112
128
|
}
|
|
113
129
|
if (type === 'delete') {
|
|
130
|
+
if (update.value !== undefined) {
|
|
131
|
+
return `Config.${setter}() does not accept a value when deleting.`;
|
|
132
|
+
}
|
|
114
133
|
continue;
|
|
115
134
|
}
|
|
116
135
|
if (type !== 'set' ||
|
|
@@ -122,13 +141,18 @@ const validateUpdates = (updates) => {
|
|
|
122
141
|
return null;
|
|
123
142
|
};
|
|
124
143
|
const updateConfigFile = ({ configContents, existingElementLibraryUrls, updates, }) => {
|
|
144
|
+
var _a;
|
|
125
145
|
const setters = new Set(updates.map(({ setter }) => setter));
|
|
146
|
+
const deletedElementLibraryValue = (_a = updates.find((update) => update.setter === 'addElementLibrary' && update.type === 'delete')) === null || _a === void 0 ? void 0 : _a.value;
|
|
147
|
+
const deletedElementLibraryUrl = typeof deletedElementLibraryValue === 'string'
|
|
148
|
+
? new URL(deletedElementLibraryValue).href
|
|
149
|
+
: null;
|
|
126
150
|
const elementLibraryUrls = new Set();
|
|
127
151
|
for (const url of existingElementLibraryUrls) {
|
|
128
152
|
try {
|
|
129
153
|
elementLibraryUrls.add(new URL(url).href);
|
|
130
154
|
}
|
|
131
|
-
catch (
|
|
155
|
+
catch (_b) {
|
|
132
156
|
// Runtime config only contains validated URLs.
|
|
133
157
|
}
|
|
134
158
|
}
|
|
@@ -163,6 +187,12 @@ const updateConfigFile = ({ configContents, existingElementLibraryUrls, updates,
|
|
|
163
187
|
urlProperty.value.type === 'StringLiteral') {
|
|
164
188
|
try {
|
|
165
189
|
const parsedUrl = new URL(urlProperty.value.value);
|
|
190
|
+
if (deletedElementLibraryUrl !== null &&
|
|
191
|
+
parsedUrl.href === deletedElementLibraryUrl) {
|
|
192
|
+
path.prune();
|
|
193
|
+
changed = true;
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
166
196
|
if (parsedUrl.protocol === 'http:' ||
|
|
167
197
|
parsedUrl.protocol === 'https:') {
|
|
168
198
|
elementLibraryUrls.add(parsedUrl.href);
|
|
@@ -285,6 +315,12 @@ const updateConfigHandler = async ({ input, configFile, getStudioRuntimeConfig,
|
|
|
285
315
|
updates: input.updates,
|
|
286
316
|
});
|
|
287
317
|
if (updatedConfig === configContents) {
|
|
318
|
+
if (input.updates.some((update) => update.setter === 'addElementLibrary' && update.type === 'delete')) {
|
|
319
|
+
return {
|
|
320
|
+
success: false,
|
|
321
|
+
reason: 'Could not find a matching literal Element Library URL in the config file.',
|
|
322
|
+
};
|
|
323
|
+
}
|
|
288
324
|
return { success: true };
|
|
289
325
|
}
|
|
290
326
|
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|