@remotion/studio-server 4.0.507 → 4.0.508

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.
Files changed (66) hide show
  1. package/dist/codemods/delete-jsx-node.d.ts +4 -0
  2. package/dist/codemods/delete-jsx-node.js +8 -0
  3. package/dist/codemods/duplicate-jsx-node.d.ts +2 -0
  4. package/dist/codemods/duplicate-jsx-node.js +8 -0
  5. package/dist/codemods/get-node-path-remappings.d.ts +13 -0
  6. package/dist/codemods/get-node-path-remappings.js +87 -0
  7. package/dist/codemods/reorder-sequence.d.ts +2 -1
  8. package/dist/codemods/reorder-sequence.js +8 -0
  9. package/dist/codemods/split-jsx-sequence.d.ts +2 -0
  10. package/dist/codemods/split-jsx-sequence.js +8 -0
  11. package/dist/file-watcher.d.ts +11 -1
  12. package/dist/file-watcher.js +16 -5
  13. package/dist/helpers/coding-agent-registry.d.ts +0 -1
  14. package/dist/helpers/coding-agent-registry.js +1 -5
  15. package/dist/helpers/finder-artwork.d.ts +1 -0
  16. package/dist/helpers/finder-artwork.js +4 -0
  17. package/dist/helpers/resolve-composition-component.d.ts +2 -1
  18. package/dist/helpers/resolve-composition-component.js +60 -68
  19. package/dist/helpers/terminal-artwork.d.ts +6 -0
  20. package/dist/helpers/terminal-artwork.js +14 -0
  21. package/dist/helpers/terminal-registry.d.ts +36 -0
  22. package/dist/helpers/terminal-registry.js +401 -0
  23. package/dist/index.d.ts +6 -1
  24. package/dist/preview-server/api-routes.js +2 -0
  25. package/dist/preview-server/live-events.d.ts +1 -0
  26. package/dist/preview-server/live-events.js +3 -1
  27. package/dist/preview-server/routes/add-effect-keyframe.js +7 -1
  28. package/dist/preview-server/routes/add-effect.js +7 -1
  29. package/dist/preview-server/routes/add-keyframes.js +10 -2
  30. package/dist/preview-server/routes/add-sequence-keyframe.js +7 -1
  31. package/dist/preview-server/routes/app-icon.d.ts +6 -0
  32. package/dist/preview-server/routes/app-icon.js +66 -0
  33. package/dist/preview-server/routes/apply-codemod.js +15 -2
  34. package/dist/preview-server/routes/apply-visual-control-change.js +7 -1
  35. package/dist/preview-server/routes/batch-update-keyframe-settings.js +10 -2
  36. package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
  37. package/dist/preview-server/routes/can-update-sequence-props.js +5 -4
  38. package/dist/preview-server/routes/default-coding-agent.js +4 -2
  39. package/dist/preview-server/routes/delete-effect.js +7 -1
  40. package/dist/preview-server/routes/delete-jsx-node.js +16 -2
  41. package/dist/preview-server/routes/delete-keyframes.js +10 -2
  42. package/dist/preview-server/routes/duplicate-effect.js +7 -1
  43. package/dist/preview-server/routes/duplicate-jsx-node.js +17 -5
  44. package/dist/preview-server/routes/insert-element.js +23 -3
  45. package/dist/preview-server/routes/insert-jsx-element.js +17 -2
  46. package/dist/preview-server/routes/move-keyframes.js +10 -2
  47. package/dist/preview-server/routes/open-in-terminal.d.ts +3 -0
  48. package/dist/preview-server/routes/open-in-terminal.js +17 -0
  49. package/dist/preview-server/routes/paste-effects.js +7 -1
  50. package/dist/preview-server/routes/reorder-effect.js +7 -1
  51. package/dist/preview-server/routes/reorder-sequence.js +17 -2
  52. package/dist/preview-server/routes/save-effect-props.js +7 -1
  53. package/dist/preview-server/routes/save-multiple-effect-props.js +10 -2
  54. package/dist/preview-server/routes/save-sequence-props.js +10 -2
  55. package/dist/preview-server/routes/split-jsx-sequence.js +17 -6
  56. package/dist/preview-server/routes/update-config.js +6 -1
  57. package/dist/preview-server/routes/update-default-props.js +7 -1
  58. package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -1
  59. package/dist/preview-server/routes/update-sequence-keyframe-settings.js +7 -1
  60. package/dist/preview-server/sequence-node-path-mutation.d.ts +7 -0
  61. package/dist/preview-server/sequence-node-path-mutation.js +21 -0
  62. package/dist/preview-server/sequence-props-watchers.js +15 -6
  63. package/dist/preview-server/undo-stack.d.ts +7 -13
  64. package/dist/preview-server/undo-stack.js +58 -5
  65. package/dist/routes.js +8 -0
  66. package/package.json +8 -8
