@remotion/studio-server 4.0.506 → 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 (101) 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/effect-param-expression.js +2 -0
  6. package/dist/codemods/get-node-path-remappings.d.ts +13 -0
  7. package/dist/codemods/get-node-path-remappings.js +87 -0
  8. package/dist/codemods/reorder-sequence.d.ts +2 -1
  9. package/dist/codemods/reorder-sequence.js +8 -0
  10. package/dist/codemods/split-jsx-sequence.d.ts +2 -0
  11. package/dist/codemods/split-jsx-sequence.js +8 -0
  12. package/dist/codemods/update-keyframes/update-keyframes.js +2 -0
  13. package/dist/file-watcher.d.ts +11 -1
  14. package/dist/file-watcher.js +16 -5
  15. package/dist/helpers/coding-agent-registry.d.ts +34 -0
  16. package/dist/helpers/coding-agent-registry.js +442 -21
  17. package/dist/helpers/editor-registry.d.ts +1 -0
  18. package/dist/helpers/editor-registry.js +31 -3
  19. package/dist/helpers/finder-artwork.d.ts +1 -0
  20. package/dist/helpers/finder-artwork.js +4 -0
  21. package/dist/helpers/open-in-editor.js +5 -5
  22. package/dist/helpers/parse-keyframe-easing-expression.js +3 -0
  23. package/dist/helpers/resolve-composition-component.d.ts +2 -1
  24. package/dist/helpers/resolve-composition-component.js +60 -68
  25. package/dist/helpers/resolve-editor.d.ts +2 -0
  26. package/dist/helpers/resolve-editor.js +4 -1
  27. package/dist/helpers/terminal-artwork.d.ts +6 -0
  28. package/dist/helpers/terminal-artwork.js +14 -0
  29. package/dist/helpers/terminal-registry.d.ts +36 -0
  30. package/dist/helpers/terminal-registry.js +401 -0
  31. package/dist/index.d.ts +7 -2
  32. package/dist/preview-server/api-routes.js +7 -4
  33. package/dist/preview-server/handler.d.ts +1 -1
  34. package/dist/preview-server/live-events.d.ts +1 -0
  35. package/dist/preview-server/live-events.js +3 -1
  36. package/dist/preview-server/routes/add-effect-keyframe.js +7 -1
  37. package/dist/preview-server/routes/add-effect.js +7 -1
  38. package/dist/preview-server/routes/add-keyframes.js +10 -2
  39. package/dist/preview-server/routes/add-render.js +2 -0
  40. package/dist/preview-server/routes/add-sequence-keyframe.js +7 -1
  41. package/dist/preview-server/routes/app-icon.d.ts +6 -0
  42. package/dist/preview-server/routes/app-icon.js +66 -0
  43. package/dist/preview-server/routes/apply-codemod.js +15 -2
  44. package/dist/preview-server/routes/apply-visual-control-change.js +7 -1
  45. package/dist/preview-server/routes/batch-update-keyframe-settings.js +10 -2
  46. package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
  47. package/dist/preview-server/routes/can-update-sequence-props.js +33 -9
  48. package/dist/preview-server/routes/copy-render-output-to-asset.d.ts +3 -0
  49. package/dist/preview-server/routes/copy-render-output-to-asset.js +58 -0
  50. package/dist/preview-server/routes/default-coding-agent.d.ts +2 -6
  51. package/dist/preview-server/routes/default-coding-agent.js +19 -88
  52. package/dist/preview-server/routes/default-editor.d.ts +1 -6
  53. package/dist/preview-server/routes/default-editor.js +13 -113
  54. package/dist/preview-server/routes/delete-effect.js +7 -1
  55. package/dist/preview-server/routes/delete-jsx-node.js +16 -2
  56. package/dist/preview-server/routes/delete-keyframes.js +10 -2
  57. package/dist/preview-server/routes/duplicate-effect.js +7 -1
  58. package/dist/preview-server/routes/duplicate-jsx-node.js +17 -5
  59. package/dist/preview-server/routes/insert-element.js +23 -3
  60. package/dist/preview-server/routes/insert-jsx-element.js +17 -2
  61. package/dist/preview-server/routes/move-keyframes.js +10 -2
  62. package/dist/preview-server/routes/open-in-editor.js +1 -1
  63. package/dist/preview-server/routes/open-in-terminal.d.ts +3 -0
  64. package/dist/preview-server/routes/open-in-terminal.js +17 -0
  65. package/dist/preview-server/routes/paste-effects.js +7 -1
  66. package/dist/preview-server/routes/reorder-effect.js +7 -1
  67. package/dist/preview-server/routes/reorder-sequence.js +17 -2
  68. package/dist/preview-server/routes/save-effect-props.js +7 -1
  69. package/dist/preview-server/routes/save-multiple-effect-props.js +10 -2
  70. package/dist/preview-server/routes/save-sequence-props.js +10 -2
  71. package/dist/preview-server/routes/split-jsx-sequence.js +17 -6
  72. package/dist/preview-server/routes/update-config.d.ts +7 -0
  73. package/dist/preview-server/routes/update-config.js +193 -0
  74. package/dist/preview-server/routes/update-default-props.js +7 -1
  75. package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -1
  76. package/dist/preview-server/routes/update-sequence-keyframe-settings.js +7 -1
  77. package/dist/preview-server/sequence-node-path-mutation.d.ts +7 -0
  78. package/dist/preview-server/sequence-node-path-mutation.js +21 -0
  79. package/dist/preview-server/sequence-props-watchers.js +15 -6
  80. package/dist/preview-server/start-server.d.ts +1 -1
  81. package/dist/preview-server/studio-protocol/handle-discovery.js +3 -4
  82. package/dist/preview-server/studio-protocol/handle-install.js +1 -1
  83. package/dist/preview-server/studio-protocol/handle-license-key.js +2 -2
  84. package/dist/preview-server/studio-protocol/origin-policy.d.ts +2 -5
  85. package/dist/preview-server/studio-protocol/origin-policy.js +6 -30
  86. package/dist/preview-server/undo-stack.d.ts +7 -13
  87. package/dist/preview-server/undo-stack.js +58 -5
  88. package/dist/routes.d.ts +1 -1
  89. package/dist/routes.js +8 -1
  90. package/dist/start-studio.d.ts +1 -1
  91. package/package.json +8 -8
  92. package/web/coding-agent-icons/claude-code.png +0 -0
  93. package/web/coding-agent-icons/codex.png +0 -0
  94. package/web/coding-agent-icons/copilot.png +0 -0
  95. package/web/coding-agent-icons/cursor.png +0 -0
  96. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +0 -3
  97. package/dist/preview-server/routes/delete-effect-keyframe.js +0 -89
  98. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +0 -3
  99. package/dist/preview-server/routes/delete-sequence-keyframe.js +0 -82
  100. package/dist/preview-server/routes/save-props-mutex.d.ts +0 -1
  101. package/dist/preview-server/routes/save-props-mutex.js +0 -11
