Skip to content

🎥 Make videos programmatically with React

remove enumpaths

Jonny Burger597b876573c8
diff --git a/packages/studio-server/src/codemods/update-nested-prop.ts b/packages/studio-server/src/codemods/update-nested-prop.ts
index 639b6c78de..6dcfdccc22 100644
--- a/packages/studio-server/src/codemods/update-nested-prop.ts
+++ b/packages/studio-server/src/codemods/update-nested-prop.ts
@@ -11,20 +11,17 @@ import type {
ObjectProperty,
StringLiteral,
} from '@babel/types';
-import {stringifyDefaultProps, type EnumPath} from '@remotion/studio-shared';
+import {stringifyDefaultProps} from '@remotion/studio-shared';
import type {ExpressionKind} from 'ast-types/lib/gen/kinds';
import * as recast from 'recast';
import {parseAst} from './parse-ast';
const b = recast.types.builders;
-export const parseValueExpression = (
- value: unknown,
- enumPaths: EnumPath[],
-): ExpressionKind => {
+export const parseValueExpression = (value: unknown): ExpressionKind => {
return (
(
- parseAst(`a = ${stringifyDefaultProps({props: value, enumPaths})}`)
+ parseAst(`a = ${stringifyDefaultProps({props: value, enumPaths: []})}`)
.program.body[0] as unknown as ExpressionStatement
).expression as AssignmentExpression
).right as ExpressionKind;
@@ -155,16 +152,14 @@ const setNestedProp = ({
parentKey,
childKey,
value,
- enumPaths,
}: {
attr: JSXAttribute | undefined;
attributes: (JSXAttribute | JSXSpreadAttribute)[];
parentKey: string;
childKey: string;
value: unknown;
- enumPaths: EnumPath[];
}) => {
- const parsedValue = parseValueExpression(value, enumPaths);
+ const parsedValue = parseValueExpression(value);
if (attr) {
const objExpr = getObjectExpression(attr);
@@ -199,7 +194,6 @@ export const updateNestedProp = ({
parentKey,
childKey,
value,
- enumPaths,
defaultValue,
isDefault,
}: {
@@ -207,7 +201,6 @@ export const updateNestedProp = ({
parentKey: string;
childKey: string;
value: unknown;
- enumPaths: EnumPath[];
defaultValue: unknown | null;
isDefault: boolean;
}): string => {
@@ -223,7 +216,7 @@ export const updateNestedProp = ({
if (isDefault) {
removeNestedProp({attr, attrIndex, attributes, childKey});
} else {
- setNestedProp({attr, attributes, parentKey, childKey, value, enumPaths});
+ setNestedProp({attr, attributes, parentKey, childKey, value});
}
return oldValueString;
diff --git a/packages/studio-server/src/codemods/update-sequence-props.ts b/packages/studio-server/src/codemods/update-sequence-props.ts
index 69424d999d..de9280df30 100644
--- a/packages/studio-server/src/codemods/update-sequence-props.ts
+++ b/packages/studio-server/src/codemods/update-sequence-props.ts
@@ -6,7 +6,7 @@ import type {
JSXSpreadAttribute,
StringLiteral,
} from '@babel/types';
-import type {EnumPath, SequenceNodePath} from '@remotion/studio-shared';
+import type {SequenceNodePath} from '@remotion/studio-shared';
import * as recast from 'recast';
import {findJsxElementAtNodePath} from '../preview-server/routes/can-update-sequence-props';
import {parseAst, serializeAst} from './parse-ast';
@@ -19,7 +19,6 @@ export const updateSequenceProps = async ({
nodePath,
key,
value,
- enumPaths,
defaultValue,
prettierConfigOverride,
}: {
@@ -27,7 +26,6 @@ export const updateSequenceProps = async ({
nodePath: SequenceNodePath;
key: string;
value: unknown;
- enumPaths: EnumPath[];
defaultValue: unknown | null;
prettierConfigOverride?: Record<string, unknown> | null;
}): Promise<{
@@ -60,7 +58,6 @@ export const updateSequenceProps = async ({
parentKey,
childKey,
value,
- enumPaths,
defaultValue,
isDefault,
});
@@ -101,7 +98,7 @@ export const updateSequenceProps = async ({
node.attributes.splice(attrIndex!, 1);
}
} else {
- const parsed = parseValueExpression(value, enumPaths);
+ const parsed = parseValueExpression(value);
const newValue = value === true ? null : b.jsxExpressionContainer(parsed);
diff --git a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
index 0268e47a5a..ad237fc703 100644
--- a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
+++ b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
@@ -16,7 +16,7 @@ export const saveSequencePropsHandler: ApiHandler<
SaveSequencePropsRequest,
SaveSequencePropsResponse
> = async ({
- input: {fileName, nodePath, key, value, enumPaths, defaultValue},
+ input: {fileName, nodePath, key, value, defaultValue},
remotionRoot,
logLevel,
}) => {
@@ -34,7 +34,6 @@ export const saveSequencePropsHandler: ApiHandler<
nodePath,
key,
value: JSON.parse(value),
- enumPaths,
defaultValue: defaultValue !== null ? JSON.parse(defaultValue) : null,
});
diff --git a/packages/studio-server/src/test/code-shift.test.ts b/packages/studio-server/src/test/code-shift.test.ts
index 99ea279438..210caae94a 100644
--- a/packages/studio-server/src/test/code-shift.test.ts
+++ b/packages/studio-server/src/test/code-shift.test.ts
@@ -17,7 +17,6 @@ test('Should add style.scale to a Video component and format with prettier', asy
nodePath: lineColumnToNodePath(componentInput, 6),
key: 'style.scale',
value: 2,
- enumPaths: [],
defaultValue: null,
prettierConfigOverride: {
singleQuote: true,
diff --git a/packages/studio-server/src/test/update-nested-sequence-props.test.ts b/packages/studio-server/src/test/update-nested-sequence-props.test.ts
index 632b359174..30f092990c 100644
--- a/packages/studio-server/src/test/update-nested-sequence-props.test.ts
+++ b/packages/studio-server/src/test/update-nested-sequence-props.test.ts
@@ -21,7 +21,6 @@ test('updateSequenceProps should update a nested style property', async () => {
nodePath: lineColumnToNodePath(nestedInput, 7),
key: 'style.opacity',
value: 0.8,
- enumPaths: [],
defaultValue: null,
});
@@ -36,7 +35,6 @@ test('updateSequenceProps should add a nested property to existing object', asyn
nodePath: lineColumnToNodePath(nestedInput, 7),
key: 'style.rotate',
value: 45,
- enumPaths: [],
defaultValue: null,
});
@@ -53,7 +51,6 @@ test('updateSequenceProps should create style attribute when it does not exist',
nodePath: lineColumnToNodePath(nestedInput, 8),
key: 'style.opacity',
value: 0.3,
- enumPaths: [],
defaultValue: null,
});
@@ -68,7 +65,6 @@ test('updateSequenceProps should remove nested property when value equals defaul
nodePath: lineColumnToNodePath(nestedInput, 7),
key: 'style.opacity',
value: 1,
- enumPaths: [],
defaultValue: 1,
});
@@ -92,7 +88,6 @@ export const Example: React.FC = () => {
nodePath: lineColumnToNodePath(singlePropInput, 4),
key: 'style.opacity',
value: 1,
- enumPaths: [],
defaultValue: 1,
});
@@ -106,7 +101,6 @@ test('updateSequenceProps should report default as oldValueString for missing ne
nodePath: lineColumnToNodePath(nestedInput, 8),
key: 'style.opacity',
value: 0.5,
- enumPaths: [],
defaultValue: 1,
});
diff --git a/packages/studio-server/src/test/update-sequence-props.test.ts b/packages/studio-server/src/test/update-sequence-props.test.ts
index 3d3dc3c2c0..869772526e 100644
--- a/packages/studio-server/src/test/update-sequence-props.test.ts
+++ b/packages/studio-server/src/test/update-sequence-props.test.ts
@@ -22,7 +22,6 @@ test('updateSequenceProps should update a number value', async () => {
nodePath: lineColumnToNodePath(lightLeakInput, 8),
key: 'hueShift',
value: 90,
- enumPaths: [],
defaultValue: null,
});
@@ -38,7 +37,6 @@ test('updateSequenceProps should update durationInFrames', async () => {
nodePath: lineColumnToNodePath(lightLeakInput, 9),
key: 'durationInFrames',
value: 120,
- enumPaths: [],
defaultValue: null,
});
@@ -54,7 +52,6 @@ test('updateSequenceProps should add a new attribute', async () => {
nodePath: lineColumnToNodePath(lightLeakInput, 9),
key: 'speed',
value: 2,
- enumPaths: [],
defaultValue: null,
});
@@ -68,7 +65,6 @@ test('updateSequenceProps should remove attribute when value equals default', as
nodePath: lineColumnToNodePath(lightLeakInput, 9),
key: 'hueShift',
value: 0,
- enumPaths: [],
defaultValue: 0,
});
@@ -84,7 +80,6 @@ test('updateSequenceProps should set boolean true as shorthand', async () => {
nodePath: lineColumnToNodePath(lightLeakInput, 8),
key: 'loop',
value: true,
- enumPaths: [],
defaultValue: false,
});
@@ -99,7 +94,6 @@ test('updateSequenceProps should report oldValueString for computed expressions'
nodePath: lineColumnToNodePath(lightLeakInput, 8),
key: 'seed',
value: 5,
- enumPaths: [],
defaultValue: null,
});
@@ -112,7 +106,6 @@ test('updateSequenceProps should report default as oldValueString for missing at
nodePath: lineColumnToNodePath(lightLeakInput, 8),
key: 'speed',
value: 2,
- enumPaths: [],
defaultValue: 1,
});
@@ -126,7 +119,6 @@ test('updateSequenceProps should throw for non-existent nodePath', async () => {
nodePath: ['program', 'body', 999],
key: 'hueShift',
value: 90,
- enumPaths: [],
defaultValue: null,
}),
).rejects.toThrow(
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index f5356d0043..836deb2642 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -232,7 +232,6 @@ export type SaveSequencePropsRequest = {
nodePath: SequenceNodePath;
key: string;
value: string;
- enumPaths: EnumPath[];
defaultValue: string | null;
};
diff --git a/packages/studio/src/components/Timeline/TimelineFieldRow.tsx b/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
index a3b18c9a04..2dc04b399d 100644
--- a/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
+++ b/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
@@ -88,7 +88,6 @@ export const TimelineFieldRow: React.FC<{
nodePath,
key,
value: JSON.stringify(value),
- enumPaths: [],
defaultValue,
}).then(() => undefined);
},