@remotion/studio-server 4.0.489 → 4.0.491

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 (48) hide show
  1. package/dist/better-opn/index.d.ts +4 -0
  2. package/dist/better-opn/index.js +152 -31
  3. package/dist/codemods/effect-param-expression.js +3 -0
  4. package/dist/codemods/paste-effects.d.ts +2 -1
  5. package/dist/codemods/paste-effects.js +33 -6
  6. package/dist/codemods/update-keyframes/update-keyframes.d.ts +10 -5
  7. package/dist/codemods/update-keyframes/update-keyframes.js +126 -46
  8. package/dist/codemods/update-nested-prop.d.ts +3 -2
  9. package/dist/codemods/update-nested-prop.js +17 -4
  10. package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +6 -3
  11. package/dist/codemods/update-sequence-props/update-sequence-props.js +51 -10
  12. package/dist/helpers/get-installed-installable-packages.js +4 -12
  13. package/dist/helpers/resolve-composition-component.js +1 -0
  14. package/dist/helpers/video-config-numeric-expression.d.ts +12 -0
  15. package/dist/helpers/video-config-numeric-expression.js +152 -0
  16. package/dist/helpers/video-config-values.d.ts +7 -0
  17. package/dist/helpers/video-config-values.js +84 -0
  18. package/dist/index.d.ts +1 -2
  19. package/dist/preview-server/element-install-state.d.ts +1 -0
  20. package/dist/preview-server/routes/add-effect-keyframe.js +6 -0
  21. package/dist/preview-server/routes/add-keyframes.js +2 -0
  22. package/dist/preview-server/routes/add-sequence-keyframe.js +2 -0
  23. package/dist/preview-server/routes/apply-codemod.d.ts +1 -0
  24. package/dist/preview-server/routes/apply-codemod.js +62 -13
  25. package/dist/preview-server/routes/can-update-effect-props.d.ts +8 -4
  26. package/dist/preview-server/routes/can-update-effect-props.js +26 -5
  27. package/dist/preview-server/routes/can-update-sequence-props.d.ts +9 -5
  28. package/dist/preview-server/routes/can-update-sequence-props.js +99 -30
  29. package/dist/preview-server/routes/delete-keyframes.js +8 -0
  30. package/dist/preview-server/routes/install-dependency.d.ts +1 -0
  31. package/dist/preview-server/routes/install-dependency.js +17 -15
  32. package/dist/preview-server/routes/move-keyframes.js +2 -0
  33. package/dist/preview-server/routes/paste-effects.js +2 -1
  34. package/dist/preview-server/routes/save-effect-props.js +5 -0
  35. package/dist/preview-server/routes/save-sequence-props.js +4 -0
  36. package/dist/preview-server/routes/subscribe-to-sequence-props.js +2 -1
  37. package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +1 -0
  38. package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -0
  39. package/dist/preview-server/routes/update-element-install-target.js +15 -1
  40. package/dist/preview-server/routes/update-sequence-keyframe-settings.js +3 -0
  41. package/dist/preview-server/sequence-props-watchers.d.ts +5 -3
  42. package/dist/preview-server/sequence-props-watchers.js +14 -5
  43. package/dist/preview-server/start-server.d.ts +0 -1
  44. package/dist/preview-server/start-server.js +0 -1
  45. package/dist/routes.js +2 -0
  46. package/dist/start-studio.d.ts +1 -2
  47. package/dist/start-studio.js +1 -2
  48. package/package.json +6 -6
@@ -1,12 +1,13 @@
1
1
  import type { Expression, File, JSXElement, JSXOpeningElement } from '@babel/types';