@@ -1,73 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.updateDefaultEditorHandler = exports.getDefaultEditorInfoHandler = exports.updateDefaultEditorInConfig = void 0;
37
- const node_fs_1 = require("node:fs");
38
- const renderer_1 = require("@remotion/renderer");
39
- const recast = __importStar(require("recast"));
40
- const parse_ast_1 = require("../../codemods/parse-ast");
41
- const file_watcher_1 = require("../../file-watcher");
3
+ exports.getDefaultEditorInfoHandler = void 0;
42
4
  const editor_registry_1 = require("../../helpers/editor-registry");
43
- const updateDefaultEditorInConfig = ({ configContents, defaultEditor, }) => {
44
- const ast = (0, parse_ast_1.parseAst)(configContents);
45
- recast.types.visit(ast.program, {
46
- visitExpressionStatement(path) {
47
- const { expression } = path.node;
48
- if (expression.type === 'CallExpression' &&
49
- expression.callee.type === 'MemberExpression' &&
50
- !expression.callee.computed &&
51
- expression.callee.object.type === 'Identifier' &&
52
- expression.callee.object.name === 'Config' &&
53
- expression.callee.property.type === 'Identifier' &&
54
- expression.callee.property.name === 'setDefaultEditor') {
55
- path.prune();
56
- return false;
57
- }
58
- this.traverse(path);
59
- },
60
- });
61
- const configWithoutExistingCalls = recast.print(ast, {
62
- lineTerminator: '\n',
63
- }).code;
64
- if (defaultEditor === null) {
65
- return configWithoutExistingCalls;
66
- }
67
- const separator = configWithoutExistingCalls.endsWith('\n') ? '' : '\n';
68
- return `${configWithoutExistingCalls}${separator}Config.setDefaultEditor('${defaultEditor}');\n`;
69
- };
70
- exports.updateDefaultEditorInConfig = updateDefaultEditorInConfig;
71
5
  const getDefaultEditorInfoHandler = async ({ getDefaultEditor }) => {
72
6
  const installedEditors = await (0, editor_registry_1.getAvailableEditors)();
73
7
  const configuredEditor = getDefaultEditor();
@@ -77,55 +11,21 @@ const getDefaultEditorInfoHandler = async ({ getDefaultEditor }) => {
77
11
  return {
78
12
  defaultEditor: typeof configuredEditor === 'object' ? 'custom' : configuredEditor,
79
13
  installedEditors: [
80
- ...installedEditors.map(({ id, name }) => ({ id, name })),
14
+ ...installedEditors.map(({ id, name, nameWithType }) => ({
15
+ id,
16
+ name,
17
+ nameWithType,
18
+ })),
81
19
  ...(customEditor
82
- ? [{ id: 'custom', name: customEditor.name }]
20
+ ? [
21
+ {
22
+ id: 'custom',
23
+ name: customEditor.name,
24
+ nameWithType: customEditor.name,
25
+ },
26
+ ]
83
27
  : []),
84
28
  ],
85
29
  };
86
30
  };
87
31
  exports.getDefaultEditorInfoHandler = getDefaultEditorInfoHandler;
88
- const updateDefaultEditorHandler = async ({ input, configFile, getDefaultEditor }) => {
89
- if (configFile === null || configFile === undefined) {
90
- return {
91
- success: false,
92
- reason: 'No Remotion config file was loaded.',
93
- };
94
- }
95
- if (input.defaultEditor === 'custom') {
96
- const configuredEditor = getDefaultEditor();
97
- if (!configuredEditor || typeof configuredEditor !== 'object') {
98
- return {
99
- success: false,
100
- reason: 'No custom editor is configured.',
101
- };
102
- }
103
- // The browser only knows the opaque "custom" ID. Keeping the existing
104
- // config call untouched avoids exposing or rewriting its executable and
105
- // arguments, which may have come from environment variables.
106
- return { success: true };
107
- }
108
- if (input.defaultEditor !== null &&
109
- !renderer_1.defaultEditorIds.includes(input.defaultEditor)) {
110
- return {
111
- success: false,
112
- reason: `Unknown editor: ${input.defaultEditor}`,
113
- };
114
- }
115
- if (input.defaultEditor !== null) {
116
- const installedEditors = await (0, editor_registry_1.getAvailableEditors)();
117
- if (!installedEditors.some(({ id }) => id === input.defaultEditor)) {
118
- return {
119
- success: false,
120
- reason: 'The selected editor is not installed.',
121
- };
122
- }
123
- }
124
- const configContents = (0, node_fs_1.readFileSync)(configFile, 'utf8');
125
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(configFile, (0, exports.updateDefaultEditorInConfig)({
126
- configContents,
127
- defaultEditor: input.defaultEditor,
128
- }), undefined);
129
- return { success: true };
130
- };
131
- exports.updateDefaultEditorHandler = updateDefaultEditorHandler;
@@ -76,9 +76,15 @@ const deleteEffectHandler = ({ input: effects, remotionRoot, logLevel }) => {
76
76
  },
77
77
  entryType: 'delete-effect',
78
78
  suppressHmrOnFileRestore: false,
79
+ nodePathRemappings: null,
79
80
  });
