@remotion/studio-server 4.0.469 → 4.0.470
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/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/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 +8 -0
- package/dist/codemods/update-keyframes/update-keyframes.js +94 -24
- 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/index.d.ts +2 -1
- package/dist/preview-server/api-routes.js +16 -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-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/add-sequence-keyframe.js +84 -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.js +33 -13
- 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-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/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/save-effect-props.js +1 -0
- package/dist/preview-server/routes/save-sequence-props.js +158 -72
- 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/start-server.d.ts +1 -0
- package/dist/preview-server/start-server.js +1 -0
- package/dist/preview-server/undo-stack.d.ts +26 -3
- 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
|
@@ -35,11 +35,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.updateEffectKeyframes = exports.updateEffectKeyframesAst = exports.updateSequenceKeyframes = exports.updateSequenceKeyframesAst = void 0;
|
|
37
37
|
const recast = __importStar(require("recast"));
|
|
38
|
+
const get_ast_node_path_1 = require("../../helpers/get-ast-node-path");
|
|
38
39
|
const can_update_sequence_props_1 = require("../../preview-server/routes/can-update-sequence-props");
|
|
39
40
|
const format_file_content_1 = require("../format-file-content");
|
|
40
41
|
const parse_ast_1 = require("../parse-ast");
|
|
41
42
|
const update_effect_props_1 = require("../update-effect-props/update-effect-props");
|
|
42
43
|
const update_nested_prop_1 = require("../update-nested-prop");
|
|
44
|
+
const ensure_imports_and_frame_hook_1 = require("./ensure-imports-and-frame-hook");
|
|
43
45
|
const b = recast.types.builders;
|
|
44
46
|
const getSupportedCallArgument = (arg) => {
|
|
45
47
|
if (arg === undefined ||
|
|
@@ -139,6 +141,10 @@ const createInterpolateExpression = ({ callee, input, extraArgs, keyframes, }) =
|
|
|
139
141
|
...extraArgs,
|
|
140
142
|
]);
|
|
141
143
|
};
|
|
144
|
+
const noIntroducedIdentifiers = {
|
|
145
|
+
calleeName: null,
|
|
146
|
+
needsFrameHook: false,
|
|
147
|
+
};
|
|
142
148
|
const addKeyframe = ({ expression, frame, value, }) => {
|
|
143
149
|
const existing = getInterpolationExpression(expression);
|
|
144
150
|
const newOutput = (0, update_nested_prop_1.parseValueExpression)(value);
|
|
@@ -149,12 +155,15 @@ const addKeyframe = ({ expression, frame, value, }) => {
|
|
|
149
155
|
: existing.keyframes.map((keyframe, index) => index === existingIndex
|
|
150
156
|
? { frame, output: newOutput, value }
|
|
151
157
|
: keyframe);
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
return {
|
|
159
|
+
expression: createInterpolateExpression({
|
|
160
|
+
callee: existing.callee,
|
|
161
|
+
input: existing.input,
|
|
162
|
+
extraArgs: existing.extraArgs,
|
|
163
|
+
keyframes: nextKeyframes,
|
|
164
|
+
}),
|
|
165
|
+
introduced: noIntroducedIdentifiers,
|
|
166
|
+
};
|
|
158
167
|
}
|
|
159
168
|
if (!(0, can_update_sequence_props_1.isStaticValue)(expression)) {
|
|
160
169
|
throw new Error('Cannot add keyframe to computed expression');
|
|
@@ -167,15 +176,24 @@ const addKeyframe = ({ expression, frame, value, }) => {
|
|
|
167
176
|
{ frame: 0, output: staticOutput, value: staticValue },
|
|
168
177
|
{ frame, output: newOutput, value },
|
|
169
178
|
];
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
newValue: value,
|
|
174
|
-
}),
|
|
175
|
-
input: b.identifier('frame'),
|
|
176
|
-
extraArgs: [],
|
|
177
|
-
keyframes,
|
|
179
|
+
const callee = getInterpolationCalleeForValues({
|
|
180
|
+
staticValue,
|
|
181
|
+
newValue: value,
|
|
178
182
|
});
|
|
183
|
+
return {
|
|
184
|
+
expression: createInterpolateExpression({
|
|
185
|
+
callee,
|
|
186
|
+
input: b.identifier('frame'),
|
|
187
|
+
extraArgs: [],
|
|
188
|
+
keyframes,
|
|
189
|
+
}),
|
|
190
|
+
introduced: {
|
|
191
|
+
calleeName: callee.type === 'Identifier'
|
|
192
|
+
? callee.name
|
|
193
|
+
: null,
|
|
194
|
+
needsFrameHook: true,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
179
197
|
};
|
|
180
198
|
const removeKeyframe = ({ expression, frame, }) => {
|
|
181
199
|
const existing = getInterpolationExpression(expression);
|
|
@@ -202,7 +220,10 @@ const applyKeyframeOperation = ({ expression, operation, }) => {
|
|
|
202
220
|
value: operation.value,
|
|
203
221
|
});
|
|
204
222
|
}
|
|
205
|
-
return
|
|
223
|
+
return {
|
|
224
|
+
expression: removeKeyframe({ expression, frame: operation.frame }),
|
|
225
|
+
introduced: noIntroducedIdentifiers,
|
|
226
|
+
};
|
|
206
227
|
};
|
|
207
228
|
const getExpressionFromJsxAttribute = (attr) => {
|
|
208
229
|
if (!attr.value) {
|
|
@@ -301,34 +322,55 @@ const updateSequenceKeyframesAst = ({ input, nodePath, updates, }) => {
|
|
|
301
322
|
var _a;
|
|
302
323
|
var _b;
|
|
303
324
|
const ast = (0, parse_ast_1.parseAst)(input);
|
|
325
|
+
const jsxPath = (0, get_ast_node_path_1.getAstNodePath)(ast, nodePath);
|
|
304
326
|
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
305
|
-
if (!node) {
|
|
327
|
+
if (!node || !jsxPath) {
|
|
306
328
|
throw new Error('Could not find a JSX element at the specified location to update keyframes');
|
|
307
329
|
}
|
|
308
330
|
if (!node.attributes) {
|
|
309
331
|
node.attributes = [];
|
|
310
332
|
}
|
|
333
|
+
const requiredImports = new Set();
|
|
334
|
+
let needsFrameHook = false;
|
|
311
335
|
const oldValueStrings = [];
|
|
336
|
+
const newValueStrings = [];
|
|
312
337
|
for (const update of updates) {
|
|
313
338
|
const prop = getSequenceWritableProp({
|
|
314
339
|
attributes: node.attributes,
|
|
315
340
|
key: update.key,
|
|
316
341
|
});
|
|
317
342
|
oldValueStrings.push(recast.print(prop.expression).code);
|
|
318
|
-
|
|
343
|
+
const { expression: nextExpression, introduced } = applyKeyframeOperation({
|
|
319
344
|
expression: prop.expression,
|
|
320
345
|
operation: update.operation,
|
|
321
|
-
})
|
|
346
|
+
});
|
|
347
|
+
newValueStrings.push(recast.print(nextExpression).code);
|
|
348
|
+
prop.setExpression(nextExpression);
|
|
349
|
+
if (introduced.calleeName) {
|
|
350
|
+
requiredImports.add(introduced.calleeName);
|
|
351
|
+
}
|
|
352
|
+
if (introduced.needsFrameHook) {
|
|
353
|
+
requiredImports.add('useCurrentFrame');
|
|
354
|
+
needsFrameHook = true;
|
|
355
|
+
}
|
|
322
356
|
}
|
|
357
|
+
if (needsFrameHook) {
|
|
358
|
+
const fnPath = (0, ensure_imports_and_frame_hook_1.findEnclosingFunctionPath)(jsxPath);
|
|
359
|
+
if (fnPath) {
|
|
360
|
+
(0, ensure_imports_and_frame_hook_1.ensureUseCurrentFrameHook)(fnPath);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
(0, ensure_imports_and_frame_hook_1.ensureRemotionImports)(ast, requiredImports);
|
|
323
364
|
return {
|
|
324
365
|
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
325
366
|
oldValueStrings,
|
|
367
|
+
newValueStrings,
|
|
326
368
|
logLine: (_b = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1,
|
|
327
369
|
};
|
|
328
370
|
};
|
|
329
371
|
exports.updateSequenceKeyframesAst = updateSequenceKeyframesAst;
|
|
330
372
|
const updateSequenceKeyframes = async ({ input, nodePath, updates, prettierConfigOverride, }) => {
|
|
331
|
-
const { serialized, oldValueStrings, logLine } = (0, exports.updateSequenceKeyframesAst)({
|
|
373
|
+
const { serialized, oldValueStrings, newValueStrings, logLine } = (0, exports.updateSequenceKeyframesAst)({
|
|
332
374
|
input,
|
|
333
375
|
nodePath,
|
|
334
376
|
updates,
|
|
@@ -337,15 +379,16 @@ const updateSequenceKeyframes = async ({ input, nodePath, updates, prettierConfi
|
|
|
337
379
|
input: serialized,
|
|
338
380
|
prettierConfigOverride,
|
|
339
381
|
});
|
|
340
|
-
return { output, formatted, oldValueStrings, logLine };
|
|
382
|
+
return { output, formatted, oldValueStrings, newValueStrings, logLine };
|
|
341
383
|
};
|
|
342
384
|
exports.updateSequenceKeyframes = updateSequenceKeyframes;
|
|
343
385
|
const updateEffectKeyframesAst = ({ input, sequenceNodePath, effectIndex, updates, }) => {
|
|
344
386
|
var _a, _b;
|
|
345
387
|
var _c, _d, _e;
|
|
346
388
|
const ast = (0, parse_ast_1.parseAst)(input);
|
|
389
|
+
const jsxPath = (0, get_ast_node_path_1.getAstNodePath)(ast, sequenceNodePath);
|
|
347
390
|
const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
|
|
348
|
-
if (!jsx) {
|
|
391
|
+
if (!jsx || !jsxPath) {
|
|
349
392
|
throw new Error('Could not find a JSX element at the specified location to update effect keyframes');
|
|
350
393
|
}
|
|
351
394
|
const attr = (0, update_effect_props_1.findEffectsAttr)((_c = jsx.attributes) !== null && _c !== void 0 ? _c : []);
|
|
@@ -363,27 +406,47 @@ const updateEffectKeyframesAst = ({ input, sequenceNodePath, effectIndex, update
|
|
|
363
406
|
}
|
|
364
407
|
const objExpr = call.arguments[0];
|
|
365
408
|
const oldValueStrings = [];
|
|
409
|
+
const newValueStrings = [];
|
|
410
|
+
const requiredImports = new Set();
|
|
411
|
+
let needsFrameHook = false;
|
|
366
412
|
for (const update of updates) {
|
|
367
413
|
const { prop } = findObjectProperty(objExpr, update.key);
|
|
368
414
|
if (!prop) {
|
|
369
415
|
throw new Error(`Cannot update keyframes: "${update.key}" is not set`);
|
|
370
416
|
}
|
|
371
417
|
oldValueStrings.push(recast.print(prop.value).code);
|
|
372
|
-
|
|
418
|
+
const { expression: nextExpression, introduced } = applyKeyframeOperation({
|
|
373
419
|
expression: prop.value,
|
|
374
420
|
operation: update.operation,
|
|
375
421
|
});
|
|
422
|
+
newValueStrings.push(recast.print(nextExpression).code);
|
|
423
|
+
prop.value = nextExpression;
|
|
424
|
+
if (introduced.calleeName) {
|
|
425
|
+
requiredImports.add(introduced.calleeName);
|
|
426
|
+
}
|
|
427
|
+
if (introduced.needsFrameHook) {
|
|
428
|
+
requiredImports.add('useCurrentFrame');
|
|
429
|
+
needsFrameHook = true;
|
|
430
|
+
}
|
|
376
431
|
}
|
|
432
|
+
if (needsFrameHook) {
|
|
433
|
+
const fnPath = (0, ensure_imports_and_frame_hook_1.findEnclosingFunctionPath)(jsxPath);
|
|
434
|
+
if (fnPath) {
|
|
435
|
+
(0, ensure_imports_and_frame_hook_1.ensureUseCurrentFrameHook)(fnPath);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
(0, ensure_imports_and_frame_hook_1.ensureRemotionImports)(ast, requiredImports);
|
|
377
439
|
return {
|
|
378
440
|
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
379
441
|
oldValueStrings,
|
|
442
|
+
newValueStrings,
|
|
380
443
|
logLine: (_e = (_d = (_a = call.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : (_b = jsx.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _e !== void 0 ? _e : 1,
|
|
381
444
|
effectCallee,
|
|
382
445
|
};
|
|
383
446
|
};
|
|
384
447
|
exports.updateEffectKeyframesAst = updateEffectKeyframesAst;
|
|
385
448
|
const updateEffectKeyframes = async ({ input, sequenceNodePath, effectIndex, updates, prettierConfigOverride, }) => {
|
|
386
|
-
const { serialized, oldValueStrings, logLine, effectCallee } = (0, exports.updateEffectKeyframesAst)({
|
|
449
|
+
const { serialized, oldValueStrings, newValueStrings, logLine, effectCallee } = (0, exports.updateEffectKeyframesAst)({
|
|
387
450
|
input,
|
|
388
451
|
sequenceNodePath,
|
|
389
452
|
effectIndex,
|
|
@@ -393,6 +456,13 @@ const updateEffectKeyframes = async ({ input, sequenceNodePath, effectIndex, upd
|
|
|
393
456
|
input: serialized,
|
|
394
457
|
prettierConfigOverride,
|
|
395
458
|
});
|
|
396
|
-
return {
|
|
459
|
+
return {
|
|
460
|
+
output,
|
|
461
|
+
formatted,
|
|
462
|
+
oldValueStrings,
|
|
463
|
+
newValueStrings,
|
|
464
|
+
logLine,
|
|
465
|
+
effectCallee,
|
|
466
|
+
};
|
|
397
467
|
};
|
|
398
468
|
exports.updateEffectKeyframes = updateEffectKeyframes;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { SequenceNodePath } from 'remotion';
|
|
2
|
-
import type { SequenceSchema } from 'remotion';
|
|
1
|
+
import type { SequenceNodePath, SequenceSchema } from 'remotion';
|
|
3
2
|
export type SequencePropUpdate = {
|
|
4
3
|
key: string;
|
|
5
4
|
value: unknown;
|
|
@@ -9,6 +8,29 @@ export type RemovedProp = {
|
|
|
9
8
|
key: string;
|
|
10
9
|
valueString: string;
|
|
11
10
|
};
|
|
11
|
+
export type SequencePropsNodeUpdate = {
|
|
12
|
+
nodePath: SequenceNodePath;
|
|
13
|
+
updates: SequencePropUpdate[];
|
|
14
|
+
schema: SequenceSchema;
|
|
15
|
+
};
|
|
16
|
+
export type SequencePropsNodeUpdateResult = {
|
|
17
|
+
oldValueStrings: string[];
|
|
18
|
+
logLine: number;
|
|
19
|
+
removedProps: RemovedProp[];
|
|
20
|
+
};
|
|
21
|
+
type PrettierConfigOverride = Record<string, unknown> | null;
|
|
22
|
+
type UpdateMultipleSequencePropsResult = {
|
|
23
|
+
output: string;
|
|
24
|
+
formatted: boolean;
|
|
25
|
+
results: SequencePropsNodeUpdateResult[];
|
|
26
|
+
};
|
|
27
|
+
type UpdateSequencePropsResult = {
|
|
28
|
+
output: string;
|
|
29
|
+
oldValueStrings: string[];
|
|
30
|
+
formatted: boolean;
|
|
31
|
+
logLine: number;
|
|
32
|
+
removedProps: RemovedProp[];
|
|
33
|
+
};
|
|
12
34
|
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, }: {
|
|
13
35
|
input: string;
|
|
14
36
|
nodePath: SequenceNodePath;
|
|
@@ -20,16 +42,16 @@ export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema
|
|
|
20
42
|
logLine: number;
|
|
21
43
|
removedProps: RemovedProp[];
|
|
22
44
|
};
|
|
45
|
+
export declare const updateMultipleSequenceProps: ({ input, changes, prettierConfigOverride, }: {
|
|
46
|
+
input: string;
|
|
47
|
+
changes: SequencePropsNodeUpdate[];
|
|
48
|
+
prettierConfigOverride: PrettierConfigOverride;
|
|
49
|
+
}) => Promise<UpdateMultipleSequencePropsResult>;
|
|
23
50
|
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, }: {
|
|
24
51
|
input: string;
|
|
25
52
|
nodePath: SequenceNodePath;
|
|
26
53
|
updates: SequencePropUpdate[];
|
|
27
54
|
schema: SequenceSchema;
|
|
28
|
-
prettierConfigOverride
|
|
29
|
-
}) => Promise<
|
|
30
|
-
|
|
31
|
-
oldValueStrings: string[];
|
|
32
|
-
formatted: boolean;
|
|
33
|
-
logLine: number;
|
|
34
|
-
removedProps: RemovedProp[];
|
|
35
|
-
}>;
|
|
55
|
+
prettierConfigOverride: PrettierConfigOverride;
|
|
56
|
+
}) => Promise<UpdateSequencePropsResult>;
|
|
57
|
+
export {};
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.updateSequenceProps = exports.updateSequencePropsAst = void 0;
|
|
36
|
+
exports.updateSequenceProps = exports.updateMultipleSequenceProps = exports.updateSequencePropsAst = void 0;
|
|
37
37
|
const recast = __importStar(require("recast"));
|
|
38
38
|
const no_react_1 = require("remotion/no-react");
|
|
39
39
|
const can_update_sequence_props_1 = require("../../preview-server/routes/can-update-sequence-props");
|
|
@@ -85,14 +85,9 @@ const snapshotTopLevelAttrs = (node) => {
|
|
|
85
85
|
}
|
|
86
86
|
return result;
|
|
87
87
|
};
|
|
88
|
-
const
|
|
88
|
+
const updateSequencePropsNode = ({ node, updates, schema, }) => {
|
|
89
89
|
var _a, _b, _c;
|
|
90
90
|
var _d, _e;
|
|
91
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
92
|
-
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
93
|
-
if (!node) {
|
|
94
|
-
throw new Error('Could not find a JSX element at the specified line to update');
|
|
95
|
-
}
|
|
96
91
|
const logLine = (_d = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
97
92
|
const oldValueStrings = [];
|
|
98
93
|
const initialAttrs = snapshotTopLevelAttrs(node);
|
|
@@ -194,6 +189,23 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
|
194
189
|
}
|
|
195
190
|
removedProps.push({ key: name, valueString });
|
|
196
191
|
}
|
|
192
|
+
return {
|
|
193
|
+
oldValueStrings,
|
|
194
|
+
logLine,
|
|
195
|
+
removedProps,
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
199
|
+
const ast = (0, parse_ast_1.parseAst)(input);
|
|
200
|
+
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
201
|
+
if (!node) {
|
|
202
|
+
throw new Error('Could not find a JSX element at the specified line to update');
|
|
203
|
+
}
|
|
204
|
+
const { oldValueStrings, logLine, removedProps } = updateSequencePropsNode({
|
|
205
|
+
node,
|
|
206
|
+
updates,
|
|
207
|
+
schema,
|
|
208
|
+
});
|
|
197
209
|
return {
|
|
198
210
|
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
199
211
|
oldValueStrings,
|
|
@@ -202,6 +214,26 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
|
202
214
|
};
|
|
203
215
|
};
|
|
204
216
|
exports.updateSequencePropsAst = updateSequencePropsAst;
|
|
217
|
+
const updateMultipleSequenceProps = async ({ input, changes, prettierConfigOverride, }) => {
|
|
218
|
+
const ast = (0, parse_ast_1.parseAst)(input);
|
|
219
|
+
const results = changes.map(({ nodePath, updates, schema }) => {
|
|
220
|
+
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
221
|
+
if (!node) {
|
|
222
|
+
throw new Error('Could not find a JSX element at the specified line to update');
|
|
223
|
+
}
|
|
224
|
+
return updateSequencePropsNode({ node, updates, schema });
|
|
225
|
+
});
|
|
226
|
+
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
227
|
+
input: (0, parse_ast_1.serializeAst)(ast),
|
|
228
|
+
prettierConfigOverride,
|
|
229
|
+
});
|
|
230
|
+
return {
|
|
231
|
+
output,
|
|
232
|
+
formatted,
|
|
233
|
+
results,
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
exports.updateMultipleSequenceProps = updateMultipleSequenceProps;
|
|
205
237
|
const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierConfigOverride, }) => {
|
|
206
238
|
const { serialized, oldValueStrings, logLine, removedProps } = (0, exports.updateSequencePropsAst)({
|
|
207
239
|
input,
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { ApiRoutes, CopyStillToClipboardRequest, getDefaultOutLocation, OpenInFi
|
|
|
2
2
|
export type { AggregateRenderProgress, BundlingState, CopyingState, DownloadProgress, HotMiddlewareOptions, JobProgressCallback, ModuleMap, PackageManager, ProjectInfo, RenderingProgressInput, RenderJob, RenderJobWithCleanup, RequiredChromiumOptions, StitchingProgressInput, UiOpenGlOptions, } from '@remotion/studio-shared';
|
|
3
3
|
import { AnsiDiff } from './ansi-diff';
|
|
4
4
|
export declare const StudioServerInternals: {
|
|
5
|
-
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, enableCrossSiteIsolation, askAIEnabled, forceNew, rspack, }: {
|
|
5
|
+
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, previewSampleRate, enableCrossSiteIsolation, askAIEnabled, forceNew, rspack, }: {
|
|
6
6
|
browserArgs: string;
|
|
7
7
|
browserFlag: string;
|
|
8
8
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -23,6 +23,7 @@ export declare const StudioServerInternals: {
|
|
|
23
23
|
getRenderQueue: () => import("@remotion/studio-shared").RenderJob[];
|
|
24
24
|
numberOfAudioTags: number;
|
|
25
25
|
audioLatencyHint: AudioContextLatencyCategory | null;
|
|
26
|
+
previewSampleRate: number | null;
|
|
26
27
|
enableCrossSiteIsolation: boolean;
|
|
27
28
|
queueMethods: import("./preview-server/api-types").QueueMethods;
|
|
28
29
|
previewEntry: string;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.allApiRoutes = void 0;
|
|
4
|
+
const add_effect_keyframe_1 = require("./routes/add-effect-keyframe");
|
|
4
5
|
const add_render_1 = require("./routes/add-render");
|
|
6
|
+
const add_sequence_keyframe_1 = require("./routes/add-sequence-keyframe");
|
|
5
7
|
const apply_codemod_1 = require("./routes/apply-codemod");
|
|
6
8
|
const apply_visual_control_change_1 = require("./routes/apply-visual-control-change");
|
|
7
9
|
const cancel_render_1 = require("./routes/cancel-render");
|
|
10
|
+
const composition_component_info_1 = require("./routes/composition-component-info");
|
|
8
11
|
const delete_effect_1 = require("./routes/delete-effect");
|
|
12
|
+
const delete_effect_keyframe_1 = require("./routes/delete-effect-keyframe");
|
|
9
13
|
const delete_jsx_node_1 = require("./routes/delete-jsx-node");
|
|
14
|
+
const delete_sequence_keyframe_1 = require("./routes/delete-sequence-keyframe");
|
|
10
15
|
const delete_static_file_1 = require("./routes/delete-static-file");
|
|
11
16
|
const duplicate_jsx_node_1 = require("./routes/duplicate-jsx-node");
|
|
12
17
|
const install_dependency_1 = require("./routes/install-dependency");
|
|
18
|
+
const open_in_editor_1 = require("./routes/open-in-editor");
|
|
13
19
|
const open_in_file_explorer_1 = require("./routes/open-in-file-explorer");
|
|
14
20
|
const project_info_1 = require("./routes/project-info");
|
|
15
21
|
const redo_1 = require("./routes/redo");
|
|
22
|
+
const register_client_render_1 = require("./routes/register-client-render");
|
|
16
23
|
const remove_render_1 = require("./routes/remove-render");
|
|
17
24
|
const restart_studio_1 = require("./routes/restart-studio");
|
|
18
25
|
const save_effect_props_1 = require("./routes/save-effect-props");
|
|
@@ -21,18 +28,23 @@ const subscribe_to_default_props_1 = require("./routes/subscribe-to-default-prop
|
|
|
21
28
|
const subscribe_to_file_existence_1 = require("./routes/subscribe-to-file-existence");
|
|
22
29
|
const subscribe_to_sequence_props_1 = require("./routes/subscribe-to-sequence-props");
|
|
23
30
|
const undo_1 = require("./routes/undo");
|
|
31
|
+
const unregister_client_render_1 = require("./routes/unregister-client-render");
|
|
24
32
|
const unsubscribe_from_default_props_1 = require("./routes/unsubscribe-from-default-props");
|
|
25
33
|
const unsubscribe_from_file_existence_1 = require("./routes/unsubscribe-from-file-existence");
|
|
26
34
|
const unsubscribe_from_sequence_props_1 = require("./routes/unsubscribe-from-sequence-props");
|
|
27
35
|
const update_available_1 = require("./routes/update-available");
|
|
28
36
|
const update_default_props_1 = require("./routes/update-default-props");
|
|
29
37
|
exports.allApiRoutes = {
|
|
38
|
+
'/api/composition-component-info': composition_component_info_1.compositionComponentInfoHandler,
|
|
30
39
|
'/api/cancel': cancel_render_1.handleCancelRender,
|
|
31
40
|
'/api/render': add_render_1.handleAddRender,
|
|
32
41
|
'/api/unsubscribe-from-file-existence': unsubscribe_from_file_existence_1.unsubscribeFromFileExistence,
|
|
33
42
|
'/api/subscribe-to-file-existence': subscribe_to_file_existence_1.subscribeToFileExistence,
|
|
34
43
|
'/api/remove-render': remove_render_1.handleRemoveRender,
|
|
44
|
+
'/api/open-in-editor': open_in_editor_1.openInEditorHandler,
|
|
35
45
|
'/api/open-in-file-explorer': open_in_file_explorer_1.handleOpenInFileExplorer,
|
|
46
|
+
'/api/register-client-render': register_client_render_1.registerClientRenderHandler,
|
|
47
|
+
'/api/unregister-client-render': unregister_client_render_1.unregisterClientRenderHandler,
|
|
36
48
|
'/api/update-default-props': update_default_props_1.updateDefaultPropsHandler,
|
|
37
49
|
'/api/apply-visual-control-change': apply_visual_control_change_1.applyVisualControlHandler,
|
|
38
50
|
'/api/apply-codemod': apply_codemod_1.applyCodemodHandler,
|
|
@@ -42,6 +54,10 @@ exports.allApiRoutes = {
|
|
|
42
54
|
'/api/unsubscribe-from-sequence-props': unsubscribe_from_sequence_props_1.unsubscribeFromSequenceProps,
|
|
43
55
|
'/api/save-sequence-props': save_sequence_props_1.saveSequencePropsHandler,
|
|
44
56
|
'/api/save-effect-props': save_effect_props_1.saveEffectPropsHandler,
|
|
57
|
+
'/api/delete-sequence-keyframe': delete_sequence_keyframe_1.deleteSequenceKeyframeHandler,
|
|
58
|
+
'/api/add-sequence-keyframe': add_sequence_keyframe_1.addSequenceKeyframeHandler,
|
|
59
|
+
'/api/delete-effect-keyframe': delete_effect_keyframe_1.deleteEffectKeyframeHandler,
|
|
60
|
+
'/api/add-effect-keyframe': add_effect_keyframe_1.addEffectKeyframeHandler,
|
|
45
61
|
'/api/delete-effect': delete_effect_1.deleteEffectHandler,
|
|
46
62
|
'/api/delete-jsx-node': delete_jsx_node_1.deleteJsxNodeHandler,
|
|
47
63
|
'/api/duplicate-jsx-node': duplicate_jsx_node_1.duplicateJsxNodeHandler,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEffectKeyframeHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
+
const parse_ast_1 = require("../../codemods/parse-ast");
|
|
8
|
+
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
9
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
10
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
11
|
+
const undo_stack_1 = require("../undo-stack");
|
|
12
|
+
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
13
|
+
const can_update_effect_props_1 = require("./can-update-effect-props");
|
|
14
|
+
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
15
|
+
const log_effect_update_1 = require("./log-updates/log-effect-update");
|
|
16
|
+
const save_props_mutex_1 = require("./save-props-mutex");
|
|
17
|
+
const addEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectIndex, key, frame, value, schema, clientId, }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
18
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[add-effect-keyframe] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}" frame=${frame}`);
|
|
19
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
20
|
+
remotionRoot,
|
|
21
|
+
fileName,
|
|
22
|
+
action: 'modify',
|
|
23
|
+
});
|
|
24
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
25
|
+
const parsedValue = JSON.parse(value);
|
|
26
|
+
const { output, oldValueStrings, newValueStrings, formatted, logLine, effectCallee, } = await (0, update_keyframes_1.updateEffectKeyframes)({
|
|
27
|
+
input: fileContents,
|
|
28
|
+
sequenceNodePath: sequenceNodePath.nodePath,
|
|
29
|
+
effectIndex,
|
|
30
|
+
updates: [
|
|
31
|
+
{
|
|
32
|
+
key,
|
|
33
|
+
operation: {
|
|
34
|
+
type: 'add',
|
|
35
|
+
frame,
|
|
36
|
+
value: parsedValue,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
const oldValueString = oldValueStrings[0];
|
|
42
|
+
const newValueString = newValueStrings[0];
|
|
43
|
+
const undoPropChange = `${key} keyframe removed at frame ${frame}`;
|
|
44
|
+
const redoPropChange = `${key} keyframe added at frame ${frame}`;
|
|
45
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
46
|
+
filePath: absolutePath,
|
|
47
|
+
oldContents: fileContents,
|
|
48
|
+
newContents: null,
|
|
49
|
+
logLevel,
|
|
50
|
+
remotionRoot,
|
|
51
|
+
logLine,
|
|
52
|
+
description: {
|
|
53
|
+
undoMessage: `↩️ ${undoPropChange}`,
|
|
54
|
+
redoMessage: `↪️ ${redoPropChange}`,
|
|
55
|
+
},
|
|
56
|
+
entryType: 'effect-props',
|
|
57
|
+
suppressHmrOnFileRestore: true,
|
|
58
|
+
});
|
|
59
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
60
|
+
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
61
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
62
|
+
(0, log_effect_update_1.logEffectUpdate)({
|
|
63
|
+
fileRelativeToRoot,
|
|
64
|
+
line: logLine,
|
|
65
|
+
effectName: effectCallee,
|
|
66
|
+
propKey: key,
|
|
67
|
+
oldValueString,
|
|
68
|
+
newValueString,
|
|
69
|
+
defaultValueString: null,
|
|
70
|
+
formatted,
|
|
71
|
+
logLevel,
|
|
72
|
+
removedProps: [],
|
|
73
|
+
addedProps: [],
|
|
74
|
+
});
|
|
75
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
76
|
+
const ast = (0, parse_ast_1.parseAst)((0, node_fs_1.readFileSync)(absolutePath, 'utf-8'));
|
|
77
|
+
const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath.nodePath);
|
|
78
|
+
if (!jsx) {
|
|
79
|
+
return {
|
|
80
|
+
canUpdate: false,
|
|
81
|
+
effectIndex,
|
|
82
|
+
reason: 'not-found',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return (0, can_update_effect_props_1.computeEffectPropStatus)({
|
|
86
|
+
jsx,
|
|
87
|
+
effectIndex,
|
|
88
|
+
keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
exports.addEffectKeyframeHandler = addEffectKeyframeHandler;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addSequenceKeyframeHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
+
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
8
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
9
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
10
|
+
const undo_stack_1 = require("../undo-stack");
|
|
11
|
+
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
12
|
+
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
13
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
14
|
+
const save_props_mutex_1 = require("./save-props-mutex");
|
|
15
|
+
const addSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, value, schema, clientId }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
16
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[add-sequence-keyframe] Received request for fileName="${fileName}" key="${key}" frame=${frame}`);
|
|
17
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
18
|
+
remotionRoot,
|
|
19
|
+
fileName,
|
|
20
|
+
action: 'modify',
|
|
21
|
+
});
|
|
22
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
+
const parsedValue = JSON.parse(value);
|
|
24
|
+
const { output, oldValueStrings, newValueStrings, formatted, logLine } = await (0, update_keyframes_1.updateSequenceKeyframes)({
|
|
25
|
+
input: fileContents,
|
|
26
|
+
nodePath: nodePath.nodePath,
|
|
27
|
+
updates: [
|
|
28
|
+
{
|
|
29
|
+
key,
|
|
30
|
+
operation: {
|
|
31
|
+
type: 'add',
|
|
32
|
+
frame,
|
|
33
|
+
value: parsedValue,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
const oldValueString = oldValueStrings[0];
|
|
39
|
+
const newValueString = newValueStrings[0];
|
|
40
|
+
const undoPropChange = `${key} keyframe removed at frame ${frame}`;
|
|
41
|
+
const redoPropChange = `${key} keyframe added at frame ${frame}`;
|
|
42
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
43
|
+
filePath: absolutePath,
|
|
44
|
+
oldContents: fileContents,
|
|
45
|
+
newContents: null,
|
|
46
|
+
logLevel,
|
|
47
|
+
remotionRoot,
|
|
48
|
+
logLine,
|
|
49
|
+
description: {
|
|
50
|
+
undoMessage: `↩️ ${undoPropChange}`,
|
|
51
|
+
redoMessage: `↪️ ${redoPropChange}`,
|
|
52
|
+
},
|
|
53
|
+
entryType: 'sequence-props',
|
|
54
|
+
suppressHmrOnFileRestore: true,
|
|
55
|
+
});
|
|
56
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
57
|
+
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
58
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
59
|
+
(0, log_update_1.logUpdate)({
|
|
60
|
+
fileRelativeToRoot,
|
|
61
|
+
line: logLine,
|
|
62
|
+
key,
|
|
63
|
+
oldValueString,
|
|
64
|
+
newValueString,
|
|
65
|
+
defaultValueString: null,
|
|
66
|
+
formatted,
|
|
67
|
+
logLevel,
|
|
68
|
+
removedProps: [],
|
|
69
|
+
addedProps: [],
|
|
70
|
+
});
|
|
71
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
72
|
+
const status = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
73
|
+
fileContents: output,
|
|
74
|
+
keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
|
|
75
|
+
nodePath: nodePath.nodePath,
|
|
76
|
+
effects: [],
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
canUpdate: true,
|
|
80
|
+
props: status.props,
|
|
81
|
+
results: [{ fileName, nodePath, props: status.props }],
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
exports.addSequenceKeyframeHandler = addSequenceKeyframeHandler;
|
|
@@ -68,6 +68,7 @@ const applyCodemodHandler = async ({ input: { codemod, dryRun, symbolicatedStack
|
|
|
68
68
|
(0, undo_stack_1.pushToUndoStack)({
|
|
69
69
|
filePath,
|
|
70
70
|
oldContents: input,
|
|
71
|
+
newContents: null,
|
|
71
72
|
logLevel,
|
|
72
73
|
remotionRoot,
|
|
73
74
|
logLine: (_a = symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalLineNumber) !== null && _a !== void 0 ? _a : 1,
|