@remotion/studio-server 4.0.539 → 4.0.541
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/get-node-path-remappings.d.ts +5 -2
- package/dist/codemods/get-node-path-remappings.js +7 -1
- package/dist/file-watcher.d.ts +7 -1
- package/dist/file-watcher.js +33 -5
- package/dist/index.d.ts +6 -2
- package/dist/index.js +4 -0
- package/dist/preview-server/api-routes.js +4 -0
- package/dist/preview-server/commit-node-codemod.d.ts +27 -0
- package/dist/preview-server/commit-node-codemod.js +68 -0
- package/dist/preview-server/hot-middleware/index.js +11 -7
- package/dist/preview-server/live-events.js +8 -1
- package/dist/preview-server/prerendered-scene.d.ts +25 -0
- package/dist/preview-server/prerendered-scene.js +86 -0
- package/dist/preview-server/resolve-compiled-sequence-paths.d.ts +12 -0
- package/dist/preview-server/resolve-compiled-sequence-paths.js +155 -0
- package/dist/preview-server/routes/add-effect-keyframe.js +1 -1
- package/dist/preview-server/routes/add-keyframes.js +17 -9
- package/dist/preview-server/routes/add-render.js +28 -2
- package/dist/preview-server/routes/add-sequence-keyframe.js +1 -1
- package/dist/preview-server/routes/can-update-sequence-props.js +17 -4
- package/dist/preview-server/routes/delete-keyframes.d.ts +2 -2
- package/dist/preview-server/routes/delete-keyframes.js +36 -4
- package/dist/preview-server/routes/delete-nodes.js +1 -1
- package/dist/preview-server/routes/duplicate-nodes.js +3 -1
- package/dist/preview-server/routes/get-keyframe-mutation-results.d.ts +7 -0
- package/dist/preview-server/routes/get-keyframe-mutation-results.js +24 -0
- package/dist/preview-server/routes/invalidate-bundle.js +1 -1
- package/dist/preview-server/routes/move-keyframes.d.ts +2 -2
- package/dist/preview-server/routes/move-keyframes.js +36 -4
- package/dist/preview-server/routes/precompose-jsx-nodes.js +14 -10
- package/dist/preview-server/routes/prerendered-scene-info.d.ts +3 -0
- package/dist/preview-server/routes/prerendered-scene-info.js +31 -0
- package/dist/preview-server/routes/reorder-sequence.js +1 -1
- package/dist/preview-server/routes/replace-video-source.js +25 -78
- package/dist/preview-server/routes/restore-prerendered-scene.d.ts +3 -0
- package/dist/preview-server/routes/restore-prerendered-scene.js +38 -0
- package/dist/preview-server/routes/save-effect-props.js +1 -1
- package/dist/preview-server/routes/save-sequence-props.js +3 -1
- package/dist/preview-server/routes/split-sequences.js +10 -2
- package/dist/preview-server/routes/split-video-from-audio.js +1 -1
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +50 -15
- package/dist/preview-server/routes/unwrap-node.js +1 -1
- package/dist/preview-server/routes/update-effect-keyframe-settings.js +1 -1
- package/dist/preview-server/routes/update-sequence-keyframe-settings.js +1 -1
- package/dist/preview-server/routes/wrap-node.js +1 -1
- package/dist/preview-server/sequence-node-path-mutation-build.d.ts +2 -0
- package/dist/preview-server/sequence-node-path-mutation-build.js +221 -0
- package/dist/preview-server/sequence-node-path-mutation.d.ts +2 -1
- package/dist/preview-server/sequence-node-path-mutation.js +14 -2
- package/dist/preview-server/sequence-props-watchers.d.ts +2 -1
- package/dist/preview-server/sequence-props-watchers.js +11 -4
- package/dist/preview-server/serve-static.js +3 -0
- package/dist/preview-server/undo-stack.d.ts +1 -1
- package/dist/preview-server/undo-stack.js +14 -2
- package/dist/preview-server/watch-ignore-next-change.d.ts +1 -1
- package/dist/preview-server/watch-ignore-next-change.js +3 -3
- package/dist/remotion-skill-names.d.ts +1 -1
- package/dist/remotion-skill-names.js +1 -0
- package/dist/routes.js +91 -28
- package/package.json +10 -10
- 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-codemod-to-file.d.ts +0 -7
- package/dist/codemods/apply-codemod-to-file.js +0 -171
- 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.d.ts +0 -22
- package/dist/codemods/delete-jsx-node.js +0 -17
- package/dist/codemods/delete-jsx-nodes.d.ts +0 -13
- package/dist/codemods/delete-jsx-nodes.js +0 -10
- 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/insert-video-layers.d.ts +0 -11
- package/dist/codemods/insert-video-layers.js +0 -5
- 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-jsx-sequence.d.ts +0 -27
- package/dist/codemods/split-jsx-sequence.js +0 -19
- 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/open-browser-shortcut.d.ts +0 -9
- package/dist/open-browser-shortcut.js +0 -121
- package/dist/preview-server/hot-middleware/types.d.ts +0 -2
- package/dist/preview-server/hot-middleware/types.js +0 -2
- package/dist/preview-server/routes/apply-codemod.d.ts +0 -4
- package/dist/preview-server/routes/apply-codemod.js +0 -272
- package/dist/preview-server/routes/delete-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-node.js +0 -126
- package/dist/preview-server/routes/delete-jsx-nodes.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-nodes.js +0 -137
- package/dist/preview-server/routes/duplicate-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/duplicate-jsx-node.js +0 -118
- package/dist/preview-server/routes/insert-jsx-element.d.ts +0 -3
- package/dist/preview-server/routes/insert-jsx-element.js +0 -231
- package/dist/preview-server/routes/insert-video-layers.d.ts +0 -3
- package/dist/preview-server/routes/insert-video-layers.js +0 -68
- package/dist/preview-server/routes/split-jsx-sequence.d.ts +0 -3
- package/dist/preview-server/routes/split-jsx-sequence.js +0 -117
- package/dist/preview-server/routes/update-public-license.d.ts +0 -11
- package/dist/preview-server/routes/update-public-license.js +0 -97
- package/dist/preview-server/routes/wrap-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/wrap-jsx-node.js +0 -97
|
@@ -8,6 +8,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 undo_stack_1 = require("../undo-stack");
|
|
10
10
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
11
|
+
const get_keyframe_mutation_results_1 = require("./get-keyframe-mutation-results");
|
|
11
12
|
const log_effect_update_1 = require("./log-updates/log-effect-update");
|
|
12
13
|
const log_update_1 = require("./log-updates/log-update");
|
|
13
14
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
@@ -35,7 +36,7 @@ const getBatchDescription = ({ totalKeyframes, firstKeyframe, }) => {
|
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, remotionRoot, logLevel, }) => {
|
|
38
|
-
var _a, _b;
|
|
39
|
+
var _a, _b, _c;
|
|
39
40
|
const totalKeyframes = sequenceKeyframes.length + effectKeyframes.length;
|
|
40
41
|
if (totalKeyframes === 0) {
|
|
41
42
|
throw new Error('No keyframes were specified for moving');
|
|
@@ -79,6 +80,8 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
79
80
|
});
|
|
80
81
|
fileGroups.set(absolutePath, group);
|
|
81
82
|
}
|
|
83
|
+
const results = [];
|
|
84
|
+
const resultsByFile = new Map();
|
|
82
85
|
const snapshots = [];
|
|
83
86
|
const sequenceLogs = [];
|
|
84
87
|
const effectLogs = [];
|
|
@@ -86,6 +89,7 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
86
89
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
87
90
|
let output = fileContents;
|
|
88
91
|
let firstLogLine = Number.POSITIVE_INFINITY;
|
|
92
|
+
const targets = [];
|
|
89
93
|
for (const keyframeGroup of groupBy(group.sequenceKeyframes, (keyframe) => JSON.stringify(keyframe.nodePath.nodePath))) {
|
|
90
94
|
const [firstSequenceKeyframe] = keyframeGroup;
|
|
91
95
|
if (!firstSequenceKeyframe) {
|
|
@@ -115,6 +119,15 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
115
119
|
updates,
|
|
116
120
|
});
|
|
117
121
|
output = result.output;
|
|
122
|
+
targets.push({
|
|
123
|
+
nodePath: {
|
|
124
|
+
...firstSequenceKeyframe.nodePath,
|
|
125
|
+
absolutePath,
|
|
126
|
+
nodePath: result.updatedNode.nodePath,
|
|
127
|
+
},
|
|
128
|
+
effectIndex: null,
|
|
129
|
+
keys: [...new Set(keyframeGroup.map((keyframe) => keyframe.key))],
|
|
130
|
+
});
|
|
118
131
|
firstLogLine = Math.min(firstLogLine, result.logLine);
|
|
119
132
|
for (const [updateIndex, update] of updates.entries()) {
|
|
120
133
|
sequenceLogs.push({
|
|
@@ -157,6 +170,15 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
157
170
|
updates,
|
|
158
171
|
});
|
|
159
172
|
output = result.output;
|
|
173
|
+
targets.push({
|
|
174
|
+
nodePath: {
|
|
175
|
+
...firstEffectKeyframe.sequenceNodePath,
|
|
176
|
+
absolutePath,
|
|
177
|
+
nodePath: result.updatedEffect.nodePath,
|
|
178
|
+
},
|
|
179
|
+
effectIndex: firstEffectKeyframe.effectIndex,
|
|
180
|
+
keys: [...new Set(keyframeGroup.map((keyframe) => keyframe.key))],
|
|
181
|
+
});
|
|
160
182
|
firstLogLine = Math.min(firstLogLine, result.logLine);
|
|
161
183
|
for (const [updateIndex, update] of updates.entries()) {
|
|
162
184
|
effectLogs.push({
|
|
@@ -170,6 +192,12 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
170
192
|
});
|
|
171
193
|
}
|
|
172
194
|
}
|
|
195
|
+
const fileResults = (0, get_keyframe_mutation_results_1.getKeyframeMutationResults)({
|
|
196
|
+
fileContents: output,
|
|
197
|
+
targets,
|
|
198
|
+
});
|
|
199
|
+
results.push(...fileResults);
|
|
200
|
+
resultsByFile.set(absolutePath, fileResults);
|
|
173
201
|
snapshots.push({
|
|
174
202
|
filePath: absolutePath,
|
|
175
203
|
oldContents: fileContents,
|
|
@@ -200,12 +228,15 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
200
228
|
for (const snapshot of snapshots) {
|
|
201
229
|
(0, undo_stack_1.suppressUndoStackInvalidation)(snapshot.filePath);
|
|
202
230
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
|
|
203
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
231
|
+
const sourceVersion = (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
204
232
|
file: snapshot.filePath,
|
|
205
233
|
content: snapshot.newContents,
|
|
206
234
|
originatorClientId: clientId,
|
|
207
235
|
metadata: null,
|
|
208
236
|
});
|
|
237
|
+
for (const result of (_c = resultsByFile.get(snapshot.filePath)) !== null && _c !== void 0 ? _c : []) {
|
|
238
|
+
result.sourceVersion = sourceVersion;
|
|
239
|
+
}
|
|
209
240
|
}
|
|
210
241
|
for (const log of sequenceLogs) {
|
|
211
242
|
(0, log_update_1.logUpdate)({
|
|
@@ -237,17 +268,18 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
|
|
|
237
268
|
});
|
|
238
269
|
}
|
|
239
270
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
271
|
+
return results;
|
|
240
272
|
};
|
|
241
273
|
exports.moveKeyframes = moveKeyframes;
|
|
242
274
|
const moveKeyframesHandler = ({ input: { sequenceKeyframes, effectKeyframes, clientId }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
243
275
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[move-keyframes] Received request to move ${sequenceKeyframes.length + effectKeyframes.length} keyframe(s)`);
|
|
244
|
-
await (0, exports.moveKeyframes)({
|
|
276
|
+
const results = await (0, exports.moveKeyframes)({
|
|
245
277
|
sequenceKeyframes,
|
|
246
278
|
effectKeyframes,
|
|
247
279
|
clientId,
|
|
248
280
|
remotionRoot,
|
|
249
281
|
logLevel,
|
|
250
282
|
});
|
|
251
|
-
return { success: true };
|
|
283
|
+
return { success: true, results };
|
|
252
284
|
});
|
|
253
285
|
exports.moveKeyframesHandler = moveKeyframesHandler;
|
|
@@ -10,7 +10,7 @@ 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 precomposeJsxNodesHandler = ({ input: { nodes, dryRun, compositionFile, compositionId, metadata, existingCompositionIds, }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
13
|
+
const precomposeJsxNodesHandler = ({ input: { nodes, dryRun, compositionFile, compositionId, metadata, existingCompositionIds, name, }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
14
14
|
var _a;
|
|
15
15
|
const attemptedWrites = [];
|
|
16
16
|
let undoEntryPushed = false;
|
|
@@ -54,16 +54,8 @@ const precomposeJsxNodesHandler = ({ input: { nodes, dryRun, compositionFile, co
|
|
|
54
54
|
compositionId,
|
|
55
55
|
metadata,
|
|
56
56
|
existingCompositionIds,
|
|
57
|
+
name,
|
|
57
58
|
};
|
|
58
|
-
if (dryRun) {
|
|
59
|
-
const eligibility = (0, codemods_1.canPrecomposeJsxNodes)(codemodInput);
|
|
60
|
-
return Promise.resolve({
|
|
61
|
-
success: true,
|
|
62
|
-
...eligibility,
|
|
63
|
-
nodePathMutation: null,
|
|
64
|
-
newCompositionId: null,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
59
|
let result;
|
|
68
60
|
try {
|
|
69
61
|
result = (0, codemods_1.precomposeJsxNodes)(codemodInput);
|
|
@@ -73,10 +65,21 @@ const precomposeJsxNodesHandler = ({ input: { nodes, dryRun, compositionFile, co
|
|
|
73
65
|
success: true,
|
|
74
66
|
canPrecompose: false,
|
|
75
67
|
reason: error instanceof Error ? error.message : String(error),
|
|
68
|
+
invalidName: error instanceof Error && error.name === 'PrecomposeNameError',
|
|
76
69
|
nodePathMutation: null,
|
|
77
70
|
newCompositionId: null,
|
|
78
71
|
});
|
|
79
72
|
}
|
|
73
|
+
if (dryRun) {
|
|
74
|
+
return Promise.resolve({
|
|
75
|
+
success: true,
|
|
76
|
+
canPrecompose: true,
|
|
77
|
+
reason: null,
|
|
78
|
+
invalidName: false,
|
|
79
|
+
nodePathMutation: null,
|
|
80
|
+
newCompositionId: result.newCompositionId,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
80
83
|
const changes = [...result.changes].sort((a, b) => Number(b.filePath === absolutePath) -
|
|
81
84
|
Number(a.filePath === absolutePath));
|
|
82
85
|
if (!changes.some(({ filePath }) => filePath === absolutePath) ||
|
|
@@ -172,6 +175,7 @@ const precomposeJsxNodesHandler = ({ input: { nodes, dryRun, compositionFile, co
|
|
|
172
175
|
success: true,
|
|
173
176
|
canPrecompose: true,
|
|
174
177
|
reason: null,
|
|
178
|
+
invalidName: false,
|
|
175
179
|
nodePathMutation,
|
|
176
180
|
newCompositionId: result.newCompositionId,
|
|
177
181
|
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PrerenderedSceneInfoRequest, PrerenderedSceneInfoResponse } from '@remotion/studio-shared';
|
|
2
|
+
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const prerenderedSceneInfoHandler: ApiHandler<PrerenderedSceneInfoRequest, PrerenderedSceneInfoResponse>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prerenderedSceneInfoHandler = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const prerendered_scene_1 = require("../prerendered-scene");
|
|
9
|
+
const prerenderedSceneInfoHandler = ({ input: { src }, publicDir, remotionRoot }) => {
|
|
10
|
+
const sidecar = (0, prerendered_scene_1.readPrerenderedSceneSidecar)({ publicDir, src });
|
|
11
|
+
if (sidecar === null) {
|
|
12
|
+
return Promise.resolve({ type: 'not-prerendered' });
|
|
13
|
+
}
|
|
14
|
+
let stale = null;
|
|
15
|
+
if (sidecar.sceneFile !== null && sidecar.sceneFileHash !== null) {
|
|
16
|
+
try {
|
|
17
|
+
stale =
|
|
18
|
+
(0, prerendered_scene_1.hashSceneFile)(node_path_1.default.resolve(remotionRoot, sidecar.sceneFile)) !==
|
|
19
|
+
sidecar.sceneFileHash;
|
|
20
|
+
}
|
|
21
|
+
catch (_a) {
|
|
22
|
+
stale = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return Promise.resolve({
|
|
26
|
+
type: 'prerendered',
|
|
27
|
+
compositionId: sidecar.compositionId,
|
|
28
|
+
stale,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.prerenderedSceneInfoHandler = prerenderedSceneInfoHandler;
|
|
@@ -49,7 +49,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePaths, targetNode
|
|
|
49
49
|
(0, undo_stack_1.pushToUndoStack)({
|
|
50
50
|
filePath: absolutePath,
|
|
51
51
|
oldContents: fileContents,
|
|
52
|
-
newContents:
|
|
52
|
+
newContents: output,
|
|
53
53
|
logLevel,
|
|
54
54
|
remotionRoot,
|
|
55
55
|
logLine,
|
|
@@ -1,86 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceVideoSourceHandler = void 0;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
4
|
const codemods_1 = require("@remotion/codemods");
|
|
6
|
-
const renderer_1 = require("@remotion/renderer");
|
|
7
5
|
const no_react_1 = require("remotion/no-react");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
24
|
-
const result = (0, codemods_1.updateNodeProps)({
|
|
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, oldJsxName, newJsxName }) => ({
|
|
41
|
-
oldNodePath,
|
|
42
|
-
newNodePath,
|
|
43
|
-
oldJsxName,
|
|
44
|
-
newJsxName,
|
|
45
|
-
}));
|
|
46
|
-
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings: nodePathRemappings }], null);
|
|
47
|
-
(0, undo_stack_1.pushToUndoStack)({
|
|
48
|
-
filePath: absolutePath,
|
|
49
|
-
oldContents: fileContents,
|
|
50
|
-
newContents: null,
|
|
51
|
-
logLevel,
|
|
52
|
-
remotionRoot,
|
|
53
|
-
logLine,
|
|
54
|
-
description: {
|
|
55
|
-
undoMessage: '↩️ Removed video background',
|
|
56
|
-
redoMessage: '↪️ Removed video background',
|
|
6
|
+
const commit_node_codemod_1 = require("../commit-node-codemod");
|
|
7
|
+
const replaceVideoSourceHandler = ({ input: { fileName, nodePath, src }, remotionRoot, logLevel }) => (0, commit_node_codemod_1.commitNodeCodemod)({
|
|
8
|
+
remotionRoot,
|
|
9
|
+
logLevel,
|
|
10
|
+
fileName,
|
|
11
|
+
nodePath,
|
|
12
|
+
codemod: ({ project, node }) => (0, codemods_1.updateNodeProps)({
|
|
13
|
+
project,
|
|
14
|
+
node,
|
|
15
|
+
updates: [
|
|
16
|
+
{
|
|
17
|
+
key: 'src',
|
|
18
|
+
value: `${no_react_1.NoReactInternals.FILE_TOKEN}${src.split('/').map(encodeURIComponent).join('/')}`,
|
|
19
|
+
defaultValue: null,
|
|
57
20
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
70
|
-
remotionRoot,
|
|
71
|
-
absolutePath,
|
|
72
|
-
line: logLine,
|
|
73
|
-
});
|
|
74
|
-
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`);
|
|
75
|
-
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
76
|
-
return Promise.resolve({ success: true, nodePathMutation });
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
return Promise.resolve({
|
|
80
|
-
success: false,
|
|
81
|
-
reason: error.message,
|
|
82
|
-
stack: (_c = error.stack) !== null && _c !== void 0 ? _c : '',
|
|
83
|
-
});
|
|
84
|
-
}
|
|
21
|
+
],
|
|
22
|
+
}),
|
|
23
|
+
label: 'Removed video background',
|
|
24
|
+
entryType: 'replace-video-source',
|
|
25
|
+
}).then(({ nodePathMutation }) => ({ success: true, nodePathMutation }), (error) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return ({
|
|
28
|
+
success: false,
|
|
29
|
+
reason: error.message,
|
|
30
|
+
stack: (_a = error.stack) !== null && _a !== void 0 ? _a : '',
|
|
31
|
+
});
|
|
85
32
|
});
|
|
86
33
|
exports.replaceVideoSourceHandler = replaceVideoSourceHandler;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RestorePrerenderedSceneRequest, RestorePrerenderedSceneResponse } from '@remotion/studio-shared';
|
|
2
|
+
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const restorePrerenderedSceneHandler: ApiHandler<RestorePrerenderedSceneRequest, RestorePrerenderedSceneResponse>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.restorePrerenderedSceneHandler = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const commit_node_codemod_1 = require("../commit-node-codemod");
|
|
6
|
+
const prerendered_scene_1 = require("../prerendered-scene");
|
|
7
|
+
const restorePrerenderedSceneHandler = ({ input: { fileName, nodePath, src }, publicDir, remotionRoot, logLevel }) => {
|
|
8
|
+
const sidecar = (0, prerendered_scene_1.readPrerenderedSceneSidecar)({ publicDir, src });
|
|
9
|
+
if (sidecar === null) {
|
|
10
|
+
return Promise.resolve({
|
|
11
|
+
success: false,
|
|
12
|
+
reason: 'This video was not rendered from a scene',
|
|
13
|
+
stack: '',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return (0, commit_node_codemod_1.commitNodeCodemod)({
|
|
17
|
+
remotionRoot,
|
|
18
|
+
logLevel,
|
|
19
|
+
fileName,
|
|
20
|
+
nodePath,
|
|
21
|
+
codemod: ({ project, node }) => codemods_1.CodemodsInternals.replaceJsxElementWithSource({
|
|
22
|
+
project,
|
|
23
|
+
node,
|
|
24
|
+
source: sidecar.source,
|
|
25
|
+
importStatements: sidecar.importStatements,
|
|
26
|
+
}),
|
|
27
|
+
label: 'Restored unrendered scene',
|
|
28
|
+
entryType: 'restore-prerendered-scene',
|
|
29
|
+
}).then(({ nodePathMutation }) => ({ success: true, nodePathMutation }), (error) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return ({
|
|
32
|
+
success: false,
|
|
33
|
+
reason: error.message,
|
|
34
|
+
stack: (_a = error.stack) !== null && _a !== void 0 ? _a : '',
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.restorePrerenderedSceneHandler = restorePrerenderedSceneHandler;
|
|
@@ -81,7 +81,7 @@ const saveEffectPropsHandler = ({ input, remotionRoot, logLevel }) => (0, source
|
|
|
81
81
|
(0, undo_stack_1.pushToUndoStack)({
|
|
82
82
|
filePath: absolutePath,
|
|
83
83
|
oldContents: fileContents,
|
|
84
|
-
newContents:
|
|
84
|
+
newContents: output,
|
|
85
85
|
logLevel,
|
|
86
86
|
remotionRoot,
|
|
87
87
|
logLine,
|
|
@@ -73,7 +73,9 @@ const convertSequencePropEditToCodemodChange = (edit) => {
|
|
|
73
73
|
exports.convertSequencePropEditToCodemodChange = convertSequencePropEditToCodemodChange;
|
|
74
74
|
const shouldSuppressHmrForSequencePropEdits = (edits) => {
|
|
75
75
|
return edits.every((edit) => edit.key !== 'showInTimeline' &&
|
|
76
|
-
(edit.sourceEdit === null ||
|
|
76
|
+
(edit.sourceEdit === null ||
|
|
77
|
+
edit.sourceEdit === undefined ||
|
|
78
|
+
edit.sourceEdit.type === 'playback-rate'));
|
|
77
79
|
};
|
|
78
80
|
exports.shouldSuppressHmrForSequencePropEdits = shouldSuppressHmrForSequencePropEdits;
|
|
79
81
|
const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyframes, captionPatches = [], clientId, undoLabel, redoLabel, }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
@@ -60,6 +60,10 @@ const splitSequencesHandler = ({ input: { sequences }, remotionRoot, logLevel })
|
|
|
60
60
|
nodeLabels,
|
|
61
61
|
nodePathRemappings,
|
|
62
62
|
output,
|
|
63
|
+
splitNodes: result.insertedNodes.map(({ filePath, nodePath }) => ({
|
|
64
|
+
absolutePath: filePath,
|
|
65
|
+
nodePath,
|
|
66
|
+
})),
|
|
63
67
|
};
|
|
64
68
|
}));
|
|
65
69
|
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
|
|
@@ -73,7 +77,7 @@ const splitSequencesHandler = ({ input: { sequences }, remotionRoot, logLevel })
|
|
|
73
77
|
snapshots: updates.map((update) => ({
|
|
74
78
|
filePath: update.absolutePath,
|
|
75
79
|
oldContents: update.fileContents,
|
|
76
|
-
newContents:
|
|
80
|
+
newContents: update.output,
|
|
77
81
|
logLine: update.logLine,
|
|
78
82
|
nodePathRemappings: update.nodePathRemappings,
|
|
79
83
|
})),
|
|
@@ -87,14 +91,16 @@ const splitSequencesHandler = ({ input: { sequences }, remotionRoot, logLevel })
|
|
|
87
91
|
suppressHmrOnFileRestore: false,
|
|
88
92
|
undoRedoNavigation: null,
|
|
89
93
|
});
|
|
94
|
+
const sourceVersions = [];
|
|
90
95
|
for (const update of updates) {
|
|
91
96
|
(0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
|
|
92
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
97
|
+
const sourceVersion = (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
93
98
|
file: update.absolutePath,
|
|
94
99
|
content: update.output,
|
|
95
100
|
originatorClientId: undefined,
|
|
96
101
|
metadata: { skipSequencePropsUpdate: true },
|
|
97
102
|
});
|
|
103
|
+
sourceVersions.push({ absolutePath: update.absolutePath, sourceVersion });
|
|
98
104
|
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
99
105
|
remotionRoot,
|
|
100
106
|
absolutePath: update.absolutePath,
|
|
@@ -110,6 +116,8 @@ const splitSequencesHandler = ({ input: { sequences }, remotionRoot, logLevel })
|
|
|
110
116
|
return {
|
|
111
117
|
success: true,
|
|
112
118
|
nodePathMutation,
|
|
119
|
+
splitNodes: updates.flatMap((update) => update.splitNodes),
|
|
120
|
+
sourceVersions,
|
|
113
121
|
};
|
|
114
122
|
}
|
|
115
123
|
catch (err) {
|
|
@@ -43,7 +43,7 @@ const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoo
|
|
|
43
43
|
(0, undo_stack_1.pushToUndoStack)({
|
|
44
44
|
filePath: absolutePath,
|
|
45
45
|
oldContents: fileContents,
|
|
46
|
-
newContents:
|
|
46
|
+
newContents: output,
|
|
47
47
|
logLevel,
|
|
48
48
|
remotionRoot,
|
|
49
49
|
logLine,
|
|
@@ -5,30 +5,53 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.subscribeToSequenceProps = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const resolve_compiled_sequence_paths_1 = require("../resolve-compiled-sequence-paths");
|
|
8
9
|
const sequence_props_watchers_1 = require("../sequence-props-watchers");
|
|
10
|
+
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
9
11
|
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
10
|
-
const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
11
|
-
var _a;
|
|
12
|
+
const subscribeToSequenceProps = async ({ input, remotionRoot, logLevel }) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var _c, _d, _e, _f;
|
|
12
15
|
// Source contents are shared only within this synchronous subscription batch.
|
|
13
16
|
const fileContentsCache = new Map();
|
|
14
17
|
const requestsByFile = new Map();
|
|
15
18
|
for (const [index, request] of input.requests.entries()) {
|
|
16
19
|
const absolutePath = node_path_1.default.resolve(remotionRoot, request.fileName);
|
|
17
|
-
const indexes = (
|
|
20
|
+
const indexes = (_c = requestsByFile.get(absolutePath)) !== null && _c !== void 0 ? _c : [];
|
|
18
21
|
indexes.push(index);
|
|
19
22
|
requestsByFile.set(absolutePath, indexes);
|
|
20
23
|
}
|
|
21
24
|
const results = [];
|
|
22
25
|
// Finish each file before moving on so large batches do not evict and
|
|
23
26
|
// repeatedly parse the same source snapshot from the bounded AST cache.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
line
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const staleFiles = new Set();
|
|
28
|
+
for (const [absolutePath, indexes] of requestsByFile) {
|
|
29
|
+
const unresolved = [];
|
|
30
|
+
const compiledTargets = [];
|
|
31
|
+
for (const index of indexes) {
|
|
32
|
+
const { line, column, nodePath } = input.requests[index];
|
|
33
|
+
if (nodePath !== null)
|
|
34
|
+
continue;
|
|
35
|
+
const hash = (_d = (_a = input.compiledSourceHashes) === null || _a === void 0 ? void 0 : _a[index]) !== null && _d !== void 0 ? _d : null;
|
|
36
|
+
if (hash === null)
|
|
37
|
+
unresolved.push({ index, line, column });
|
|
38
|
+
else
|
|
39
|
+
compiledTargets.push({ index, line, column, hash });
|
|
40
|
+
}
|
|
41
|
+
let compiledPaths = new Map();
|
|
42
|
+
if (compiledTargets.length > 0) {
|
|
43
|
+
try {
|
|
44
|
+
compiledPaths = (0, resolve_compiled_sequence_paths_1.resolveCompiledSequencePaths)({
|
|
45
|
+
fileName: input.requests[indexes[0]].fileName,
|
|
46
|
+
remotionRoot,
|
|
47
|
+
fileContentsCache,
|
|
48
|
+
targets: compiledTargets,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (_g) {
|
|
52
|
+
// An unavailable or unparsable source cannot be safely located in a newer file.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
32
55
|
const resolvedNodePaths = new Map();
|
|
33
56
|
if (unresolved.length > 0) {
|
|
34
57
|
try {
|
|
@@ -44,17 +67,22 @@ const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
69
|
}
|
|
47
|
-
catch (
|
|
70
|
+
catch (_h) {
|
|
48
71
|
// Let each subscription produce its usual not-found response.
|
|
49
72
|
}
|
|
50
73
|
}
|
|
51
74
|
for (const index of indexes) {
|
|
52
75
|
const { fileName, line, column, nodePath, componentIdentity, keys, assetKeys, effects, clientId, } = input.requests[index];
|
|
53
|
-
|
|
76
|
+
const requireExactNodePath = nodePath === null &&
|
|
77
|
+
((_e = (_b = input.compiledSourceHashes) === null || _b === void 0 ? void 0 : _b[index]) !== null && _e !== void 0 ? _e : null) !== null;
|
|
78
|
+
const result = (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
|
|
54
79
|
fileName,
|
|
55
80
|
line,
|
|
56
81
|
column,
|
|
57
|
-
nodePath
|
|
82
|
+
nodePath: requireExactNodePath
|
|
83
|
+
? ((_f = compiledPaths.get(index)) !== null && _f !== void 0 ? _f : null)
|
|
84
|
+
: nodePath,
|
|
85
|
+
requireExactNodePath,
|
|
58
86
|
resolvedNodePath: resolvedNodePaths.get(index),
|
|
59
87
|
componentIdentity,
|
|
60
88
|
keys,
|
|
@@ -65,8 +93,15 @@ const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
|
65
93
|
logLevel,
|
|
66
94
|
fileContentsCache,
|
|
67
95
|
});
|
|
96
|
+
results[index] = result;
|
|
97
|
+
if (requireExactNodePath &&
|
|
98
|
+
!result.success &&
|
|
99
|
+
result.status.reason === 'not-found') {
|
|
100
|
+
staleFiles.add(absolutePath);
|
|
101
|
+
}
|
|
68
102
|
}
|
|
69
103
|
}
|
|
70
|
-
|
|
104
|
+
await Promise.all([...staleFiles].map((file) => (0, watch_ignore_next_change_1.invalidatePreviouslySuppressedFiles)(file)));
|
|
105
|
+
return { results };
|
|
71
106
|
};
|
|
72
107
|
exports.subscribeToSequenceProps = subscribeToSequenceProps;
|
|
@@ -52,7 +52,7 @@ const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePa
|
|
|
52
52
|
(0, undo_stack_1.pushToUndoStack)({
|
|
53
53
|
filePath: absolutePath,
|
|
54
54
|
oldContents: fileContents,
|
|
55
|
-
newContents:
|
|
55
|
+
newContents: output,
|
|
56
56
|
logLevel,
|
|
57
57
|
remotionRoot,
|
|
58
58
|
logLine,
|
|
@@ -48,7 +48,7 @@ const updateSequenceKeyframeSettingsHandler = ({ input: { fileName, nodePath, ke
|
|
|
48
48
|
(0, undo_stack_1.pushToUndoStack)({
|
|
49
49
|
filePath: absolutePath,
|
|
50
50
|
oldContents: fileContents,
|
|
51
|
-
newContents:
|
|
51
|
+
newContents: output,
|
|
52
52
|
logLevel,
|
|
53
53
|
remotionRoot,
|
|
54
54
|
logLine,
|