80
81
  (0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
81
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(update.absolutePath, update.output, undefined);
82
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
83
+ file: update.absolutePath,
84
+ content: update.output,
85
+ originatorClientId: undefined,
86
+ metadata: null,
87
+ });
82
88
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
83
89
  remotionRoot,
84
90
  absolutePath: update.absolutePath,
@@ -7,6 +7,7 @@ const delete_jsx_node_1 = require("../../codemods/delete-jsx-node");
7
7
  const file_watcher_1 = require("../../file-watcher");
8
8
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
9
9
  const format_log_file_location_1 = require("../format-log-file-location");
10
+ 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");
@@ -37,7 +38,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
37
38
  action: 'modify',
38
39
  });
39
40
  const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
40
- const { output, formatted, nodeLabels, logLines } = await (0, delete_jsx_node_1.deleteJsxNodes)({
41
+ const { output, formatted, nodeLabels, logLines, nodePathRemappings } = await (0, delete_jsx_node_1.deleteJsxNodes)({
41
42
  input: fileContents,
42
43
  nodePaths: fileItems.map((item) => item.nodePath),
43
44
  });
@@ -48,9 +49,15 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
48
49
  output,
49
50
  formatted,
50
51
  nodeLabels,
52
+ nodePathRemappings,
51
53
  logLine: Math.min(...logLines),
52
54
  };
53
55
  }));