@@ -52,9 +52,15 @@ const pasteEffectsHandler = ({ input: { targetFileName, targetSequenceNodePath,
52
52
  },
53
53
  entryType: 'paste-effects',
54
54
  suppressHmrOnFileRestore: false,
55
+ nodePathRemappings: null,
55
56
  });
56
57
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
57
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
58
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
59
+ file: absolutePath,
60
+ content: output,
61
+ originatorClientId: clientId,
62
+ metadata: null,
63
+ });
58
64
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
59
65
  remotionRoot,
60
66
  absolutePath,
@@ -40,9 +40,15 @@ const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex,
40
40
  },
41
41
  entryType: 'reorder-effect',
42
42
  suppressHmrOnFileRestore: false,
43
+ nodePathRemappings: null,
43
44
  });
44
45
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
45
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
46
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
47
+ file: absolutePath,
48
+ content: output,
49
+ originatorClientId: clientId,
50
+ metadata: null,
51
+ });
46
52
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
47
53
  remotionRoot,
48
54
  absolutePath,
@@ -7,6 +7,7 @@ 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
+ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
10
11
  const undo_stack_1 = require("../undo-stack");
11
12
  const formatting_1 = require("./log-updates/formatting");
12
13
  const log_update_1 = require("./log-updates/log-update");
@@ -21,12 +22,19 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
21
22
  action: 'modify',
22
23
  });
23
24
  const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
24
- const { output, formatted, sequenceLabel, logLine } = await (0, reorder_sequence_1.reorderSequence)({
25
+ const { output, formatted, sequenceLabel, logLine, nodePathRemappings } = await (0, reorder_sequence_1.reorderSequence)({
25
26
  input: fileContents,
26
27
  sourceNodePath: sourceNodePath.nodePath,
27
28
  targetNodePath: targetNodePath.nodePath,
28
29
  position,
29
30
  });
31
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
32
+ {
33
+ absolutePath,
34
+ remappings: nodePathRemappings,
35
+ restoredNodePaths: [],
36
+ },
37
+ ]);
30
38
  (0, undo_stack_1.pushToUndoStack)({
31
39
  filePath: absolutePath,
32
40
  oldContents: fileContents,
@@ -40,9 +48,15 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
40
48
  },
41
49
  entryType: 'reorder-sequence',
42
50
  suppressHmrOnFileRestore: false,
51
+ nodePathRemappings,
43
52
  });
44
53
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
45
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
54
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
55
+ file: absolutePath,
56
+ content: output,
57
+ originatorClientId: clientId,
58
+ metadata: { skipSequencePropsUpdate: true },
59
+ });
46
60
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
47
61
  remotionRoot,
48
62
  absolutePath,
@@ -56,6 +70,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
56
70
  (0, undo_stack_1.printUndoHint)(logLevel);
57
71
  return {
58
72
  success: true,
73
+ nodePathMutation,
59
74
  };
60
75
  }
61
76
  catch (err) {
@@ -91,10 +91,16 @@ const saveEffectPropsHandler = ({ input, remotionRoot, logLevel }) => (0, source
91
91
  },
92
92
  entryType: 'effect-props',
93
93
  suppressHmrOnFileRestore: true,
94
+ nodePathRemappings: null,
94
95
  });