2
2
  import type { SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
3
- import type { CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, SequenceNodePath } from 'remotion';
3
+ import type { CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, SequenceNodePath, VideoConfigValues } from 'remotion';
4
+ import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
4
5
  type StaticValueOptions = {
5
6
  allowSpecialValues: boolean;
6
7
  };
7
8
  export declare const isStaticValue: (node: Expression, options?: StaticValueOptions) => boolean;
8
9
  export declare const extractStaticValue: (node: Expression, options?: StaticValueOptions) => unknown;
9
- export declare const getComputedStatus: (node: Expression, ast: File) => CanUpdateSequencePropStatus;
10
+ export declare const getComputedStatus: (node: Expression, ast: File, videoConfigValues: VideoConfigIdentifierValues) => CanUpdateSequencePropStatus;
10
11
  export declare const findJsxElementPathAtNodePath: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
11
12
  export declare const findJsxElementAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXOpeningElement | null;
12
13
  export declare const findJsxElementNodeAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXElement | null;
@@ -22,22 +23,24 @@ export declare const hasJsxChildrenAttribute: (jsxElement: JSXOpeningElement) =>
22
23
  export declare const getStaticJsxTextContent: (jsxElement: JSXElement) => StaticJsxTextContent | null;
23
24
  export declare const findNodePathForJsxElement: (ast: File, target: JSXOpeningElement) => SequenceNodePath | null;
24
25
  export declare const lineColumnToNodePath: (ast: File, targetLine: number) => SequenceNodePath | null;
25
- export declare const computeSequencePropsStatusFromContent: ({ fileContents, nodePath, componentIdentity, keys, effects, }: {
26
+ export declare const computeSequencePropsStatusFromContent: ({ fileContents, nodePath, componentIdentity, keys, effects, videoConfigValues, }: {
26
27
  fileContents: string;
27
28
  nodePath: SequenceNodePath;
28
29
  componentIdentity: string | null;
29
30
  keys: string[];
30
31
  effects: string[][];
32
+ videoConfigValues: VideoConfigValues | null;
31
33
  }) => CanUpdateSequencePropsResponseTrue;
32
- export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, effects, remotionRoot, }: {
34
+ export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, effects, remotionRoot, videoConfigValues, }: {
33
35
  fileName: string;
34
36
  nodePath: SequenceNodePath;
35
37
  componentIdentity: string | null;
36
38
  keys: string[];
37
39
  effects: string[][];
38
40
  remotionRoot: string;
41
+ videoConfigValues: VideoConfigValues | null;
39
42
  }) => CanUpdateSequencePropsResponseTrue;
40
- export declare const computeSequencePropsStatusFromFilenameByLine: ({ fileName, line, componentIdentity, keys, effects, remotionRoot, logLevel, }: {
43
+ export declare const computeSequencePropsStatusFromFilenameByLine: ({ fileName, line, componentIdentity, keys, effects, remotionRoot, logLevel, videoConfigValues, }: {
41
44
  fileName: string;
42
45
  line: number;
43
46
  componentIdentity: string | null;
@@ -45,5 +48,6 @@ export declare const computeSequencePropsStatusFromFilenameByLine: ({ fileName,
45
48
  effects: string[][];
46
49
  remotionRoot: string;
47
50
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
51
+ videoConfigValues: VideoConfigValues;
48
52
  }) => SubscribeToSequencePropsResponse;
49
53
  export {};
@@ -44,12 +44,17 @@ const get_ast_node_path_1 = require("../../helpers/get-ast-node-path");
44
44
  const import_agnostic_node_path_1 = require("../../helpers/import-agnostic-node-path");
45
45
  const parse_keyframe_easing_expression_1 = require("../../helpers/parse-keyframe-easing-expression");
46
46
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
47
+ const video_config_numeric_expression_1 = require("../../helpers/video-config-numeric-expression");
48
+ const video_config_values_1 = require("../../helpers/video-config-values");
47
49
  const jsx_component_identity_1 = require("../jsx-component-identity");
48
50
  const jsx_element_not_found_at_location_error_1 = require("../jsx-element-not-found-at-location-error");
49
51
  const can_update_effect_props_1 = require("./can-update-effect-props");
50
- const staticStatus = (codeValue) => ({
52
+ const staticStatus = (codeValue, numericExpression) => ({
51
53
  status: 'static',
52
54
  codeValue,
55
+ ...(numericExpression === null || numericExpression.type === 'literal'
56
+ ? {}
57
+ : { numericExpression }),
53
58
  });
54
59
  const computedStatus = () => ({
55
60
  status: 'computed',
@@ -201,6 +206,18 @@ const getExtrapolateType = (node) => {
201
206
  }
202
207
  return null;
203
208
  };
209
+ const getInterpolateOutputOption = (node) => {
210
+ if (node.type === 'StringLiteral') {
211
+ if (node.value === 'linear' || node.value === 'perceptual-scale') {
212
+ return node.value;
213
+ }
214
+ return null;
215
+ }
216
+ if (node.type === 'TSAsExpression') {
217
+ return getInterpolateOutputOption(node.expression);
218
+ }
219
+ return null;
220
+ };
204
221
  const getKeyframeEasing = (node) => (0, parse_keyframe_easing_expression_1.parseKeyframeEasingExpression)(node);
205
222
  const getKeyframeEasingArray = ({ easingNode, segments, }) => {
206
223
  if (segments === 0) {
@@ -248,6 +265,7 @@ const getInterpolationMetadata = (interpolationFunction, callExpression, keyfram
248
265
  easing: Array.from({ length: segments }, () => studio_shared_1.LINEAR_KEYFRAME_EASING),
249
266
  clamping: defaultClamping,
250
267
  posterize: undefined,
268
+ output: undefined,
251
269
  };
252
270
  const optionsArg = callExpression.arguments[3];
253
271
  if (!optionsArg) {
@@ -259,6 +277,7 @@ const getInterpolationMetadata = (interpolationFunction, callExpression, keyfram
259
277
  let { easing } = defaults;
260
278
  let { clamping } = defaults;
261
279
  let posterize;
280
+ let { output } = defaults;
262
281
  for (const property of optionsArg.properties) {
263
282
  if (property.type !== 'ObjectProperty' || property.computed) {
264
283
  return null;
@@ -307,17 +326,29 @@ const getInterpolationMetadata = (interpolationFunction, callExpression, keyfram
307
326
  posterize = parsedPosterize;
308
327
  continue;
309
328
  }
329
+ if (key === 'output') {
330
+ if (interpolationFunction === 'interpolateColors') {
331
+ return null;
332
+ }
333
+ const parsedOutput = getInterpolateOutputOption(value);
334
+ if (!parsedOutput) {
335
+ return null;
336
+ }
337
+ output = parsedOutput;
338
+ continue;
339
+ }
310
340
  return null;
311
341
  }
312
342
  return {
313
343
  easing,
314
344
  clamping,
315
345
  posterize,
346
+ output,
316
347
  };
317
348
  };
318
- const getInterpolationKeyframes = (node, ast) => {
349
+ const getInterpolationKeyframes = (node, ast, videoConfigValues) => {
319
350
  if (node.type === 'TSAsExpression') {
320
- return getInterpolationKeyframes(node.expression, ast);
351
+ return getInterpolationKeyframes(node.expression, ast, videoConfigValues);
321
352
  }
322
353
  if (node.type === 'CallExpression' &&
323
354
  node.callee.type === 'Identifier' &&
@@ -326,7 +357,7 @@ const getInterpolationKeyframes = (node, ast) => {
326
357
  node.arguments[0].type !== 'ArgumentPlaceholder' &&
327
358
  node.arguments[0].type !== 'JSXNamespacedName' &&
328
359
  node.arguments[0].type !== 'SpreadElement') {
329
- const interpolation = getInterpolationKeyframes(node.arguments[0], ast);
360
+ const interpolation = getInterpolationKeyframes(node.arguments[0], ast, videoConfigValues);
330
361
  if (!interpolation) {
331
362
  return undefined;
332
363
  }
@@ -372,13 +403,17 @@ const getInterpolationKeyframes = (node, ast) => {
372
403
  outputElement.type === 'SpreadElement') {
373
404
  return undefined;
374
405
  }
375
- const frame = getNumericValue(inputElement);
376
- if (frame === null || !(0, exports.isStaticValue)(outputElement)) {
406
+ const frameExpression = (0, video_config_numeric_expression_1.parseVideoConfigNumericExpression)({
407
+ node: inputElement,
408
+ videoConfigValues,
409
+ });
410
+ if (frameExpression === null || !(0, exports.isStaticValue)(outputElement)) {
377
411
  return undefined;
378
412
  }
379
413
  keyframes.push({
380
- frame,
414
+ frame: frameExpression.value,
381
415
  value: (0, exports.extractStaticValue)(outputElement),
416
+ ...(frameExpression.type === 'literal' ? {} : { frameExpression }),
382
417
  });
383
418
  }
384
419
  if (keyframes.length === 0) {
@@ -394,6 +429,7 @@ const getInterpolationKeyframes = (node, ast) => {
394
429
  easing: metadata.easing,
395
430
  clamping: metadata.clamping,
396
431
  posterize: metadata.posterize,
432
+ output: metadata.output,
397
433
  };
398
434
  };
399
435
  const isUseCurrentFrameCall = (node) => {
@@ -428,8 +464,8 @@ const isCurrentFrameIdentifier = (node, ast) => {
428
464
  });
429
465
  return hasUseCurrentFrameDeclaration && !hasOtherDeclaration;
430
466
  };
431
- const getComputedStatus = (node, ast) => {
432
- const interpolation = getInterpolationKeyframes(node, ast);
467
+ const getComputedStatus = (node, ast, videoConfigValues) => {
468
+ const interpolation = getInterpolationKeyframes(node, ast, videoConfigValues);
433
469
  if (!interpolation) {
434
470
  return computedStatus();
435
471
  }
@@ -440,10 +476,11 @@ const getComputedStatus = (node, ast) => {
440
476
  easing: interpolation.easing,
441
477
  clamping: interpolation.clamping,
442
478
  posterize: interpolation.posterize,
479
+ output: interpolation.output,
443
480
  };
444
481
  };
445
482
  exports.getComputedStatus = getComputedStatus;
446
- const getPropsStatus = (jsxElement, ast) => {
483
+ const getPropsStatus = (jsxElement, ast, videoConfigValues) => {
447
484
  const props = {};
448
485
  for (const attr of jsxElement.attributes) {
449
486
  if (attr.type === 'JSXSpreadAttribute') {
@@ -458,11 +495,11 @@ const getPropsStatus = (jsxElement, ast) => {
458
495
  }
459
496
  const { value } = attr;
460
497
  if (!value) {
461
- props[name] = staticStatus(true);
498
+ props[name] = staticStatus(true, null);
462
499
  continue;
463
500
  }
464
501
  if (value.type === 'StringLiteral') {
465
- props[name] = staticStatus(value.value);
502
+ props[name] = staticStatus(value.value, null);
466
503
  continue;
467
504
  }
468
505
  if (value.type === 'JSXExpressionContainer') {
@@ -472,10 +509,16 @@ const getPropsStatus = (jsxElement, ast) => {
472
509
  continue;
473
510
  }
474
511
  if (!(0, exports.isStaticValue)(expression)) {
475
- props[name] = (0, exports.getComputedStatus)(expression, ast);
512
+ const numericExpression = (0, video_config_numeric_expression_1.parseVideoConfigNumericExpression)({
513
+ node: expression,
514
+ videoConfigValues,
515
+ });
516
+ props[name] = numericExpression
517
+ ? staticStatus(numericExpression.value, numericExpression)
518
+ : (0, exports.getComputedStatus)(expression, ast, videoConfigValues);
476
519
  continue;
477
520
  }
478
- props[name] = staticStatus((0, exports.extractStaticValue)(expression));
521
+ props[name] = staticStatus((0, exports.extractStaticValue)(expression), null);
479
522
  continue;
480
523
  }
481
524
  props[name] = computedStatus();
@@ -623,13 +666,13 @@ const validateStyleValue = (childKey, value) => {
623
666
  }
624
667
  return true;
625
668
  };
626
- const getNestedPropStatus = (jsxElement, ast, parentKey, childKey) => {
669
+ const getNestedPropStatus = ({ jsxElement, ast, parentKey, childKey, videoConfigValues, }) => {
627
670
  const attr = jsxElement.attributes.find((a) => a.type !== 'JSXSpreadAttribute' &&
628
671
  a.name.type !== 'JSXNamespacedName' &&
629
672
  a.name.name === parentKey);
630
673
  if (!attr || !attr.value) {
631
674
  // Parent attribute doesn't exist, nested prop can be added
632
- return staticStatus(undefined);
675
+ return staticStatus(undefined, null);
633
676
  }
634
677
  if (attr.value.type !== 'JSXExpressionContainer') {
635
678
  return computedStatus();
@@ -646,34 +689,41 @@ const getNestedPropStatus = (jsxElement, ast, parentKey, childKey) => {
646
689
  (p.key.type === 'StringLiteral' && p.key.value === childKey)));
647
690
  if (!prop) {
648
691
  // Property not set in the object, can be added
649
- return staticStatus(undefined);
692
+ return staticStatus(undefined, null);
650
693
  }
651
694
  const propValue = prop.value;
652
695
  if (!(0, exports.isStaticValue)(propValue)) {
653
- return (0, exports.getComputedStatus)(propValue, ast);
696
+ const numericExpression = (0, video_config_numeric_expression_1.parseVideoConfigNumericExpression)({
697
+ node: propValue,
698
+ videoConfigValues,
699
+ });
700
+ return numericExpression
701
+ ? staticStatus(numericExpression.value, numericExpression)
702
+ : (0, exports.getComputedStatus)(propValue, ast, videoConfigValues);
654
703
  }
655
704
  const propStatus = (0, exports.extractStaticValue)(propValue);
656
705
  if (!validateStyleValue(childKey, propStatus)) {
657
706
  return computedStatus();
658
707
  }
659
- return staticStatus(propStatus);
708
+ return staticStatus(propStatus, null);
660
709
  };
661
- const computeEffectsForJsx = ({ ast, jsxElement, effects, }) => {
710
+ const computeEffectsForJsx = ({ ast, jsxElement, effects, videoConfigValues, }) => {
662
711
  return effects.map((effect, effectIndex) => (0, can_update_effect_props_1.computeEffectPropStatus)({
663
712
  ast,
664
713
  jsx: jsxElement,
665
714
  effectIndex,
666
715
  keys: effect,
716
+ videoConfigValues,
667
717
  }));
668
718
  };
669
- const computeSequenceOnlyPropsRecord = ({ jsxElement, jsxElementNode, ast, keys, }) => {
670
- const allProps = getPropsStatus(jsxElement, ast);
719
+ const computeSequenceOnlyPropsRecord = ({ jsxElement, jsxElementNode, ast, keys, videoConfigValues, }) => {
720
+ const allProps = getPropsStatus(jsxElement, ast, videoConfigValues);
671
721
  const filteredProps = {};
672
722
  for (const key of keys) {
673
723
  if (key === 'children') {
674
724
  const staticChildrenAttribute = (0, exports.getStaticJsxChildrenAttribute)(jsxElement);
675
725
  if (staticChildrenAttribute) {
676
- filteredProps[key] = staticStatus(staticChildrenAttribute.value);
726
+ filteredProps[key] = staticStatus(staticChildrenAttribute.value, null);
677
727
  continue;
678
728
  }
679
729
  if ((0, exports.hasJsxChildrenAttribute)(jsxElement)) {
@@ -682,26 +732,36 @@ const computeSequenceOnlyPropsRecord = ({ jsxElement, jsxElementNode, ast, keys,
682
732
  }
683
733
  const staticTextContent = (0, exports.getStaticJsxTextContent)(jsxElementNode);
684
734
  filteredProps[key] = staticTextContent
685
- ? staticStatus(staticTextContent.value)
735
+ ? staticStatus(staticTextContent.value, null)
686
736
  : computedStatus();
687
737
  continue;
688
738
  }
689
739
  const dotIndex = key.indexOf('.');
690
740
  if (dotIndex !== -1) {
691
- filteredProps[key] = getNestedPropStatus(jsxElement, ast, key.slice(0, dotIndex), key.slice(dotIndex + 1));
741
+ filteredProps[key] = getNestedPropStatus({
742
+ jsxElement,
743
+ ast,
744
+ parentKey: key.slice(0, dotIndex),
745
+ childKey: key.slice(dotIndex + 1),
746
+ videoConfigValues,
747
+ });
692
748
  }
693
749
  else if (key in allProps) {
694
750
  filteredProps[key] = allProps[key];
695
751
  }
696
752
  else {
697
- filteredProps[key] = staticStatus(undefined);
753
+ filteredProps[key] = staticStatus(undefined, null);
698
754
  }
699
755
  }
700
756
  return filteredProps;
701
757
  };
702
- const computeSequencePropsStatusFromContent = ({ fileContents, nodePath, componentIdentity, keys, effects, }) => {
758
+ const computeSequencePropsStatusFromContent = ({ fileContents, nodePath, componentIdentity, keys, effects, videoConfigValues, }) => {
703
759
  var _a;
704
760
  const ast = (0, parse_ast_1.parseAst)(fileContents);
761
+ const videoConfigIdentifierValues = (0, video_config_values_1.getVideoConfigIdentifierValues)({
762
+ ast,
763
+ videoConfigValues,
764
+ });
705
765
  const jsxElementNode = (0, exports.findJsxElementNodeAtNodePath)(ast, nodePath);
706
766
  const jsxElement = (_a = jsxElementNode === null || jsxElementNode === void 0 ? void 0 : jsxElementNode.openingElement) !== null && _a !== void 0 ? _a : null;
707
767
  if (!jsxElement || !jsxElementNode) {
@@ -718,8 +778,14 @@ const computeSequencePropsStatusFromContent = ({ fileContents, nodePath, compone
718
778
  jsxElementNode,
719
779
  ast,
720
780
  keys,
781
+ videoConfigValues: videoConfigIdentifierValues,
782
+ });
783
+ const effectsStatuses = computeEffectsForJsx({
784
+ ast,
785
+ jsxElement,
786
+ effects,
787
+ videoConfigValues: videoConfigIdentifierValues,
721
788
  });
722
- const effectsStatuses = computeEffectsForJsx({ ast, jsxElement, effects });
723
789
  return {
724
790
  canUpdate: true,
725
791
  props: filteredProps,
@@ -727,7 +793,7 @@ const computeSequencePropsStatusFromContent = ({ fileContents, nodePath, compone
727
793
  };
728
794
  };
729
795
  exports.computeSequencePropsStatusFromContent = computeSequencePropsStatusFromContent;
730
- const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, keys, effects, remotionRoot, }) => {
796
+ const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, keys, effects, remotionRoot, videoConfigValues, }) => {
731
797
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
732
798
  remotionRoot,
733
799
  fileName,
@@ -740,10 +806,11 @@ const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, key
740
806
  componentIdentity,
741
807
  keys,
742
808
  effects,
809
+ videoConfigValues,
743
810
  });
744
811
  };
745
812
  exports.computeSequencePropsStatus = computeSequencePropsStatus;
746
- const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, componentIdentity, keys, effects, remotionRoot, logLevel, }) => {
813
+ const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, componentIdentity, keys, effects, remotionRoot, logLevel, videoConfigValues, }) => {
747
814
  try {
748
815
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
749
816
  remotionRoot,
@@ -770,12 +837,14 @@ const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, componen
770
837
  keys,
771
838
  effects,
772
839
  remotionRoot,
840
+ videoConfigValues,
773
841
  }),
774
842
  nodePath: {
775
843
  absolutePath,
776
844
  nodePath: resolvedNodePath,
777
845
  sequenceKeys: keys,
778
846
  effectKeys: effects,
847
+ videoConfigValues,
779
848
  },
780
849
  success: true,
781
850
  };
@@ -8,6 +8,7 @@ const parse_ast_1 = require("../../codemods/parse-ast");
8
8
  const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
9
9
  const file_watcher_1 = require("../../file-watcher");
10
10
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
11
+ const video_config_values_1 = require("../../helpers/video-config-values");
11
12
  const undo_stack_1 = require("../undo-stack");
12
13
  const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
13
14
  const can_update_effect_props_1 = require("./can-update-effect-props");
@@ -95,6 +96,7 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
95
96
  const result = await (0, update_keyframes_1.updateSequenceKeyframes)({
96
97
  input: output,
97
98
  nodePath: firstSequenceKeyframe.nodePath.nodePath,
99
+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,
98
100
  updates: keyframeGroup.map((keyframe) => ({
99
101
  key: keyframe.key,
100
102
  operation: {
@@ -125,6 +127,7 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
125
127
  input: output,
126
128
  sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,
127
129
  effectIndex: firstEffectKeyframe.effectIndex,
130
+ videoConfigValues: firstEffectKeyframe.sequenceNodePath.videoConfigValues,
128
131
  updates: keyframeGroup.map((keyframe) => ({
129
132
  key: keyframe.key,
130
133
  operation: {
@@ -217,6 +220,7 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
217
220
  nodePath: keyframe.nodePath.nodePath,
218
221
  componentIdentity: null,
219
222
  effects: [],
223
+ videoConfigValues: keyframe.nodePath.videoConfigValues,
220
224
  });
221
225
  return {
222
226
  fileName: keyframe.fileName,
@@ -246,6 +250,10 @@ const deleteKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, r
246
250
  jsx,
247
251
  effectIndex: keyframe.effectIndex,
248
252
  keys: (0, studio_shared_1.getAllSchemaKeys)(keyframe.schema),
253
+ videoConfigValues: (0, video_config_values_1.getVideoConfigIdentifierValues)({
254
+ ast,
255
+ videoConfigValues: keyframe.sequenceNodePath.videoConfigValues,
256
+ }),
249
257
  });
250
258
  });
251
259
  return { sequenceResults, effectResults };
@@ -1,3 +1,4 @@
1
1
  import { type InstallPackageRequest, type InstallPackageResponse } from '@remotion/studio-shared';
2
2
  import type { ApiHandler } from '../api-types';
3
+ export declare const getPackageInstallSpec: (packageName: string) => string;
3
4
  export declare const handleInstallPackage: ApiHandler<InstallPackageRequest, InstallPackageResponse>;
@@ -1,24 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleInstallPackage = void 0;
3
+ exports.handleInstallPackage = exports.getPackageInstallSpec = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const renderer_1 = require("@remotion/renderer");
6
6
  const studio_shared_1 = require("@remotion/studio-shared");
7
7
  const version_1 = require("remotion/version");
8
8
  const install_command_1 = require("../../helpers/install-command");
9
9
  const get_package_manager_1 = require("../get-package-manager");
10
- const extraPackageNames = studio_shared_1.extraPackages.map((pkg) => pkg.name);
11
- const isExtraPackage = (packageName) => {
12
- return extraPackageNames.includes(packageName);
13
- };
14
10
  const getExtraPackageVersion = (packageName) => {
15
11
  const pkg = studio_shared_1.extraPackages.find((p) => p.name === packageName);
16
12
  return pkg ? pkg.version : null;
17
13
  };
14
+ const getPackageInstallSpec = (packageName) => {
15
+ const extraVersion = getExtraPackageVersion(packageName);
16
+ if (extraVersion) {
17
+ return `${packageName}@${extraVersion}`;
18
+ }
19
+ if (packageName === 'remotion' || packageName.startsWith('@remotion/')) {
20
+ return `${packageName}@${version_1.VERSION}`;
21
+ }
22
+ return packageName;
23
+ };
24
+ exports.getPackageInstallSpec = getPackageInstallSpec;
18
25
  const handleInstallPackage = async ({ logLevel, remotionRoot, input: { packageNames } }) => {
19
26
  for (const packageName of packageNames) {
20
- if (!packageName.startsWith('@remotion/') && !isExtraPackage(packageName)) {
21
- return Promise.reject(new Error(`Package ${packageName} is not allowed to be installed.`));
27
+ if (!(0, studio_shared_1.isValidPackageName)(packageName)) {
28
+ return Promise.reject(new Error(`Package name ${JSON.stringify(packageName)} is invalid.`));
22
29
  }
23
30
  }
24
31
  const manager = (0, get_package_manager_1.getPackageManager)({
@@ -32,14 +39,9 @@ const handleInstallPackage = async ({ logLevel, remotionRoot, input: { packageNa
32
39
  .map((p) => p.path)
33
40
  .join(', ')}). Install dependencies using your favorite manager!`);
34
41
  }
35
- // Build packages with appropriate versions
36
- const packagesWithVersions = packageNames.map((pkg) => {
37
- const extraVersion = getExtraPackageVersion(pkg);
38
- if (extraVersion) {
39
- return `${pkg}@${extraVersion}`;
40
- }
41
- return `${pkg}@${version_1.VERSION}`;
42
- });
42
+ // Remotion packages must match the Studio version and catalogued extra
43
+ // packages use their supported version. Other packages resolve normally.
44
+ const packagesWithVersions = packageNames.map(exports.getPackageInstallSpec);
43
45
  const command = (0, install_command_1.getInstallCommand)({
44
46
  manager: manager.manager,
45
47
  packages: packagesWithVersions,
@@ -111,6 +111,7 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
111
111
  input: output,
112
112
  nodePath: firstSequenceKeyframe.nodePath.nodePath,
113
113
  schema: firstSequenceKeyframe.schema,
114
+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,
114
115
  updates,
115
116
  });
116
117
  output = result.output;
@@ -152,6 +153,7 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
152
153
  sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,
153
154
  effectIndex: firstEffectKeyframe.effectIndex,
154
155
  schema: firstEffectKeyframe.schema,
156
+ videoConfigValues: firstEffectKeyframe.sequenceNodePath.videoConfigValues,
155
157
  updates,
156
158
  });
157
159
  output = result.output;
@@ -17,7 +17,7 @@ const getPastedEffectDescription = (effectLabels) => {
17
17
  }
18
18
  return `${effectLabels.length} effects`;
19
19
  };
20
- const pasteEffectsHandler = ({ input: { targetFileName, targetSequenceNodePath, type, effects, clientId }, remotionRoot, logLevel, }) => {
20
+ const pasteEffectsHandler = ({ input: { targetFileName, targetSequenceNodePath, type, effects, clientId, insertAtIndices, }, remotionRoot, logLevel, }) => {
21
21
  return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
22
22
  try {
23
23
  if (effects.length === 0 && type !== 'effects-replacing') {
@@ -36,6 +36,7 @@ const pasteEffectsHandler = ({ input: { targetFileName, targetSequenceNodePath,
36
36
  targetSequenceNodePath: targetSequenceNodePath.nodePath,
37
37
  type,
38
38
  effects,
39
+ insertAtIndices,
39
40
  });
40
41
  const effectDescription = getPastedEffectDescription(effectLabels);
41
42
  (0, undo_stack_1.pushToUndoStack)({
@@ -8,6 +8,7 @@ const parse_ast_1 = require("../../codemods/parse-ast");
8
8
  const update_effect_props_1 = require("../../codemods/update-effect-props/update-effect-props");
9
9
  const file_watcher_1 = require("../../file-watcher");
10
10
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
11
+ const video_config_values_1 = require("../../helpers/video-config-values");
11
12
  const undo_stack_1 = require("../undo-stack");
12
13
  const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
13
14
  const can_update_effect_props_1 = require("./can-update-effect-props");
@@ -122,6 +123,10 @@ const saveEffectPropsHandler = ({ input, remotionRoot, logLevel }) => (0, source
122
123
  jsx,
123
124
  effectIndex,
124
125
  keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
126
+ videoConfigValues: (0, video_config_values_1.getVideoConfigIdentifierValues)({
127
+ ast,
128
+ videoConfigValues: sequenceNodePath.videoConfigValues,
129
+ }),
125
130
  });
126
131
  });
127
132
  exports.saveEffectPropsHandler = saveEffectPropsHandler;
@@ -50,6 +50,7 @@ const convertSequencePropEditToCodemodChange = (edit) => {
50
50
  },
51
51
  ],
52
52
  schema: edit.schema,
53
+ videoConfigValues: edit.nodePath.videoConfigValues,
53
54
  };
54
55
  };
55
56
  exports.convertSequencePropEditToCodemodChange = convertSequencePropEditToCodemodChange;
@@ -182,6 +183,7 @@ const saveSequencePropsHandler = ({ input: { edits, movedKeyframes = { sequenceK
182
183
  input: output,
183
184
  nodePath: firstSequenceKeyframe.nodePath.nodePath,
184
185
  schema: firstSequenceKeyframe.schema,
186
+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,
185
187
  updates,
186
188
  });
187
189
  output = result.output;
@@ -223,6 +225,7 @@ const saveSequencePropsHandler = ({ input: { edits, movedKeyframes = { sequenceK
223
225
  sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,
224
226
  effectIndex: firstEffectKeyframe.effectIndex,
225
227
  schema: firstEffectKeyframe.schema,
228
+ videoConfigValues: firstEffectKeyframe.sequenceNodePath.videoConfigValues,
226
229
  updates,
227
230
  });
228
231
  output = result.output;
@@ -331,6 +334,7 @@ const saveSequencePropsHandler = ({ input: { edits, movedKeyframes = { sequenceK
331
334
  nodePath: edit.nodePath.nodePath,
332
335
  componentIdentity: null,
333
336
  effects: [],
337
+ videoConfigValues: edit.nodePath.videoConfigValues,
334
338
  });
335
339
  return {
336
340
  fileName: edit.fileName,
@@ -2,7 +2,7 @@
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, nodePath, componentIdentity, keys, effects, clientId, }, remotionRoot, logLevel, }) => {
5
+ const subscribeToSequenceProps = ({ input: { fileName, line, column, nodePath, componentIdentity, keys, effects, clientId, videoConfigValues, }, remotionRoot, logLevel, }) => {
6
6
  const result = (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
7
7
  fileName,
8
8
  line,
@@ -13,6 +13,7 @@ const subscribeToSequenceProps = ({ input: { fileName, line, column, nodePath, c
13
13
  effects,
14
14
  remotionRoot,
15
15
  clientId,
16
+ videoConfigValues,
16
17
  logLevel,
17
18
  });
18
19
  return Promise.resolve(result);
@@ -10,6 +10,7 @@ const unsubscribeFromSequenceProps = ({ input: { fileName, nodePath, clientId, s
10
10
  clientId,
11
11
  sequenceKeys,
12
12
  effectKeys,
13
+ videoConfigValues: nodePath.videoConfigValues,
13
14
  });
14
15
  return Promise.resolve(undefined);
15
16
  };
@@ -8,6 +8,7 @@ const parse_ast_1 = require("../../codemods/parse-ast");
8
8
  const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
9
9
  const file_watcher_1 = require("../../file-watcher");
10
10
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
11
+ const video_config_values_1 = require("../../helpers/video-config-values");
11
12
  const undo_stack_1 = require("../undo-stack");
12
13
  const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
13
14
  const can_update_effect_props_1 = require("./can-update-effect-props");
@@ -27,6 +28,7 @@ const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePa
27
28
  sequenceNodePath: sequenceNodePath.nodePath,
28
29
  effectIndex,
29
30
  schema,
31
+ videoConfigValues: sequenceNodePath.videoConfigValues,
30
32
  updates: [
31
33
  {
32
34
  key,
@@ -35,6 +37,7 @@ const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePa
35
37
  type: 'settings',
36
38
  clamping: settings.clamping,
37
39
  posterize: settings.posterize,
40
+ output: settings.output,
38
41
  }
39
42
  : {
40
43
  type: 'easing',
@@ -91,6 +94,10 @@ const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePa
91
94
  jsx,
92
95
  effectIndex,
93
96
  keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
97
+ videoConfigValues: (0, video_config_values_1.getVideoConfigIdentifierValues)({
98
+ ast,
99
+ videoConfigValues: sequenceNodePath.videoConfigValues,
100
+ }),
94
101
  });
95
102
  });
96
103
  exports.updateEffectKeyframeSettingsHandler = updateEffectKeyframeSettingsHandler;