56
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
57
+ absolutePath: update.absolutePath,
58
+ remappings: update.nodePathRemappings,
59
+ restoredNodePaths: [],
60
+ })));
54
61
  for (const update of updates) {
55
62
  const deletedNodeDescription = getDeletedNodeDescription(update.nodeLabels);
56
63
  (0, undo_stack_1.pushToUndoStack)({
@@ -66,9 +73,15 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
66
73
  },
67
74
  entryType: 'delete-jsx-node',
68
75
  suppressHmrOnFileRestore: false,
76
+ nodePathRemappings: update.nodePathRemappings,
69
77
  });
70
78
  (0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
71
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(update.absolutePath, update.output, undefined);
79
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
80
+ file: update.absolutePath,
81
+ content: update.output,
82
+ originatorClientId: undefined,
83
+ metadata: { skipSequencePropsUpdate: true },
84
+ });
72
85
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
73
86
  remotionRoot,
74
87
  absolutePath: update.absolutePath,
@@ -83,6 +96,7 @@ const deleteJsxNodeHandler = ({ input: { nodes }, remotionRoot, logLevel }) => {
83
96
  (0, undo_stack_1.printUndoHint)(logLevel);
84
97
  return {
85
98
  success: true,
99
+ nodePathMutation,
86
100
  };
87
101
  }
88
102
  catch (err) {
@@ -173,7 +173,10 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
173
173
  throw new Error('No keyframes were specified for deletion');
174
174
  }
175
175
  (0, undo_stack_1.pushTransactionToUndoStack)({
176
- snapshots,
176
+ snapshots: snapshots.map((snapshot) => ({
177
+ ...snapshot,
178
+ nodePathRemappings: null,
179
+ })),
177
180
  logLevel,
178
181
  remotionRoot,
179
182
  description: getBatchDescription({ totalKeyframes, firstKeyframe }),
@@ -187,7 +190,12 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
187
190
  for (const snapshot of snapshots) {
188
191
  (0, undo_stack_1.suppressUndoStackInvalidation)(snapshot.filePath);
189
192
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
190
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(snapshot.filePath, snapshot.newContents, clientId);
193
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
194
+ file: snapshot.filePath,
195
+ content: snapshot.newContents,
196
+ originatorClientId: clientId,
197
+ metadata: null,
198
+ });
191
199
  }