95
96
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
96
97
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
97
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
98
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
99
+ file: absolutePath,
100
+ content: output,
101
+ originatorClientId: clientId,
102
+ metadata: null,
103
+ });
98
104
  (0, log_effect_update_1.logEffectUpdate)({
99
105
  fileRelativeToRoot,
100
106
  line: logLine,
@@ -87,7 +87,10 @@ const saveMultipleEffectPropsHandler = ({ input: { edits, clientId, undoLabel, r
87
87
  });
88
88
  }
89
89
  (0, undo_stack_1.pushTransactionToUndoStack)({
90
- snapshots,
90
+ snapshots: snapshots.map((snapshot) => ({
91
+ ...snapshot,
92
+ nodePathRemappings: null,
93
+ })),
91
94
  logLevel,
92
95
  remotionRoot,
93
96
  description: {
@@ -100,7 +103,12 @@ const saveMultipleEffectPropsHandler = ({ input: { edits, clientId, undoLabel, r
100
103
  for (const [absolutePath, output] of outputByPath) {
101
104
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
102
105
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
103
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
106
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
107
+ file: absolutePath,
108
+ content: output,
109
+ originatorClientId: clientId,
110
+ metadata: null,
111
+ });
104
112
  }
105
113
  for (const index of edits.keys()) {
106
114
  const result = resultByIndex.get(index);
@@ -363,7 +363,10 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
363
363
  const suppressHmr = captionPatches.length === 0 &&
364
364
  (0, exports.shouldSuppressHmrForSequencePropEdits)(edits);
365
365
  (0, undo_stack_1.pushTransactionToUndoStack)({
366
- snapshots,
366
+ snapshots: snapshots.map((snapshot) => ({
367
+ ...snapshot,
368
+ nodePathRemappings: null,
369
+ })),
367
370
  logLevel,
368
371
  remotionRoot,
369
372
  description: { undoMessage, redoMessage },
@@ -375,7 +378,12 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
375
378
  if (suppressHmr) {
376
379
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
377
380
  }
378
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
381
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
382
+ file: absolutePath,
383
+ content: output,
384
+ originatorClientId: clientId,
385
+ metadata: null,
386
+ });
379
387
  }
380
388
  for (const { edits: groupEdits, fileRelativeToRoot } of editGroups.values()) {
381
389
  for (const edit of groupEdits) {
@@ -7,6 +7,7 @@ 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
+ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
10
11
  const undo_stack_1 = require("../undo-stack");
11
12
  const log_update_1 = require("./log-updates/log-update");
12
13
  const source_file_write_queue_1 = require("./source-file-write-queue");
@@ -19,11 +20,14 @@ const splitJsxSequenceHandler = ({ input: { fileName, nodePath, splitFrame }, re
19
20
  action: 'modify',
20
21
  });
21
22
  const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
22
- const { output, formatted, nodeLabel, logLine } = await (0, split_jsx_sequence_1.splitJsxSequence)({
23
- input: fileContents,
24
- nodePath,
25
- splitFrame,
26
- });
23
+ const { output, formatted, nodeLabel, logLine, nodePathRemappings } = await (0, split_jsx_sequence_1.splitJsxSequence)({ input: fileContents, nodePath, splitFrame });
24
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
25
+ {
26
+ absolutePath,
27
+ remappings: nodePathRemappings,
28
+ restoredNodePaths: [],
29
+ },
30
+ ]);
27
31
  (0, undo_stack_1.pushToUndoStack)({
28
32
  filePath: absolutePath,
29
33
  oldContents: fileContents,
@@ -37,9 +41,15 @@ const splitJsxSequenceHandler = ({ input: { fileName, nodePath, splitFrame }, re
37
41
  },
38
42
  entryType: 'split-jsx-sequence',
39
43
  suppressHmrOnFileRestore: false,
44
+ nodePathRemappings,
40
45
  });
41
46
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
42
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, undefined);
47
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
48
+ file: absolutePath,
49
+ content: output,
50
+ originatorClientId: undefined,
51
+ metadata: { skipSequencePropsUpdate: true },
52
+ });
43
53
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
44
54
  remotionRoot,
45
55
  absolutePath,
@@ -53,6 +63,7 @@ const splitJsxSequenceHandler = ({ input: { fileName, nodePath, splitFrame }, re
53
63
  (0, undo_stack_1.printUndoHint)(logLevel);
54
64
  return {
55
65
  success: true,
66
+ nodePathMutation,
56
67
  };
57
68
  }
58
69
  catch (err) {
@@ -182,7 +182,12 @@ const updateConfigHandler = async ({ input, configFile }) => {
182
182
  }
183
183
  }
184
184
  const configContents = (0, node_fs_1.readFileSync)(configFile, 'utf8');
185
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(configFile, (0, exports.updateConfigFile)({ configContents, updates: input.updates }), input.clientId);
185
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
186
+ file: configFile,
187
+ content: (0, exports.updateConfigFile)({ configContents, updates: input.updates }),
188
+ originatorClientId: input.clientId,
189
+ metadata: null,
190
+ });
186
191
  return { success: true };
187
192
  };
188
193
  exports.updateConfigHandler = updateConfigHandler;
@@ -45,10 +45,16 @@ const updateDefaultPropsHandler = ({ input: { compositionId, defaultProps, enumP
45
45
  },
46
46
  entryType: 'default-props',
47
47
  suppressHmrOnFileRestore: true,
48
+ nodePathRemappings: null,
48
49
  });
49
50
  (0, undo_stack_1.suppressUndoStackInvalidation)(projectInfo.rootFile);
50
51
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(projectInfo.rootFile);
51
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(projectInfo.rootFile, output, undefined);
52
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
53
+ file: projectInfo.rootFile,
54
+ content: output,
55
+ originatorClientId: undefined,
56
+ metadata: null,
57
+ });
52
58
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
53
59
  remotionRoot,
