Skip to content

🎥 Make videos programmatically with React

remove the factoryName prop

JonnyBurgerf86422733620
diff --git a/packages/core/src/SequenceManager.tsx b/packages/core/src/SequenceManager.tsx
index b0313cfb55..17d1ca9536 100644
--- a/packages/core/src/SequenceManager.tsx
+++ b/packages/core/src/SequenceManager.tsx
@@ -84,19 +84,13 @@ export type VisualModeSetters = {
export type CanUpdateEffectPropsResponseTrue = {
canUpdate: true;
effectIndex: number;
- factoryName: string;
props: Record<string, CanUpdateSequencePropStatus>;
};
export type CanUpdateEffectPropsResponseFalse = {
canUpdate: false;
effectIndex: number;
- reason:
- | 'effect-reordered'
- | 'no-args-object'
- | 'not-found'
- | 'computed'
- | 'not-call-expression';
+ reason: 'no-args-object' | 'not-found' | 'computed' | 'not-call-expression';
};
export type CanUpdateEffectPropsResponse =
diff --git a/packages/core/src/effects/effect-types.ts b/packages/core/src/effects/effect-types.ts
index 19429c2be0..674506fdde 100644
--- a/packages/core/src/effects/effect-types.ts
+++ b/packages/core/src/effects/effect-types.ts
@@ -32,13 +32,6 @@ export type EffectApplyParams<P, S> = {
export type EffectDefinition<P, S = unknown> = {
readonly type: string;
readonly label: string;
- /**
- * Public source identifier of the factory function the user calls in their
- * code (e.g. `'tint'` for `tint({...})`). Used by the studio to verify
- * that an effect at array index `i` in `_experimentalEffects` still
- * matches the runtime effect when saving prop edits back to source.
- */
- readonly factoryName: string;
readonly backend: Backend;
/**
* Stable string for comparing effect instances: two descriptors with the same
diff --git a/packages/core/src/test/effect-internals.test.ts b/packages/core/src/test/effect-internals.test.ts
index 6eefb0eaed..5b3a18ad4e 100644
--- a/packages/core/src/test/effect-internals.test.ts
+++ b/packages/core/src/test/effect-internals.test.ts
@@ -12,7 +12,6 @@ const makeDef = (
backend: Backend,
): EffectDefinition<unknown, unknown> => ({
type,
- factoryName: type,
label: type,
backend,
calculateKey: () => type,
diff --git a/packages/effects/src/blur/blur-horizontal.ts b/packages/effects/src/blur/blur-horizontal.ts
index 973fc66663..d3735c49d2 100644
--- a/packages/effects/src/blur/blur-horizontal.ts
+++ b/packages/effects/src/blur/blur-horizontal.ts
@@ -17,7 +17,6 @@ export type BlurHorizontalParams = {
// use [`blur`](./index.ts) which composes both horizontal and vertical passes.
export const blurHorizontal = createEffect<BlurHorizontalParams, BlurState>({
type: 'remotion/blur-horizontal',
- factoryName: 'blurHorizontal',
label: 'Blur (horizontal)',
backend: 'webgl2',
calculateKey: (params) => String(params.radius),
diff --git a/packages/effects/src/blur/blur-vertical.ts b/packages/effects/src/blur/blur-vertical.ts
index b30e47cdcb..2e06a929f5 100644
--- a/packages/effects/src/blur/blur-vertical.ts
+++ b/packages/effects/src/blur/blur-vertical.ts
@@ -17,7 +17,6 @@ export type BlurVerticalParams = {
// use [`blur`](./index.ts) which composes both horizontal and vertical passes.
export const blurVertical = createEffect<BlurVerticalParams, BlurState>({
type: 'remotion/blur-vertical',
- factoryName: 'blurVertical',
label: 'Blur (vertical)',
backend: 'webgl2',
calculateKey: (params) => String(params.radius),
diff --git a/packages/effects/src/halftone.ts b/packages/effects/src/halftone.ts
index 70767787d8..8348da18bf 100644
--- a/packages/effects/src/halftone.ts
+++ b/packages/effects/src/halftone.ts
@@ -271,7 +271,6 @@ const parseColorRgba = (
// with a screen tone instead of luminance-driven ink on opaque pixels alone.
export const halftone = createEffect<HalftoneParams, HalftoneState>({
type: 'remotion/halftone',
- factoryName: 'halftone',
label: 'Halftone',
backend: 'webgl2',
calculateKey: (params) => {
diff --git a/packages/effects/src/tint.ts b/packages/effects/src/tint.ts
index f55d970c80..e7a4eec1d0 100644
--- a/packages/effects/src/tint.ts
+++ b/packages/effects/src/tint.ts
@@ -36,7 +36,6 @@ const resolve = (p: TintParams): TintResolved => ({
// backend; tinting respects the source's alpha mask.
export const tint = createEffect<TintParams, null>({
type: 'remotion/tint',
- factoryName: 'tint',
label: 'Tint',
backend: '2d',
calculateKey: (params) => {
diff --git a/packages/effects/src/wave.ts b/packages/effects/src/wave.ts
index b0c7b17cce..a32e3c7cbc 100644
--- a/packages/effects/src/wave.ts
+++ b/packages/effects/src/wave.ts
@@ -30,7 +30,6 @@ const resolve = (p: WaveParams): WaveResolved => ({
// up/down with a sine wave that animates over time. Operates on the 2D backend.
export const wave = createEffect<WaveParams, null>({
type: 'remotion/wave',
- factoryName: 'wave',
label: 'Wave',
backend: '2d',
calculateKey: (params) => {
diff --git a/packages/light-leaks/src/light-leak-internals.ts b/packages/light-leaks/src/light-leak-internals.ts
index f5780e29ec..4c1e93c1ef 100644
--- a/packages/light-leaks/src/light-leak-internals.ts
+++ b/packages/light-leaks/src/light-leak-internals.ts
@@ -195,7 +195,6 @@ const linkProgram = (
const lightLeak = createEffect<LightLeakEffectParams, LightLeakGlState>({
type: 'remotion/light-leak',
- factoryName: 'lightLeak',
label: 'Light leak',
backend: 'webgl2',
calculateKey: (params) => {
diff --git a/packages/starburst/src/starburst-effect.ts b/packages/starburst/src/starburst-effect.ts
index f9cd3ccaf6..734d8ab5bf 100644
--- a/packages/starburst/src/starburst-effect.ts
+++ b/packages/starburst/src/starburst-effect.ts
@@ -293,7 +293,6 @@ const linkProgram = (
const starburstImpl = createEffect<StarburstEffectParams, StarburstGlState>({
type: 'remotion/starburst',
- factoryName: 'starburstImpl',
label: 'Starburst',
backend: 'webgl2',
calculateKey: (params) => {
diff --git a/packages/studio-server/src/codemods/update-effect-props/update-effect-props.ts b/packages/studio-server/src/codemods/update-effect-props/update-effect-props.ts
index a90c130c9a..bfd89aed90 100644
--- a/packages/studio-server/src/codemods/update-effect-props/update-effect-props.ts
+++ b/packages/studio-server/src/codemods/update-effect-props/update-effect-props.ts
@@ -121,20 +121,14 @@ export const enumerateEffectArrayElements = (
export const findEffectCallExpression = ({
attr,
effectIndex,
- factoryName,
}: {
attr: JSXAttribute;
effectIndex: number;
- factoryName: string;
}):
| {kind: 'ok'; call: CallExpression}
| {
kind: 'error';
- reason:
- | 'no-args-object'
- | 'not-found'
- | 'effect-reordered'
- | 'not-call-expression';
+ reason: 'no-args-object' | 'not-found' | 'not-call-expression';
} => {
if (!attr.value || attr.value.type !== 'JSXExpressionContainer') {
return {kind: 'error', reason: 'not-call-expression'};
@@ -156,10 +150,6 @@ export const findEffectCallExpression = ({
return {kind: 'error', reason: 'not-call-expression'};
}
- if (target.callee !== factoryName) {
- return {kind: 'error', reason: 'effect-reordered'};
- }
-
return {kind: 'ok', call: target.node};
};
@@ -188,13 +178,11 @@ export const updateEffectPropsAst = ({
input,
sequenceNodePath,
effectIndex,
- factoryName,
update,
}: {
input: string;
sequenceNodePath: SequenceNodePath;
effectIndex: number;
- factoryName: string;
update: EffectPropUpdate;
}): {
serialized: string;
@@ -219,7 +207,6 @@ export const updateEffectPropsAst = ({
const found = findEffectCallExpression({
attr,
effectIndex,
- factoryName,
});
if (found.kind === 'error') {
@@ -283,14 +270,12 @@ export const updateEffectProps = async ({
input,
sequenceNodePath,
effectIndex,
- factoryName,
update,
prettierConfigOverride,
}: {
input: string;
sequenceNodePath: SequenceNodePath;
effectIndex: number;
- factoryName: string;
update: EffectPropUpdate;
prettierConfigOverride?: Record<string, unknown> | null;
}): Promise<UpdateEffectPropsResult> => {
@@ -298,7 +283,6 @@ export const updateEffectProps = async ({
input,
sequenceNodePath,
effectIndex,
- factoryName,
update,
});
diff --git a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts b/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts
index 87efc321ab..89998eec26 100644
--- a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts
+++ b/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts
@@ -103,7 +103,7 @@ export const computeEffectPropStatus = ({
keys,
}: {
jsx: JSXOpeningElement;
- subscription: {effectIndex: number; factoryName: string};
+ subscription: {effectIndex: number};
keys: string[];
}): CanUpdateEffectPropsResponse => {
const attr = findExperimentalEffectsAttr(jsx);
@@ -137,14 +137,6 @@ export const computeEffectPropStatus = ({
};
}
- if (target.callee !== subscription.factoryName) {
- return {
- canUpdate: false,
- effectIndex: subscription.effectIndex,
- reason: 'effect-reordered',
- };
- }
-
const call: CallExpression = target.node;
if (call.arguments.length === 0) {
const emptyProps: Record<string, CanUpdateSequencePropStatus> = {};
@@ -155,7 +147,6 @@ export const computeEffectPropStatus = ({
return {
canUpdate: true,
effectIndex: subscription.effectIndex,
- factoryName: subscription.factoryName,
props: emptyProps,
};
}
@@ -177,7 +168,6 @@ export const computeEffectPropStatus = ({
return {
canUpdate: true,
effectIndex: subscription.effectIndex,
- factoryName: subscription.factoryName,
props: resolvedProps,
};
};
@@ -199,7 +189,6 @@ export const computeEffectPropsStatusesFromContent = ({
return effects.map((effect) => ({
canUpdate: false as const,
effectIndex: effect.effectIndex,
- factoryName: effect.factoryName,
reason: 'not-found' as const,
}));
}
diff --git a/packages/studio-server/src/preview-server/routes/save-effect-props.ts b/packages/studio-server/src/preview-server/routes/save-effect-props.ts
index 485a2582f2..c2ccd96d2a 100644
--- a/packages/studio-server/src/preview-server/routes/save-effect-props.ts
+++ b/packages/studio-server/src/preview-server/routes/save-effect-props.ts
@@ -29,7 +29,6 @@ export const saveEffectPropsHandler: ApiHandler<
fileName,
sequenceNodePath,
effectIndex,
- factoryName,
key,
value,
defaultValue,
@@ -40,7 +39,7 @@ export const saveEffectPropsHandler: ApiHandler<
}) => {
RenderInternals.Log.trace(
{indent: false, logLevel},
- `[save-effect-props] Received request for fileName="${fileName}" effectIndex=${effectIndex} factoryName="${factoryName}" key="${key}"`,
+ `[save-effect-props] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}"`,
);
const absolutePath = path.resolve(remotionRoot, fileName);
const fileRelativeToRoot = path.relative(remotionRoot, absolutePath);
@@ -56,7 +55,6 @@ export const saveEffectPropsHandler: ApiHandler<
input: fileContents,
sequenceNodePath,
effectIndex,
- factoryName,
update: {
key,
value: JSON.parse(value),
@@ -109,7 +107,7 @@ export const saveEffectPropsHandler: ApiHandler<
logUpdate({
fileRelativeToRoot,
line: logLine,
- key: `${factoryName}[${effectIndex}].${key}`,
+ key: `[${effectIndex}].${key}`,
oldValueString,
newValueString: value,
defaultValueString,
@@ -127,14 +125,13 @@ export const saveEffectPropsHandler: ApiHandler<
return {
canUpdate: false,
effectIndex,
- factoryName,
reason: 'not-found',
};
}
return computeEffectPropStatus({
jsx,
- subscription: {effectIndex, factoryName},
+ subscription: {effectIndex},
keys: getAllSchemaKeys(schema),
});
};
diff --git a/packages/studio-server/src/test/compute-effect-props-status.test.ts b/packages/studio-server/src/test/compute-effect-props-status.test.ts
index 8bfc3645a0..9f1b4eab4d 100644
--- a/packages/studio-server/src/test/compute-effect-props-status.test.ts
+++ b/packages/studio-server/src/test/compute-effect-props-status.test.ts
@@ -32,7 +32,7 @@ test('computeEffectPropStatus reports static props as canUpdate=true with codeVa
const input = buildInput('[tint({color: "red", opacity: 0.5})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 0, factoryName: 'tint'},
+ subscription: {effectIndex: 0},
keys: ['color', 'opacity'],
});
@@ -49,7 +49,7 @@ test('computeEffectPropStatus reports computed props', () => {
const input = buildInput('[tint({color: getColor(), opacity: 0.5})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 0, factoryName: 'tint'},
+ subscription: {effectIndex: 0},
keys: ['color', 'opacity'],
});
@@ -66,7 +66,7 @@ test('computeEffectPropStatus reports unset props as undefined codeValue', () =>
const input = buildInput('[tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 0, factoryName: 'tint'},
+ subscription: {effectIndex: 0},
keys: ['color', 'opacity'],
});
@@ -79,27 +79,11 @@ test('computeEffectPropStatus reports unset props as undefined codeValue', () =>
expect(result.props.opacity).toEqual({canUpdate: true, codeValue: undefined});
});
-test('computeEffectPropStatus flags reordered effect (factoryName mismatch)', () => {
- const input = buildInput('[tint({color: "red"}), halftone({})]');
- const result = computeEffectPropStatus({
- jsx: findJsx(input),
- subscription: {effectIndex: 1, factoryName: 'tint'},
- keys: ['color'],
- });
-
- expect(result.canUpdate).toBe(false);
- if (result.canUpdate) {
- throw new Error('expected canUpdate false');
- }
-
- expect(result.reason).toBe('effect-reordered');
-});
-
test('computeEffectPropStatus flags non-call expressions', () => {
const input = buildInput('[someEffect, tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 0, factoryName: 'tint'},
+ subscription: {effectIndex: 0},
keys: ['color'],
});
@@ -115,7 +99,7 @@ test('computeEffectPropStatus flags out-of-range effect indices', () => {
const input = buildInput('[tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 5, factoryName: 'tint'},
+ subscription: {effectIndex: 5},
keys: ['color'],
});
@@ -131,7 +115,7 @@ test('computeEffectPropStatus flags non-object first arg', () => {
const input = buildInput('[tint(getParams())]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
- subscription: {effectIndex: 0, factoryName: 'tint'},
+ subscription: {effectIndex: 0},
keys: ['color'],
});
diff --git a/packages/studio-server/src/test/update-effect-props.test.ts b/packages/studio-server/src/test/update-effect-props.test.ts
index 4af42e2c78..9c5b49c8b5 100644
--- a/packages/studio-server/src/test/update-effect-props.test.ts
+++ b/packages/studio-server/src/test/update-effect-props.test.ts
@@ -22,7 +22,6 @@ test('updateEffectProps updates an existing prop on the right effect', () => {
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 0,
- factoryName: 'tint',
update: {key: 'opacity', value: 0.8, defaultValue: null},
});
@@ -36,7 +35,6 @@ test('updateEffectProps adds a missing prop', () => {
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 0,
- factoryName: 'tint',
update: {key: 'opacity', value: 0.25, defaultValue: null},
});
@@ -50,7 +48,6 @@ test('updateEffectProps removes a prop equal to default', () => {
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 0,
- factoryName: 'tint',
update: {key: 'opacity', value: 1, defaultValue: 1},
});
@@ -66,7 +63,6 @@ test('updateEffectProps targets the correct effect by index when there are multi
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 1,
- factoryName: 'tint',
update: {key: 'opacity', value: 0.9, defaultValue: null},
});
@@ -75,19 +71,6 @@ test('updateEffectProps targets the correct effect by index when there are multi
expect(serialized).toContain('color: "green"');
});
-test('updateEffectProps throws on factoryName mismatch (effect-reordered)', () => {
- const input = buildInput('[tint({color: "red"}), halftone({})]');
- expect(() => {
- updateEffectPropsAst({
- input,
- sequenceNodePath: lineColumnToNodePath(input, 6),
- effectIndex: 1,
- factoryName: 'tint',
- update: {key: 'opacity', value: 0.5, defaultValue: null},
- });
- }).toThrow(/effect-reordered/);
-});
-
test('updateEffectProps throws when effect index is out of range', () => {
const input = buildInput('[tint({color: "red"})]');
expect(() => {
@@ -95,7 +78,6 @@ test('updateEffectProps throws when effect index is out of range', () => {
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 5,
- factoryName: 'tint',
update: {key: 'opacity', value: 0.5, defaultValue: null},
});
}).toThrow(/not-found/);
@@ -108,7 +90,6 @@ test('updateEffectProps throws when first arg is not an object literal (no-args-
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
effectIndex: 0,
- factoryName: 'tint',
update: {key: 'opacity', value: 0.5, defaultValue: null},
});
}).toThrow(/no-args-object/);
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index 2d2b383946..16b1538448 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -217,7 +217,6 @@ export type CanUpdateSequencePropsRequest = {
export type EffectSubscription = {
effectIndex: number;
- factoryName: string;
schema: SequenceSchema;
};
@@ -270,7 +269,6 @@ export type SaveEffectPropsRequest = {
fileName: string;
sequenceNodePath: SequenceNodePath;
effectIndex: number;
- factoryName: string;
key: string;
value: string;
defaultValue: string | null;
diff --git a/packages/studio-shared/src/schema-field-info.ts b/packages/studio-shared/src/schema-field-info.ts
index 27cbfa0ab2..06d0293e85 100644
--- a/packages/studio-shared/src/schema-field-info.ts
+++ b/packages/studio-shared/src/schema-field-info.ts
@@ -31,7 +31,6 @@ export type SequenceSchemaFieldInfo = SchemaFieldInfo & {
export type EffectSchemaFieldInfo = SchemaFieldInfo & {
readonly kind: 'effect-field';
readonly effectIndex: number;
- readonly factoryName: string;
readonly effectSchema: SequenceSchema;
};
@@ -131,7 +130,6 @@ export const getEffectFieldsToShow = (
currentRuntimeValue: params[key],
fieldSchema,
effectIndex: effect.sourceIndex,
- factoryName: effect.definition.factoryName,
effectSchema,
};
})
diff --git a/packages/studio-shared/src/test/optimistic-update-for-effect-code-values.test.ts b/packages/studio-shared/src/test/optimistic-update-for-effect-code-values.test.ts
index 31a47b3351..492a884e0c 100644
--- a/packages/studio-shared/src/test/optimistic-update-for-effect-code-values.test.ts
+++ b/packages/studio-shared/src/test/optimistic-update-for-effect-code-values.test.ts
@@ -10,7 +10,6 @@ test('optimisticUpdateForEffectCodeValues updates the matching effect prop', ()
{
canUpdate: true,
effectIndex: 0,
- factoryName: 'tint',
props: {
color: {canUpdate: true, codeValue: 'red'},
opacity: {canUpdate: true, codeValue: 0.5},
@@ -74,27 +73,3 @@ test('optimisticUpdateForEffectCodeValues is a no-op when effect index not found
expect(result).toBe(previous);
});
-
-test('optimisticUpdateForEffectCodeValues is a no-op when effect status is non-updateable', () => {
- const previous: CanUpdateSequencePropsResponse = {
- canUpdate: true,
- props: {},
- effects: [
- {
- canUpdate: false,
- effectIndex: 0,
- reason: 'effect-reordered',
- },
- ],
- };
-
- const result = optimisticUpdateForEffectCodeValues({
- previous,
- effectIndex: 0,
- fieldKey: 'opacity',
- value: 0.8,
- schema: {opacity: {type: 'number', default: 1}},
- });
-
- expect(result).toBe(previous);
-});
diff --git a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx
index ebc329ab6b..0f9fa996ab 100644
--- a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx
+++ b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx
@@ -22,7 +22,6 @@ export const SubscribeToNodePaths: FC<{
return {
effectIndex: effect.sourceIndex,
- factoryName: effect.definition.factoryName,
schema: effect.definition.schema,
};
})
diff --git a/packages/studio/src/components/Timeline/TimelineEffectFieldRow.tsx b/packages/studio/src/components/Timeline/TimelineEffectFieldRow.tsx
index b18bf4c536..41e8ee92a3 100644
--- a/packages/studio/src/components/Timeline/TimelineEffectFieldRow.tsx
+++ b/packages/studio/src/components/Timeline/TimelineEffectFieldRow.tsx
@@ -118,7 +118,6 @@ export const TimelineEffectFieldRow: React.FC<{
fileName: validatedLocation.source,
sequenceNodePath: nodePath,
effectIndex: field.effectIndex,
- factoryName: field.factoryName,
key: field.key,
value: stringifiedValue,
defaultValue,
@@ -161,7 +160,6 @@ export const TimelineEffectFieldRow: React.FC<{
codeValuesForSequence,
field.effectIndex,
field.effectSchema,
- field.factoryName,
field.fieldSchema.default,
field.key,
nodePath,