192
200
  for (const log of sequenceLogs) {
193
201
  (0, log_update_1.logUpdate)({
@@ -70,9 +70,15 @@ const duplicateEffectHandler = ({ input: effects, remotionRoot, logLevel }) => {
70
70
  },
71
71
  entryType: 'duplicate-effect',
72
72
  suppressHmrOnFileRestore: false,
73
+ nodePathRemappings: null,
73
74
  });
74
75
  (0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
75
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(update.absolutePath, update.output, undefined);
76
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
77
+ file: update.absolutePath,
78
+ content: update.output,
79
+ originatorClientId: undefined,
80
+ metadata: null,
81
+ });
76
82
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
77
83
  remotionRoot,
78
84
  absolutePath: update.absolutePath,
@@ -7,6 +7,7 @@ const duplicate_jsx_node_1 = require("../../codemods/duplicate-jsx-node");
7
7
  const file_watcher_1 = require("../../file-watcher");
8
8
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
9
9
  const format_log_file_location_1 = require("../format-log-file-location");
10
+ 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");
@@ -20,10 +21,14 @@ const duplicateJsxNodeHandler = ({ input: { fileName, nodePath }, remotionRoot,
20
21
  action: 'modify',
21
22
  });
22
23
  const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
23
- const { output, formatted, nodeLabel, logLine } = await (0, duplicate_jsx_node_1.duplicateJsxNode)({
24
- input: fileContents,
25
- nodePath,
26
- });
24
+ const { output, formatted, nodeLabel, logLine, nodePathRemappings } = await (0, duplicate_jsx_node_1.duplicateJsxNode)({ input: fileContents, nodePath });
25
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
26
+ {
27
+ absolutePath,
28
+ remappings: nodePathRemappings,
29
+ restoredNodePaths: [],
30
+ },
31
+ ]);
27
32
  (0, undo_stack_1.pushToUndoStack)({
28
33
  filePath: absolutePath,
29
34
  oldContents: fileContents,
@@ -37,9 +42,15 @@ const duplicateJsxNodeHandler = ({ input: { fileName, nodePath }, remotionRoot,
37
42
  },
38
43
  entryType: 'duplicate-jsx-node',
39
44
  suppressHmrOnFileRestore: false,
45
+ nodePathRemappings,
40
46
  });
41
47
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
42
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, undefined);
48
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
49
+ file: absolutePath,
50
+ content: output,
51
+ originatorClientId: undefined,
52
+ metadata: { skipSequencePropsUpdate: true },
53
+ });
43
54
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
44
55
  remotionRoot,
45
56
  absolutePath,
@@ -53,6 +64,7 @@ const duplicateJsxNodeHandler = ({ input: { fileName, nodePath }, remotionRoot,
53
64
  (0, undo_stack_1.printUndoHint)(logLevel);
54
65
  return {
55
66
  success: true,
67
+ nodePathMutation,
56
68
  };
57
69
  }
58
70
  catch (err) {
@@ -5,6 +5,7 @@ const renderer_1 = require("@remotion/renderer");
5
5
  const file_watcher_1 = require("../../file-watcher");
6
6
  const resolve_composition_component_1 = require("../../helpers/resolve-composition-component");
7
7
  const format_log_file_location_1 = require("../format-log-file-location");
8
+ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
8
9
  const undo_stack_1 = require("../undo-stack");
9
10
  const element_install_plan_1 = require("./element-install-plan");
10
11
  const log_update_1 = require("./log-updates/log-update");
@@ -126,6 +127,13 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
126
127
  })) {
127
128
  throw new Error('Element source changed during installation');
128
129
  }
