@remotion/studio-server 4.0.469 → 4.0.471
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/add-effect.d.ts +15 -0
- package/dist/codemods/add-effect.js +231 -0
- package/dist/codemods/delete-effect.d.ts +18 -0
- package/dist/codemods/delete-effect.js +95 -21
- package/dist/codemods/delete-jsx-node.d.ts +10 -0
- package/dist/codemods/delete-jsx-node.js +38 -14
- package/dist/codemods/reorder-effect.d.ts +13 -0
- package/dist/codemods/reorder-effect.js +61 -0
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +4 -0
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +152 -0
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +12 -0
- package/dist/codemods/update-keyframes/update-keyframes.js +116 -31
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +32 -10
- package/dist/codemods/update-sequence-props/update-sequence-props.js +39 -7
- package/dist/helpers/open-in-editor.d.ts +2 -2
- package/dist/helpers/open-in-editor.js +35 -2
- package/dist/helpers/resolve-composition-component.d.ts +15 -0
- package/dist/helpers/resolve-composition-component.js +269 -31
- package/dist/index.d.ts +2 -1
- package/dist/preview-server/api-routes.js +20 -0
- package/dist/preview-server/routes/add-effect-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/add-effect-keyframe.js +91 -0
- package/dist/preview-server/routes/add-effect.d.ts +3 -0
- package/dist/preview-server/routes/add-effect.js +68 -0
- package/dist/preview-server/routes/add-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/add-sequence-keyframe.js +87 -0
- package/dist/preview-server/routes/apply-codemod.js +1 -0
- package/dist/preview-server/routes/apply-visual-control-change.js +1 -0
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
- package/dist/preview-server/routes/can-update-sequence-props.js +48 -14
- package/dist/preview-server/routes/composition-component-info.d.ts +3 -0
- package/dist/preview-server/routes/composition-component-info.js +26 -0
- package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
- package/dist/preview-server/routes/delete-effect.js +76 -37
- package/dist/preview-server/routes/delete-jsx-node.js +67 -36
- package/dist/preview-server/routes/delete-keyframes.d.ts +13 -0
- package/dist/preview-server/routes/delete-keyframes.js +263 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
- package/dist/preview-server/routes/duplicate-jsx-node.js +1 -0
- package/dist/preview-server/routes/insert-jsx-element.d.ts +3 -0
- package/dist/preview-server/routes/insert-jsx-element.js +79 -0
- package/dist/preview-server/routes/open-in-editor.d.ts +4 -0
- package/dist/preview-server/routes/open-in-editor.js +40 -0
- package/dist/preview-server/routes/register-client-render.d.ts +3 -0
- package/dist/preview-server/routes/register-client-render.js +11 -0
- package/dist/preview-server/routes/reorder-effect.d.ts +3 -0
- package/dist/preview-server/routes/reorder-effect.js +67 -0
- package/dist/preview-server/routes/save-effect-props.js +1 -0
- package/dist/preview-server/routes/save-sequence-props.js +158 -72
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +2 -1
- package/dist/preview-server/routes/unregister-client-render.d.ts +4 -0
- package/dist/preview-server/routes/unregister-client-render.js +11 -0
- package/dist/preview-server/routes/update-default-props.js +1 -0
- package/dist/preview-server/sequence-props-watchers.d.ts +2 -1
- package/dist/preview-server/sequence-props-watchers.js +22 -2
- package/dist/preview-server/start-server.d.ts +1 -0
- package/dist/preview-server/start-server.js +1 -0
- package/dist/preview-server/undo-stack.d.ts +35 -4
- package/dist/preview-server/undo-stack.js +130 -42
- package/dist/preview-server/validate-same-origin.d.ts +2 -0
- package/dist/preview-server/validate-same-origin.js +13 -0
- package/dist/routes.d.ts +2 -1
- package/dist/routes.js +9 -136
- package/dist/start-studio.d.ts +2 -1
- package/dist/start-studio.js +2 -1
- package/package.json +6 -6
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reorderEffectHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const reorder_effect_1 = require("../../codemods/reorder-effect");
|
|
7
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
+
const undo_stack_1 = require("../undo-stack");
|
|
11
|
+
const formatting_1 = require("./log-updates/formatting");
|
|
12
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
13
|
+
const reorderEffectHandler = async ({ input: { fileName, sequenceNodePath, fromIndex, toIndex, clientId }, remotionRoot, logLevel, }) => {
|
|
14
|
+
try {
|
|
15
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[reorder-effect] Received request for fileName="${fileName}" fromIndex=${fromIndex} toIndex=${toIndex}`);
|
|
16
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
17
|
+
remotionRoot,
|
|
18
|
+
fileName,
|
|
19
|
+
action: 'modify',
|
|
20
|
+
});
|
|
21
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
22
|
+
const { output, formatted, effectLabel, logLine } = await (0, reorder_effect_1.reorderEffect)({
|
|
23
|
+
input: fileContents,
|
|
24
|
+
sequenceNodePath: sequenceNodePath.nodePath,
|
|
25
|
+
fromIndex,
|
|
26
|
+
toIndex,
|
|
27
|
+
});
|
|
28
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
29
|
+
filePath: absolutePath,
|
|
30
|
+
oldContents: fileContents,
|
|
31
|
+
newContents: null,
|
|
32
|
+
logLevel,
|
|
33
|
+
remotionRoot,
|
|
34
|
+
logLine,
|
|
35
|
+
description: {
|
|
36
|
+
undoMessage: `↩️ Reordering of ${effectLabel}`,
|
|
37
|
+
redoMessage: `↪️ Reordering of ${effectLabel}`,
|
|
38
|
+
},
|
|
39
|
+
entryType: 'reorder-effect',
|
|
40
|
+
suppressHmrOnFileRestore: false,
|
|
41
|
+
});
|
|
42
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
43
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
44
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
45
|
+
remotionRoot,
|
|
46
|
+
absolutePath,
|
|
47
|
+
line: logLine,
|
|
48
|
+
});
|
|
49
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(effectLabel)}`);
|
|
50
|
+
if (!formatted) {
|
|
51
|
+
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
52
|
+
}
|
|
53
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[reorder-effect] Wrote ${fileRelativeToRoot}${formatted ? ' (formatted)' : ''}`);
|
|
54
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
reason: err.message,
|
|
63
|
+
stack: err.stack,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.reorderEffectHandler = reorderEffectHandler;
|
|
@@ -14,87 +14,173 @@ const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
|
14
14
|
const format_prop_change_1 = require("./log-updates/format-prop-change");
|
|
15
15
|
const log_update_1 = require("./log-updates/log-update");
|
|
16
16
|
const save_props_mutex_1 = require("./save-props-mutex");
|
|
17
|
-
const saveSequencePropsHandler = ({ input: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
17
|
+
const saveSequencePropsHandler = ({ input: { edits, clientId, undoLabel, redoLabel }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (edits.length === 0) {
|
|
20
|
+
throw new Error('No sequence prop edits to save');
|
|
21
|
+
}
|
|
22
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[save-sequence-props] Received request with ${edits.length} edit(s)`);
|
|
23
|
+
const editGroups = new Map();
|
|
24
|
+
for (const [index, edit] of edits.entries()) {
|
|
25
|
+
const parsedValue = JSON.parse(edit.value);
|
|
26
|
+
const parsedDefaultValue = edit.defaultValue !== null ? JSON.parse(edit.defaultValue) : null;
|
|
27
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
28
|
+
remotionRoot,
|
|
29
|
+
fileName: edit.fileName,
|
|
30
|
+
action: 'modify',
|
|
31
|
+
});
|
|
32
|
+
const group = (_a = editGroups.get(absolutePath)) !== null && _a !== void 0 ? _a : {
|
|
33
|
+
fileRelativeToRoot,
|
|
34
|
+
edits: [],
|
|
35
|
+
};
|
|
36
|
+
group.edits.push({
|
|
37
|
+
index,
|
|
38
|
+
fileName: edit.fileName,
|
|
39
|
+
nodePath: edit.nodePath,
|
|
40
|
+
key: edit.key,
|
|
41
|
+
value: parsedValue,
|
|
42
|
+
valueString: JSON.stringify(parsedValue),
|
|
43
|
+
defaultValue: parsedDefaultValue,
|
|
44
|
+
defaultValueString: parsedDefaultValue !== null
|
|
45
|
+
? JSON.stringify(parsedDefaultValue)
|
|
46
|
+
: null,
|
|
47
|
+
schema: edit.schema,
|
|
48
|
+
});
|
|
49
|
+
editGroups.set(absolutePath, group);
|
|
50
|
+
}
|
|
51
|
+
const snapshots = [];
|
|
52
|
+
const outputByPath = new Map();
|
|
53
|
+
const resultByIndex = new Map();
|
|
54
|
+
for (const [absolutePath, group] of editGroups) {
|
|
55
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
56
|
+
const { output, formatted, results: updateResults, } = await (0, update_sequence_props_1.updateMultipleSequenceProps)({
|
|
57
|
+
input: fileContents,
|
|
58
|
+
changes: group.edits.map((edit) => {
|
|
59
|
+
return {
|
|
60
|
+
nodePath: edit.nodePath.nodePath,
|
|
61
|
+
updates: [
|
|
62
|
+
{
|
|
63
|
+
key: edit.key,
|
|
64
|
+
value: edit.value,
|
|
65
|
+
defaultValue: edit.defaultValue,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
schema: no_react_1.NoReactInternals.sequenceSchema,
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
prettierConfigOverride: null,
|
|
72
|
+
});
|
|
73
|
+
const [{ logLine: firstLogLine }] = updateResults;
|
|
74
|
+
outputByPath.set(absolutePath, output);
|
|
75
|
+
snapshots.push({
|
|
76
|
+
filePath: absolutePath,
|
|
77
|
+
oldContents: fileContents,
|
|
78
|
+
newContents: output,
|
|
79
|
+
logLine: firstLogLine,
|
|
80
|
+
});
|
|
81
|
+
for (const [resultIndex, result] of updateResults.entries()) {
|
|
82
|
+
const edit = group.edits[resultIndex];
|
|
83
|
+
resultByIndex.set(edit.index, {
|
|
84
|
+
oldValueString: result.oldValueStrings[0],
|
|
85
|
+
logLine: result.logLine,
|
|
86
|
+
removedProps: result.removedProps,
|
|
87
|
+
formatted,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const [firstEdit] = edits;
|
|
92
|
+
const firstResult = resultByIndex.get(0);
|
|
93
|
+
if (!firstResult) {
|
|
94
|
+
throw new Error('Could not compute sequence prop edit result');
|
|
95
|
+
}
|
|
96
|
+
const undoMessage = undoLabel !== null
|
|
97
|
+
? `↩️ ${undoLabel}`
|
|
98
|
+
: edits.length === 1
|
|
99
|
+
? `↩️ ${(0, format_prop_change_1.formatPropChange)({
|
|
100
|
+
key: firstEdit.key,
|
|
101
|
+
oldValueString: (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.value))),
|
|
102
|
+
newValueString: (0, log_update_1.normalizeQuotes)(firstResult.oldValueString),
|
|
103
|
+
defaultValueString: firstEdit.defaultValue !== null
|
|
104
|
+
? (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.defaultValue)))
|
|
105
|
+
: null,
|
|
106
|
+
removedProps: [],
|
|
107
|
+
addedProps: firstResult.removedProps,
|
|
108
|
+
})}`
|
|
109
|
+
: '↩️ Update selected sequence props';
|
|
110
|
+
const redoMessage = redoLabel !== null
|
|
111
|
+
? `↪️ ${redoLabel}`
|
|
112
|
+
: edits.length === 1
|
|
113
|
+
? `↪️ ${(0, format_prop_change_1.formatPropChange)({
|
|
114
|
+
key: firstEdit.key,
|
|
115
|
+
oldValueString: (0, log_update_1.normalizeQuotes)(firstResult.oldValueString),
|
|
116
|
+
newValueString: (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.value))),
|
|
117
|
+
defaultValueString: firstEdit.defaultValue !== null
|
|
118
|
+
? (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.defaultValue)))
|
|
119
|
+
: null,
|
|
120
|
+
removedProps: firstResult.removedProps,
|
|
121
|
+
addedProps: [],
|
|
122
|
+
})}`
|
|
123
|
+
: '↪️ Update selected sequence props';
|
|
124
|
+
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
125
|
+
snapshots,
|
|
63
126
|
logLevel,
|
|
64
127
|
remotionRoot,
|
|
65
|
-
|
|
66
|
-
description: {
|
|
67
|
-
undoMessage: `↩️ ${undoPropChange}`,
|
|
68
|
-
redoMessage: `↪️ ${redoPropChange}`,
|
|
69
|
-
},
|
|
128
|
+
description: { undoMessage, redoMessage },
|
|
70
129
|
entryType: 'sequence-props',
|
|
71
130
|
suppressHmrOnFileRestore: true,
|
|
72
131
|
});
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
132
|
+
for (const [absolutePath, output] of outputByPath) {
|
|
133
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
134
|
+
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
135
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
136
|
+
}
|
|
137
|
+
for (const { edits: groupEdits, fileRelativeToRoot } of editGroups.values()) {
|
|
138
|
+
for (const edit of groupEdits) {
|
|
139
|
+
const result = resultByIndex.get(edit.index);
|
|
140
|
+
if (!result) {
|
|
141
|
+
throw new Error('Could not compute sequence prop edit result');
|
|
142
|
+
}
|
|
143
|
+
(0, log_update_1.logUpdate)({
|
|
144
|
+
fileRelativeToRoot,
|
|
145
|
+
line: result.logLine,
|
|
146
|
+
key: edit.key,
|
|
147
|
+
oldValueString: result.oldValueString,
|
|
148
|
+
newValueString: edit.valueString,
|
|
149
|
+
defaultValueString: edit.defaultValueString,
|
|
150
|
+
formatted: result.formatted,
|
|
151
|
+
logLevel,
|
|
152
|
+
removedProps: result.removedProps,
|
|
153
|
+
addedProps: [],
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
88
157
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
158
|
+
const results = edits.map((edit) => {
|
|
159
|
+
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
160
|
+
remotionRoot,
|
|
161
|
+
fileName: edit.fileName,
|
|
162
|
+
action: 'modify',
|
|
163
|
+
});
|
|
164
|
+
const output = outputByPath.get(absolutePath);
|
|
165
|
+
if (!output) {
|
|
166
|
+
throw new Error('Could not compute sequence prop edit status');
|
|
167
|
+
}
|
|
168
|
+
const newStatus = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
169
|
+
fileContents: output,
|
|
170
|
+
keys: (0, studio_shared_1.getAllSchemaKeys)(edit.schema),
|
|
171
|
+
nodePath: edit.nodePath.nodePath,
|
|
172
|
+
effects: [],
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
fileName: edit.fileName,
|
|
176
|
+
nodePath: edit.nodePath,
|
|
177
|
+
props: newStatus.props,
|
|
178
|
+
};
|
|
94
179
|
});
|
|
95
180
|
return {
|
|
96
181
|
canUpdate: true,
|
|
97
|
-
props:
|
|
182
|
+
props: results[0].props,
|
|
183
|
+
results,
|
|
98
184
|
};
|
|
99
185
|
});
|
|
100
186
|
exports.saveSequencePropsHandler = saveSequencePropsHandler;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribeToSequenceProps = void 0;
|
|
4
4
|
const sequence_props_watchers_1 = require("../sequence-props-watchers");
|
|
5
|
-
const subscribeToSequenceProps = ({ input: { fileName, line, column, keys, effects, clientId }, remotionRoot, logLevel, }) => {
|
|
5
|
+
const subscribeToSequenceProps = ({ input: { fileName, line, column, nodePath, keys, effects, clientId }, remotionRoot, logLevel, }) => {
|
|
6
6
|
const result = (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
|
|
7
7
|
fileName,
|
|
8
8
|
line,
|
|
9
9
|
column,
|
|
10
|
+
nodePath,
|
|
10
11
|
keys,
|
|
11
12
|
effects,
|
|
12
13
|
remotionRoot,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unregisterClientRenderHandler = void 0;
|
|
4
|
+
const client_render_queue_1 = require("../../client-render-queue");
|
|
5
|
+
const validate_same_origin_1 = require("../validate-same-origin");
|
|
6
|
+
const unregisterClientRenderHandler = ({ input: { id }, request, }) => {
|
|
7
|
+
(0, validate_same_origin_1.validateSameOrigin)(request);
|
|
8
|
+
(0, client_render_queue_1.removeCompletedClientRender)(id);
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
};
|
|
11
|
+
exports.unregisterClientRenderHandler = unregisterClientRenderHandler;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { SequenceNodePath } from 'remotion';
|
|
3
|
-
export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column, keys, effects, remotionRoot, clientId, logLevel, }: {
|
|
3
|
+
export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column, nodePath: preferredNodePath, keys, effects, remotionRoot, clientId, logLevel, }: {
|
|
4
4
|
fileName: string;
|
|
5
5
|
line: number;
|
|
6
6
|
column: number;
|
|
7
|
+
nodePath: SequenceNodePath | null;
|
|
7
8
|
keys: string[];
|
|
8
9
|
effects: string[][];
|
|
9
10
|
remotionRoot: string;
|
|
@@ -13,7 +13,26 @@ const live_events_1 = require("./live-events");
|
|
|
13
13
|
const node_path_cache_1 = require("./node-path-cache");
|
|
14
14
|
const can_update_sequence_props_1 = require("./routes/can-update-sequence-props");
|
|
15
15
|
const sequencePropsWatchers = {};
|
|
16
|
-
const getSequencePropsStatus = ({ fileName, line, column, keys, effects, remotionRoot, logLevel, }) => {
|
|
16
|
+
const getSequencePropsStatus = ({ fileName, line, column, preferredNodePath, keys, effects, remotionRoot, logLevel, }) => {
|
|
17
|
+
if (preferredNodePath) {
|
|
18
|
+
const fromNodePath = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
|
|
19
|
+
fileName,
|
|
20
|
+
nodePath: preferredNodePath,
|
|
21
|
+
keys,
|
|
22
|
+
effects,
|
|
23
|
+
remotionRoot,
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
status: fromNodePath,
|
|
27
|
+
nodePath: {
|
|
28
|
+
absolutePath: node_path_1.default.resolve(remotionRoot, fileName),
|
|
29
|
+
nodePath: preferredNodePath,
|
|
30
|
+
sequenceKeys: keys,
|
|
31
|
+
effectKeys: effects,
|
|
32
|
+
},
|
|
33
|
+
success: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
17
36
|
// Try cached nodePath first (handles stale source maps after suppressed rebuilds)
|
|
18
37
|
const cachedNodePath = (0, node_path_cache_1.getCachedNodePath)(fileName, line, column);
|
|
19
38
|
if (cachedNodePath) {
|
|
@@ -47,12 +66,13 @@ const getSequencePropsStatus = ({ fileName, line, column, keys, effects, remotio
|
|
|
47
66
|
});
|
|
48
67
|
return status;
|
|
49
68
|
};
|
|
50
|
-
const subscribeToSequencePropsWatchers = ({ fileName, line, column, keys, effects, remotionRoot, clientId, logLevel, }) => {
|
|
69
|
+
const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: preferredNodePath, keys, effects, remotionRoot, clientId, logLevel, }) => {
|
|
51
70
|
var _a;
|
|
52
71
|
const initialResult = getSequencePropsStatus({
|
|
53
72
|
fileName,
|
|
54
73
|
line,
|
|
55
74
|
column,
|
|
75
|
+
preferredNodePath,
|
|
56
76
|
keys,
|
|
57
77
|
effects,
|
|
58
78
|
remotionRoot,
|
|
@@ -38,6 +38,7 @@ export declare const startServer: (options: {
|
|
|
38
38
|
binariesDirectory: string | null;
|
|
39
39
|
forceIPv4: boolean;
|
|
40
40
|
audioLatencyHint: AudioContextLatencyCategory | null;
|
|
41
|
+
previewSampleRate: number | null;
|
|
41
42
|
enableCrossSiteIsolation: boolean;
|
|
42
43
|
askAIEnabled: boolean;
|
|
43
44
|
forceNew: boolean;
|
|
@@ -102,6 +102,7 @@ const startServer = async (options) => {
|
|
|
102
102
|
gitSource: options.gitSource,
|
|
103
103
|
binariesDirectory: options.binariesDirectory,
|
|
104
104
|
audioLatencyHint: options.audioLatencyHint,
|
|
105
|
+
previewSampleRate: options.previewSampleRate,
|
|
105
106
|
enableCrossSiteIsolation: options.enableCrossSiteIsolation,
|
|
106
107
|
});
|
|
107
108
|
})
|
|
@@ -3,12 +3,19 @@ export interface UndoEntryDescription {
|
|
|
3
3
|
undoMessage: string;
|
|
4
4
|
redoMessage: string;
|
|
5
5
|
}
|
|
6
|
-
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'delete-effect' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'delete-composition' | 'rename-composition' | 'duplicate-composition';
|
|
7
|
-
type
|
|
6
|
+
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'reorder-effect' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'duplicate-composition';
|
|
7
|
+
type UndoEntrySnapshot = {
|
|
8
8
|
filePath: string;
|
|
9
9
|
oldContents: string;
|
|
10
|
+
newContents: string | null;
|
|
11
|
+
/** 1-based source line for terminal/IDE file links (e.g. path:line). */
|
|
12
|
+
logLine: number;
|
|
13
|
+
};
|
|
14
|
+
type UndoEntry = {
|
|
15
|
+
filePath: string;
|
|
10
16
|
/** 1-based source line for terminal/IDE file links (e.g. path:line). */
|
|
11
17
|
logLine: number;
|
|
18
|
+
snapshots: UndoEntrySnapshot[];
|
|
12
19
|
description: UndoEntryDescription;
|
|
13
20
|
/** When true, undo/redo file restores call `suppressBundlerUpdateForFile` (skip HMR refresh). */
|
|
14
21
|
suppressHmrOnFileRestore: boolean;
|
|
@@ -20,12 +27,20 @@ type UndoEntry = {
|
|
|
20
27
|
entryType: 'sequence-props';
|
|
21
28
|
} | {
|
|
22
29
|
entryType: 'effect-props';
|
|
30
|
+
} | {
|
|
31
|
+
entryType: 'keyframe-delete';
|
|
32
|
+
} | {
|
|
33
|
+
entryType: 'add-effect';
|
|
23
34
|
} | {
|
|
24
35
|
entryType: 'delete-effect';
|
|
36
|
+
} | {
|
|
37
|
+
entryType: 'reorder-effect';
|
|
25
38
|
} | {
|
|
26
39
|
entryType: 'delete-jsx-node';
|
|
27
40
|
} | {
|
|
28
41
|
entryType: 'duplicate-jsx-node';
|
|
42
|
+
} | {
|
|
43
|
+
entryType: 'insert-jsx-element';
|
|
29
44
|
} | {
|
|
30
45
|
entryType: 'delete-composition';
|
|
31
46
|
} | {
|
|
@@ -33,9 +48,10 @@ type UndoEntry = {
|
|
|
33
48
|
} | {
|
|
34
49
|
entryType: 'duplicate-composition';
|
|
35
50
|
});
|
|
36
|
-
export declare function pushToUndoStack({ filePath, oldContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore }: {
|
|
51
|
+
export declare function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore }: {
|
|
37
52
|
filePath: string;
|
|
38
53
|
oldContents: string;
|
|
54
|
+
newContents: string | null;
|
|
39
55
|
logLevel: LogLevel;
|
|
40
56
|
remotionRoot: string;
|
|
41
57
|
logLine: number;
|
|
@@ -43,10 +59,24 @@ export declare function pushToUndoStack({ filePath, oldContents, logLevel, remot
|
|
|
43
59
|
entryType: UndoEntryType;
|
|
44
60
|
suppressHmrOnFileRestore: boolean;
|
|
45
61
|
}): void;
|
|
62
|
+
export declare function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore }: {
|
|
63
|
+
snapshots: Array<{
|
|
64
|
+
filePath: string;
|
|
65
|
+
oldContents: string;
|
|
66
|
+
newContents: string | null;
|
|
67
|
+
logLine: number;
|
|
68
|
+
}>;
|
|
69
|
+
logLevel: LogLevel;
|
|
70
|
+
remotionRoot: string;
|
|
71
|
+
description: UndoEntryDescription;
|
|
72
|
+
entryType: UndoEntryType;
|
|
73
|
+
suppressHmrOnFileRestore: boolean;
|
|
74
|
+
}): void;
|
|
46
75
|
export declare function printUndoHint(logLevel: LogLevel): void;
|
|
47
|
-
export declare function pushToRedoStack({ filePath, oldContents, logLine, description, entryType, suppressHmrOnFileRestore }: {
|
|
76
|
+
export declare function pushToRedoStack({ filePath, oldContents, newContents, logLine, description, entryType, suppressHmrOnFileRestore }: {
|
|
48
77
|
filePath: string;
|
|
49
78
|
oldContents: string;
|
|
79
|
+
newContents: string | null;
|
|
50
80
|
logLine: number;
|
|
51
81
|
description: UndoEntryDescription;
|
|
52
82
|
entryType: UndoEntryType;
|
|
@@ -67,4 +97,5 @@ export declare function popRedo(): {
|
|
|
67
97
|
};
|
|
68
98
|
export declare function getUndoStack(): readonly UndoEntry[];
|
|
69
99
|
export declare function getRedoStack(): readonly UndoEntry[];
|
|
100
|
+
export declare function clearUndoStackForTests(): void;
|
|
70
101
|
export {};
|