54
60
  absolutePath: projectInfo.rootFile,
@@ -62,10 +62,16 @@ const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePa
62
62
  },
63
63
  entryType: 'effect-props',
64
64
  suppressHmrOnFileRestore: true,
65
+ nodePathRemappings: null,
65
66
  });
66
67
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
67
68
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
68
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
69
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
70
+ file: absolutePath,
71
+ content: output,
72
+ originatorClientId: clientId,
73
+ metadata: null,
74
+ });
69
75
  (0, log_effect_update_1.logEffectUpdate)({
70
76
  fileRelativeToRoot,
71
77
  line: logLine,
@@ -58,10 +58,16 @@ const updateSequenceKeyframeSettingsHandler = ({ input: { fileName, nodePath, ke
58
58
  },
59
59
  entryType: 'sequence-props',
60
60
  suppressHmrOnFileRestore: true,
61
+ nodePathRemappings: null,
61
62
  });
62
63
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
63
64
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
64
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
65
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
66
+ file: absolutePath,
67
+ content: output,
68
+ originatorClientId: clientId,
69
+ metadata: null,
70
+ });
65
71
  (0, log_update_1.logUpdate)({
66
72
  fileRelativeToRoot,
67
73
  line: logLine,
@@ -0,0 +1,7 @@
1
+ import type { SequenceNodePathMutation, SequenceNodePathRemapping } from '@remotion/studio-shared';
2
+ import type { SequenceNodePath } from 'remotion';
3
+ export declare const broadcastSequenceNodePathMutation: (files: {
4
+ absolutePath: string;
5
+ remappings: SequenceNodePathRemapping[];
6
+ restoredNodePaths: SequenceNodePath[];
7
+ }[]) => SequenceNodePathMutation;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.broadcastSequenceNodePathMutation = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const live_events_1 = require("./live-events");
6
+ const mutationSessionId = (0, node_crypto_1.randomUUID)();
7
+ let mutationCounter = 0;
8
+ const broadcastSequenceNodePathMutation = (files) => {
9
+ var _a;
10
+ mutationCounter++;
11
+ const mutation = {
12
+ mutationId: `${mutationSessionId}:${mutationCounter}`,
13
+ files,
14
+ };
15
+ (_a = (0, live_events_1.getLiveEventsListener)()) === null || _a === void 0 ? void 0 : _a.sendEventToClient({
16
+ type: 'sequence-node-paths-remapped',
17
+ mutation,
18
+ });
19
+ return mutation;
20
+ };
21
+ exports.broadcastSequenceNodePathMutation = broadcastSequenceNodePathMutation;
@@ -122,11 +122,16 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: pr
122
122
  (0, node_path_cache_1.setCachedNodePath)(fileName, line, column, initialResult.nodePath.nodePath);
123
123
  const { nodePath } = initialResult;
124
124
  const watcherKey = getWatcherKey(nodePath, assetKeys);
125
- // If a watcher already exists for this key, just bump the ref count
126
- if ((_a = sequencePropsWatchers[clientId]) === null || _a === void 0 ? void 0 : _a[watcherKey]) {
127
- sequencePropsWatchers[clientId][watcherKey].refCount++;
125
+ const existingWatcher = (_a = sequencePropsWatchers[clientId]) === null || _a === void 0 ? void 0 : _a[watcherKey];
126
+ if (existingWatcher) {
127
+ existingWatcher.refCount++;
128
128
  return initialResult;
129
129
  }
130
+ const watcherInfo = {
131
+ unwatch: () => undefined,
132
+ refCount: 1,
133
+ currentNodePath: nodePath,
134
+ };
130
135
  const { unwatch } = (0, file_watcher_1.installFileWatcher)({
131
136
  file: absolutePath,
132
137
  existenceOnly: false,
@@ -137,10 +142,13 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: pr
137
142
  if (event.originatorClientId === clientId) {
138
143
  return;
139
144
  }
145
+ if (event.type === 'changed' && event.skipSequencePropsUpdate) {
146
+ return;
147
+ }
140
148
  try {
141
149
  const result = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
142
150
  fileContents: event.content,
143
- nodePath: nodePath.nodePath,
151
+ nodePath: watcherInfo.currentNodePath.nodePath,
144
152
  componentIdentity,
145
153
  keys,
146
154
  assetKeys,
@@ -158,7 +166,7 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: pr
158
166
  listener.sendEventToClientId(clientId, {
159
167
  type: 'sequence-props-updated',
160
168
  fileName,
161
- nodePath,
169
+ nodePath: watcherInfo.currentNodePath,
162
170
  result,
163
171
  });
164
172
  });
@@ -180,10 +188,11 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: pr
180
188
  }
181
189
  },
182
190
  });