130
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
131
+ {
132
+ absolutePath: inserted.fileName,
133
+ remappings: inserted.nodePathRemappings,
134
+ restoredNodePaths: [],
135
+ },
136
+ ]);
129
137
  (0, undo_stack_1.pushTransactionToUndoStack)({
130
138
  snapshots: [
131
139
  ...(shouldWriteElementFile
@@ -135,6 +143,7 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
135
143
  oldContents: plan.existingElementSource,
136
144
  newContents: element.sourceCode,
137
145
  logLine: 1,
146
+ nodePathRemappings: null,
138
147
  },
139
148
  ]
140
149
  : []),
@@ -143,6 +152,7 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
143
152
  oldContents: inserted.oldContents,
144
153
  newContents: inserted.output,
145
154
  logLine: inserted.logLine,
155
+ nodePathRemappings: inserted.nodePathRemappings,
146
156
  },
147
157
  ],
148
158
  logLevel,
@@ -159,9 +169,19 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
159
169
  }
160
170
  (0, undo_stack_1.suppressUndoStackInvalidation)(inserted.fileName);
161
171
  if (shouldWriteElementFile) {
162
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(plan.elementFileName, element.sourceCode, undefined);
172
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
173
+ file: plan.elementFileName,
174
+ content: element.sourceCode,
175
+ originatorClientId: undefined,
176
+ metadata: null,
177
+ });
163
178
  }
164
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(inserted.fileName, inserted.output, undefined);
179
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
180
+ file: inserted.fileName,
181
+ content: inserted.output,
182
+ originatorClientId: undefined,
183
+ metadata: { skipSequencePropsUpdate: true },
184
+ });
165
185
  const compositionLocationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
166
186
  remotionRoot,
167
187
  absolutePath: inserted.fileName,
@@ -183,7 +203,7 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
183
203
  (0, log_update_1.warnAboutPrettierOnce)(logLevel);
184
204
  }
185
205
  (0, undo_stack_1.printUndoHint)(logLevel);
186
- return { success: true };
206
+ return { success: true, nodePathMutation };
187
207
  }
