@remotion/studio-server 4.0.468 → 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.
Files changed (49) hide show
  1. package/dist/codemods/delete-effect.d.ts +18 -0
  2. package/dist/codemods/delete-effect.js +95 -21
  3. package/dist/codemods/delete-jsx-node.d.ts +10 -0
  4. package/dist/codemods/delete-jsx-node.js +38 -14
  5. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +4 -0
  6. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +152 -0
  7. package/dist/codemods/update-keyframes/update-keyframes.d.ts +8 -0
  8. package/dist/codemods/update-keyframes/update-keyframes.js +98 -31
  9. package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +32 -10
  10. package/dist/codemods/update-sequence-props/update-sequence-props.js +39 -7
  11. package/dist/index.d.ts +2 -1
  12. package/dist/preview-server/api-routes.js +16 -0
  13. package/dist/preview-server/routes/add-effect-keyframe.d.ts +3 -0
  14. package/dist/preview-server/routes/add-effect-keyframe.js +91 -0
  15. package/dist/preview-server/routes/add-sequence-keyframe.d.ts +3 -0
  16. package/dist/preview-server/routes/add-sequence-keyframe.js +84 -0
  17. package/dist/preview-server/routes/apply-codemod.js +1 -0
  18. package/dist/preview-server/routes/apply-visual-control-change.js +1 -0
  19. package/dist/preview-server/routes/can-update-sequence-props.d.ts +0 -9
  20. package/dist/preview-server/routes/can-update-sequence-props.js +192 -24
  21. package/dist/preview-server/routes/composition-component-info.d.ts +3 -0
  22. package/dist/preview-server/routes/composition-component-info.js +26 -0
  23. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
  24. package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
  25. package/dist/preview-server/routes/delete-effect.js +76 -37
  26. package/dist/preview-server/routes/delete-jsx-node.js +67 -36
  27. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
  28. package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
  29. package/dist/preview-server/routes/duplicate-jsx-node.js +1 -0
  30. package/dist/preview-server/routes/open-in-editor.d.ts +4 -0
  31. package/dist/preview-server/routes/open-in-editor.js +40 -0
  32. package/dist/preview-server/routes/register-client-render.d.ts +3 -0
  33. package/dist/preview-server/routes/register-client-render.js +11 -0
  34. package/dist/preview-server/routes/save-effect-props.js +1 -0
  35. package/dist/preview-server/routes/save-sequence-props.js +161 -72
  36. package/dist/preview-server/routes/unregister-client-render.d.ts +4 -0
  37. package/dist/preview-server/routes/unregister-client-render.js +11 -0
  38. package/dist/preview-server/routes/update-default-props.js +1 -0
  39. package/dist/preview-server/start-server.d.ts +1 -0
  40. package/dist/preview-server/start-server.js +1 -0
  41. package/dist/preview-server/undo-stack.d.ts +26 -3
  42. package/dist/preview-server/undo-stack.js +130 -42
  43. package/dist/preview-server/validate-same-origin.d.ts +2 -0
  44. package/dist/preview-server/validate-same-origin.js +13 -0
  45. package/dist/routes.d.ts +2 -1
  46. package/dist/routes.js +9 -136
  47. package/dist/start-studio.d.ts +2 -1
  48. package/dist/start-studio.js +2 -1
  49. 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,33 +155,45 @@ 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 createInterpolateExpression({
153
- callee: existing.callee,
154
- input: existing.input,
155
- extraArgs: existing.extraArgs,
156
- keyframes: nextKeyframes,
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');
161
170
  }
162
- if (frame === 0) {
163
- throw new Error('Cannot add keyframe to static expression at frame 0 because interpolate requires two distinct frames');
164
- }
165
171
  const staticValue = (0, can_update_sequence_props_1.extractStaticValue)(expression);
166
172
  const staticOutput = (0, update_nested_prop_1.parseValueExpression)(staticValue);
167
- return createInterpolateExpression({
168
- callee: getInterpolationCalleeForValues({
169
- staticValue,
170
- newValue: value,
171
- }),
172
- input: b.identifier('frame'),
173
- extraArgs: [],
174
- keyframes: [
173
+ const keyframes = frame === 0
174
+ ? [{ frame, output: newOutput, value }]
175
+ : [
175
176
  { frame: 0, output: staticOutput, value: staticValue },
176
177
  { frame, output: newOutput, value },
177
- ],
178
+ ];
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);
@@ -187,9 +205,6 @@ const removeKeyframe = ({ expression, frame, }) => {
187
205
  throw new Error(`Cannot remove keyframe at frame ${frame}: not found`);
188
206
  }
189
207
  const nextKeyframes = existing.keyframes.filter((_keyframe, index) => index !== keyframeIndex);
190
- if (nextKeyframes.length === 1) {
191
- return (0, update_nested_prop_1.parseValueExpression)(nextKeyframes[0].value);
192
- }
193
208
  return createInterpolateExpression({
194
209
  callee: existing.callee,
195
210
  input: existing.input,
@@ -205,7 +220,10 @@ const applyKeyframeOperation = ({ expression, operation, }) => {
205
220
  value: operation.value,
206
221
  });
207
222
  }
208
- return removeKeyframe({ expression, frame: operation.frame });
223
+ return {
224
+ expression: removeKeyframe({ expression, frame: operation.frame }),
225
+ introduced: noIntroducedIdentifiers,
226
+ };
209
227
  };
210
228
  const getExpressionFromJsxAttribute = (attr) => {
211
229
  if (!attr.value) {
@@ -304,34 +322,55 @@ const updateSequenceKeyframesAst = ({ input, nodePath, updates, }) => {
304
322
  var _a;
305
323
  var _b;
306
324
  const ast = (0, parse_ast_1.parseAst)(input);
325
+ const jsxPath = (0, get_ast_node_path_1.getAstNodePath)(ast, nodePath);
307
326
  const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
308
- if (!node) {
327
+ if (!node || !jsxPath) {
309
328
  throw new Error('Could not find a JSX element at the specified location to update keyframes');
310
329
  }
311
330
  if (!node.attributes) {
312
331
  node.attributes = [];
313
332
  }
333
+ const requiredImports = new Set();
334
+ let needsFrameHook = false;
314
335
  const oldValueStrings = [];
336
+ const newValueStrings = [];
315
337
  for (const update of updates) {
316
338
  const prop = getSequenceWritableProp({
317
339
  attributes: node.attributes,
318
340
  key: update.key,
319
341
  });
320
342
  oldValueStrings.push(recast.print(prop.expression).code);
321
- prop.setExpression(applyKeyframeOperation({
343
+ const { expression: nextExpression, introduced } = applyKeyframeOperation({
322
344
  expression: prop.expression,
323
345
  operation: update.operation,
324
- }));
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
+ }
325
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);
326
364
  return {
327
365
  serialized: (0, parse_ast_1.serializeAst)(ast),
328
366
  oldValueStrings,
367
+ newValueStrings,
329
368
  logLine: (_b = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1,
330
369
  };
331
370
  };
332
371
  exports.updateSequenceKeyframesAst = updateSequenceKeyframesAst;
333
372
  const updateSequenceKeyframes = async ({ input, nodePath, updates, prettierConfigOverride, }) => {
334
- const { serialized, oldValueStrings, logLine } = (0, exports.updateSequenceKeyframesAst)({
373
+ const { serialized, oldValueStrings, newValueStrings, logLine } = (0, exports.updateSequenceKeyframesAst)({
335
374
  input,
336
375
  nodePath,
337
376
  updates,
@@ -340,15 +379,16 @@ const updateSequenceKeyframes = async ({ input, nodePath, updates, prettierConfi
340
379
  input: serialized,
341
380
  prettierConfigOverride,
342
381
  });
343
- return { output, formatted, oldValueStrings, logLine };
382
+ return { output, formatted, oldValueStrings, newValueStrings, logLine };
344
383
  };
345
384
  exports.updateSequenceKeyframes = updateSequenceKeyframes;
346
385
  const updateEffectKeyframesAst = ({ input, sequenceNodePath, effectIndex, updates, }) => {
347
386
  var _a, _b;
348
387
  var _c, _d, _e;
349
388
  const ast = (0, parse_ast_1.parseAst)(input);
389
+ const jsxPath = (0, get_ast_node_path_1.getAstNodePath)(ast, sequenceNodePath);
350
390
  const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
351
- if (!jsx) {
391
+ if (!jsx || !jsxPath) {
352
392
  throw new Error('Could not find a JSX element at the specified location to update effect keyframes');
353
393
  }
354
394
  const attr = (0, update_effect_props_1.findEffectsAttr)((_c = jsx.attributes) !== null && _c !== void 0 ? _c : []);
@@ -366,27 +406,47 @@ const updateEffectKeyframesAst = ({ input, sequenceNodePath, effectIndex, update
366
406
  }
367
407
  const objExpr = call.arguments[0];
368
408
  const oldValueStrings = [];
409
+ const newValueStrings = [];
410
+ const requiredImports = new Set();
411
+ let needsFrameHook = false;
369
412
  for (const update of updates) {
370
413
  const { prop } = findObjectProperty(objExpr, update.key);
371
414
  if (!prop) {
372
415
  throw new Error(`Cannot update keyframes: "${update.key}" is not set`);
373
416
  }
374
417
  oldValueStrings.push(recast.print(prop.value).code);
375
- prop.value = applyKeyframeOperation({
418
+ const { expression: nextExpression, introduced } = applyKeyframeOperation({
376
419
  expression: prop.value,
377
420
  operation: update.operation,
378
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
+ }
379
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);
380
439
  return {
381
440
  serialized: (0, parse_ast_1.serializeAst)(ast),
382
441
  oldValueStrings,
442
+ newValueStrings,
383
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,
384
444
  effectCallee,
385
445
  };
386
446
  };
387
447
  exports.updateEffectKeyframesAst = updateEffectKeyframesAst;
388
448
  const updateEffectKeyframes = async ({ input, sequenceNodePath, effectIndex, updates, prettierConfigOverride, }) => {
389
- const { serialized, oldValueStrings, logLine, effectCallee } = (0, exports.updateEffectKeyframesAst)({
449
+ const { serialized, oldValueStrings, newValueStrings, logLine, effectCallee } = (0, exports.updateEffectKeyframesAst)({
390
450
  input,
391
451
  sequenceNodePath,
392
452
  effectIndex,
@@ -396,6 +456,13 @@ const updateEffectKeyframes = async ({ input, sequenceNodePath, effectIndex, upd
396
456
  input: serialized,
397
457
  prettierConfigOverride,
398
458
  });
399
- return { output, formatted, oldValueStrings, logLine, effectCallee };
459
+ return {
460
+ output,
461
+ formatted,
462
+ oldValueStrings,
463
+ newValueStrings,
464
+ logLine,
465
+ effectCallee,
466
+ };
400
467
  };
401
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?: Record<string, unknown> | null | undefined;
29
- }) => Promise<{
30
- output: string;
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 updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
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,3 @@
1
+ import type { AddEffectKeyframeRequest, AddEffectKeyframeResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const addEffectKeyframeHandler: ApiHandler<AddEffectKeyframeRequest, AddEffectKeyframeResponse>;
@@ -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,3 @@
1
+ import type { AddSequenceKeyframeRequest, AddSequenceKeyframeResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const addSequenceKeyframeHandler: ApiHandler<AddSequenceKeyframeRequest, AddSequenceKeyframeResponse>;
@@ -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,