191
+ watcherInfo.unwatch = unwatch;
183
192
  if (!sequencePropsWatchers[clientId]) {
184
193
  sequencePropsWatchers[clientId] = {};
185
194
  }
186
- sequencePropsWatchers[clientId][watcherKey] = { unwatch, refCount: 1 };
195
+ sequencePropsWatchers[clientId][watcherKey] = watcherInfo;
187
196
  return initialResult;
188
197
  };
189
198
  exports.subscribeToSequencePropsWatchers = subscribeToSequencePropsWatchers;
@@ -1,4 +1,5 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
+ import type { RedoResponse, SequenceNodePathRemapping, UndoResponse } from '@remotion/studio-shared';
2
3
  export interface UndoEntryDescription {
3
4
  undoMessage: string;
4
5
  redoMessage: string;
@@ -10,6 +11,7 @@ type UndoEntrySnapshot = {
10
11
  newContents: string | null;
11
12
  /** 1-based source line for terminal/IDE file links (e.g. path:line). */
12
13
  logLine: number;
14
+ nodePathRemappings: SequenceNodePathRemapping[] | null;
13
15
  };
14
16
  type UndoEntry = {
15
17
  filePath: string;
@@ -70,7 +72,7 @@ type UndoEntry = {
70
72
  } | {
71
73
  entryType: 'rename-folder';
72
74
  });
73
- export declare function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore }: {
75
+ export declare function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore, nodePathRemappings }: {
74
76
  filePath: string;
75
77
  oldContents: string;
76
78
  newContents: string | null;
@@ -80,6 +82,7 @@ export declare function pushToUndoStack({ filePath, oldContents, newContents, lo
80
82
  description: UndoEntryDescription;
81
83
  entryType: UndoEntryType;
82
84
  suppressHmrOnFileRestore: boolean;
85
+ nodePathRemappings: SequenceNodePathRemapping[] | null;
83
86
  }): void;
84
87
  export declare function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore }: {
85
88
  snapshots: Array<{
@@ -87,6 +90,7 @@ export declare function pushTransactionToUndoStack({ snapshots, logLevel, remoti
87
90
  oldContents: string | null;
88
91
  newContents: string | null;
89
92
  logLine: number;
93
+ nodePathRemappings: SequenceNodePathRemapping[] | null;
90
94
  }>;
91
95
  logLevel: LogLevel;
92
96
  remotionRoot: string;
@@ -105,18 +109,8 @@ export declare function pushToRedoStack({ filePath, oldContents, newContents, lo
105
109
  suppressHmrOnFileRestore: boolean;
106
110
  }): void;
107
111
  export declare function suppressUndoStackInvalidation(filePath: string): void;
108
- export declare function popUndo(): {
109
- success: true;
110
- } | {
111
- success: false;
112
- reason: string;
113
- };
114
- export declare function popRedo(): {
115
- success: true;
116
- } | {
117
- success: false;
118
- reason: string;
119
- };
112
+ export declare function popUndo(): UndoResponse;
113
+ export declare function popRedo(): RedoResponse;
120
114
  export declare function getUndoStack(): readonly UndoEntry[];
121
115
  export declare function getRedoStack(): readonly UndoEntry[];
122
116
  export declare function clearUndoStackForTests(): void;
@@ -17,6 +17,7 @@ const read_visual_control_values_1 = require("../codemods/read-visual-control-va
17
17
  const file_watcher_1 = require("../file-watcher");
18
18
  const format_log_file_location_1 = require("./format-log-file-location");
19
19
  const live_events_1 = require("./live-events");
20
+ const sequence_node_path_mutation_1 = require("./sequence-node-path-mutation");
20
21
  const watch_ignore_next_change_1 = require("./watch-ignore-next-change");
21
22
  const MAX_ENTRIES = 100;
22
23
  const undoStack = [];
@@ -56,7 +57,7 @@ const makeUndoEntry = ({ snapshots, description, entryType, suppressHmrOnFileRes
56
57
  suppressHmrOnFileRestore,
57
58
  };
58
59
  };
59
- function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore, }) {
60
+ function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore, nodePathRemappings, }) {
60
61
  pushTransactionToUndoStack({
61
62
  snapshots: [
62
63
  {
@@ -64,6 +65,7 @@ function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotio
64
65
  oldContents,
65
66
  newContents,
66
67
  logLine,
68
+ nodePathRemappings,
67
69
  },
68
70
  ],
69
71
  logLevel,
@@ -108,6 +110,7 @@ function pushToRedoStack({ filePath, oldContents, newContents, logLine, descript
108
110
  oldContents,
109
111
  newContents,
110
112
  logLine,
113
+ nodePathRemappings: null,
111
114
  },
112
115
  ],
113
116
  description,
@@ -247,6 +250,29 @@ function popUndo() {
247
250
  if (redoStack.length > MAX_ENTRIES) {
248
251
  redoStack.shift();
249
252
  }
253
+ const files = entry.snapshots.flatMap((snapshot) => {
254
+ if (snapshot.nodePathRemappings === null) {
255
+ return [];
256
+ }
257
+ return [
258
+ {
259
+ absolutePath: snapshot.filePath,
260
+ remappings: snapshot.nodePathRemappings.flatMap((remapping) => {
261
+ if (remapping.newNodePath === null) {
262
+ return [];
263
+ }
264
+ return [
265
+ {
266
+ oldNodePath: remapping.newNodePath,
267
+ newNodePath: remapping.oldNodePath,
268
+ },
269
+ ];
270
+ }),
271
+ restoredNodePaths: snapshot.nodePathRemappings.flatMap((remapping) => remapping.newNodePath === null ? [remapping.oldNodePath] : []),
272
+ },
273
+ ];
274
+ });
275
+ const nodePathMutation = files.length === 0 ? null : (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(files);
250
276
  for (const snapshot of entry.snapshots) {
251
277
  suppressUndoStackInvalidation(snapshot.filePath);
252
278
  if (entry.suppressHmrOnFileRestore) {
@@ -256,7 +282,14 @@ function popUndo() {
256
282
  (0, node_fs_1.rmSync)(snapshot.filePath, { force: true });
257
283
  }
258
284
  else {
259
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(snapshot.filePath, snapshot.oldContents, undefined);
285
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
286
+ file: snapshot.filePath,
287
+ content: snapshot.oldContents,
288
+ originatorClientId: undefined,
289
+ metadata: snapshot.nodePathRemappings === null
290
+ ? null
291
+ : { skipSequencePropsUpdate: true },
292
+ });
260
293
  }
261
294
  }
262
295
  renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Undo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
@@ -272,7 +305,7 @@ function popUndo() {
272
305
  ensureWatching(filePath);
273
306
  }
274
307
  broadcastState();
275
- return { success: true };
308
+ return { success: true, nodePathMutation };
276
309
  }
277
310
  function popRedo() {
278
311
  const entry = redoStack.pop();
@@ -298,12 +331,32 @@ function popRedo() {
298
331
  if (undoStack.length > MAX_ENTRIES) {
299
332
  undoStack.shift();
300
333
  }
334
+ const files = snapshotsWithNewContents.flatMap((snapshot) => {
335
+ if (snapshot.nodePathRemappings === null) {
336
+ return [];
337
+ }
338
+ return [
339
+ {
340
+ absolutePath: snapshot.filePath,
341
+ remappings: snapshot.nodePathRemappings,
342
+ restoredNodePaths: [],
343
+ },
344
+ ];
345
+ });
346
+ const nodePathMutation = files.length === 0 ? null : (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(files);
301
347
  for (const snapshot of snapshotsWithNewContents) {
302
348
  suppressUndoStackInvalidation(snapshot.filePath);
303
349
  if (entry.suppressHmrOnFileRestore) {
304
350
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
305
351
  }
306
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(snapshot.filePath, snapshot.newContents, undefined);
352
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
353
+ file: snapshot.filePath,
354
+ content: snapshot.newContents,
355
+ originatorClientId: undefined,
356
+ metadata: snapshot.nodePathRemappings === null
357
+ ? null
358
+ : { skipSequencePropsUpdate: true },
359
+ });
307
360
  }
308
361
  renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Redo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
309
362
  logFileAction(entry.description.redoMessage, entry.filePath, entry.logLine);
@@ -318,7 +371,7 @@ function popRedo() {
318
371
  ensureWatching(filePath);
319
372
  }
320
373
  broadcastState();
321
- return { success: true };
374
+ return { success: true, nodePathMutation };
322
375
  }
323
376
  /*
324
377
  * Keep stack accessors typed as readonly arrays so callers can only inspect
package/dist/routes.js CHANGED
@@ -51,6 +51,7 @@ const get_package_manager_1 = require("./preview-server/get-package-manager");
51
51
  const get_static_file_fallback_hint_1 = require("./preview-server/get-static-file-fallback-hint");
52
52
  const handler_1 = require("./preview-server/handler");
53
53
  const public_folder_1 = require("./preview-server/public-folder");
54
+ const app_icon_1 = require("./preview-server/routes/app-icon");
54
55
  const open_in_editor_1 = require("./preview-server/routes/open-in-editor");
55
56
  const serve_static_1 = require("./preview-server/serve-static");
56
57
  const handle_discovery_1 = require("./preview-server/studio-protocol/handle-discovery");
@@ -279,6 +280,13 @@ const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPref
279
280
  remotionRoot,
280
281
  });
281
282
  }
283
+ if (url.pathname.startsWith('/api/app-icon/')) {
284
+ return (0, app_icon_1.handleAppIcon)({
285
+ pathname: url.pathname,
286
+ request,
287
+ response,
288
+ });
289
+ }
282
290
  if (url.pathname === '/api/studio-protocol' ||
283
291
  url.pathname === '/api/studio-protocol/install' ||
284
292
  url.pathname === '/api/studio-protocol/license-key') {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
4
4
  },
5
5
  "name": "@remotion/studio-server",
6
- "version": "4.0.507",
6
+ "version": "4.0.508",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@remotion/studio-protocol": "4.0.507",
26
+ "@remotion/studio-protocol": "4.0.508",
27
27
  "@babel/types": "7.24.0",
28
28
  "@babel/parser": "7.24.1",
29
29
  "@svgr/core": "8.1.0",
@@ -32,12 +32,12 @@
32
32
  "semver": "7.5.3",
33
33
  "zod": "4.4.3",
34
34
  "prettier": "3.8.1",
35
- "remotion": "4.0.507",
35
+ "remotion": "4.0.508",
36
36
  "recast": "0.23.11",
37
- "@remotion/bundler": "4.0.507",
38
- "@remotion/renderer": "4.0.507",
39
- "@remotion/studio-codemods": "4.0.507",
40
- "@remotion/studio-shared": "4.0.507",
37
+ "@remotion/bundler": "4.0.508",
38
+ "@remotion/renderer": "4.0.508",
39
+ "@remotion/studio-codemods": "4.0.508",
40
+ "@remotion/studio-shared": "4.0.508",
41
41
  "memfs": "3.4.3",
42
42
  "open": "8.4.2"
43
43
  },
@@ -45,7 +45,7 @@
45
45
  "ast-types": "0.16.1",
46
46
  "react": "19.2.3",
47
47
  "@types/semver": "7.5.3",
48
- "@remotion/eslint-config-internal": "4.0.507",
48
+ "@remotion/eslint-config-internal": "4.0.508",
49
49
  "eslint": "9.19.0",
50
50
  "@types/node": "20.12.14",
51
51
  "@typescript/native-preview": "7.0.0-dev.20260217.1"