188
208
  catch (err) {
189
209
  return {
@@ -11,6 +11,7 @@ const studio_shared_1 = require("@remotion/studio-shared");
11
11
  const file_watcher_1 = require("../../file-watcher");
12
12
  const resolve_composition_component_1 = require("../../helpers/resolve-composition-component");
13
13
  const format_log_file_location_1 = require("../format-log-file-location");
14
+ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
14
15
  const undo_stack_1 = require("../undo-stack");
15
16
  const log_update_1 = require("./log-updates/log-update");
16
17
  const source_file_write_queue_1 = require("./source-file-write-queue");
@@ -158,7 +159,7 @@ const insertJsxElementHandler = ({ input: { compositionFile, compositionId, elem
158
159
  }
159
160
  const elementLabel = getElementLabel(element);
160
161
  renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[insert-jsx-element] Received request for compositionFile="${compositionFile}" compositionId="${compositionId}" element="${element.type}"`);
161
- const { fileName, source, oldContents, output, formatted, logLine } = await (0, resolve_composition_component_1.insertJsxElementIntoComposition)({
162
+ const { fileName, source, oldContents, output, formatted, logLine, nodePathRemappings, } = await (0, resolve_composition_component_1.insertJsxElementIntoComposition)({
162
163
  remotionRoot,
163
164
  compositionFile,
164
165
  compositionId,
@@ -166,6 +167,13 @@ const insertJsxElementHandler = ({ input: { compositionFile, compositionId, elem
166
167
  from,
167
168
  prettierConfigOverride: null,
168
169
  });
170
+ const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
171
+ {
172
+ absolutePath: fileName,
173
+ remappings: nodePathRemappings,
174
+ restoredNodePaths: [],
175
+ },
176
+ ]);
169
177
  (0, undo_stack_1.pushToUndoStack)({
170
178
  filePath: fileName,
171
179
  oldContents,
@@ -179,9 +187,15 @@ const insertJsxElementHandler = ({ input: { compositionFile, compositionId, elem
179
187
  },
180
188
  entryType: 'insert-jsx-element',
181
189
  suppressHmrOnFileRestore: false,
190
+ nodePathRemappings,
182
191
  });
183
192
  (0, undo_stack_1.suppressUndoStackInvalidation)(fileName);
184
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(fileName, output, undefined);
193
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
194
+ file: fileName,
195
+ content: output,
196
+ originatorClientId: undefined,
197
+ metadata: { skipSequencePropsUpdate: true },
198
+ });
185
199
  const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
186
200
  remotionRoot,
187
201
  absolutePath: fileName,
@@ -195,6 +209,7 @@ const insertJsxElementHandler = ({ input: { compositionFile, compositionId, elem
195
209
  (0, undo_stack_1.printUndoHint)(logLevel);
196
210
  return {
197
211
  success: true,
212
+ nodePathMutation,
198
213
  };
199
214
  }
200
215
  catch (err) {
@@ -182,7 +182,10 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
182
182
  throw new Error('No keyframes were specified for moving');
183
183
  }
184
184
  (0, undo_stack_1.pushTransactionToUndoStack)({
185
- snapshots,
185
+ snapshots: snapshots.map((snapshot) => ({
186
+ ...snapshot,
187
+ nodePathRemappings: null,
188
+ })),
186
189
  logLevel,
187
190
  remotionRoot,
188
191
  description: getBatchDescription({ totalKeyframes, firstKeyframe }),
@@ -196,7 +199,12 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
196
199
  for (const snapshot of snapshots) {
197
200
  (0, undo_stack_1.suppressUndoStackInvalidation)(snapshot.filePath);
198
201
  (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
199
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(snapshot.filePath, snapshot.newContents, clientId);
202
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)({
203
+ file: snapshot.filePath,
204
+ content: snapshot.newContents,
205
+ originatorClientId: clientId,
206
+ metadata: null,
207
+ });
200
208
  }
201
209
  for (const log of sequenceLogs) {
202
210
  (0, log_update_1.logUpdate)({
@@ -16,7 +16,7 @@ const getEditorName = async ({ getDefaultEditor, logLevel, }) => {
16
16
  logLevel,
17
17
  preferredEditor: null,
18
18
  });
19
- return (_a = editor === null || editor === void 0 ? void 0 : editor.name) !== null && _a !== void 0 ? _a : null;
19
+ return (_a = editor === null || editor === void 0 ? void 0 : editor.nameWithType) !== null && _a !== void 0 ? _a : null;
20
20
  };
21
21
  exports.getEditorName = getEditorName;
22
22
  const openInEditorHandler = async ({ input, remotionRoot, logLevel, getDefaultEditor }) => {
@@ -0,0 +1,3 @@
1
+ import type { OpenInTerminalRequest, OpenInTerminalResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const openInTerminalHandler: ApiHandler<OpenInTerminalRequest, OpenInTerminalResponse>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openInTerminalHandler = void 0;
4
+ const terminal_registry_1 = require("../../helpers/terminal-registry");
5
+ const openInTerminalHandler = async ({ input, remotionRoot }) => {
6
+ const terminal = (await (0, terminal_registry_1.getAvailableTerminals)()).find(({ id }) => id === input.terminalId);
7
+ if (!terminal) {
8
+ return { success: false };
9
+ }
10
+ await (0, terminal_registry_1.launchTerminal)({
11
+ allowedDirectory: remotionRoot,
12
+ directory: input.directory,
13
+ terminal,
14
+ });
15
+ return { success: true };
16
+ };
17
+ exports.openInTerminalHandler = openInTerminalHandler;
@@ -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) {