Skip to content

🎥 Make videos programmatically with React

more sequenceschema to noreactinternals

Jonny Burgerd7dbdaf33b12
diff --git a/packages/core/src/no-react.ts b/packages/core/src/no-react.ts
index 0b69453879..d9921241db 100644
--- a/packages/core/src/no-react.ts
+++ b/packages/core/src/no-react.ts
@@ -29,6 +29,7 @@ import {
import {DATE_TOKEN, FILE_TOKEN} from './input-props-serialization.js';
import {colorNames, processColor} from './interpolate-colors';
import {proResProfileOptions} from './prores-profile';
+import {sequenceSchema} from './sequence-field-schema';
import {truthy} from './truthy';
import {ENABLE_V5_BREAKING_CHANGES} from './v5-flag';
import {validateFrame} from './validate-frame';
@@ -67,4 +68,5 @@ export const NoReactInternals = {
validateCodec,
proResProfileOptions,
findPropsToDelete,
+ sequenceSchema,
};
diff --git a/packages/core/src/test/find-props-to-delete.test.ts b/packages/core/src/test/find-props-to-delete.test.ts
index 1f5239d0fe..892d487685 100644
--- a/packages/core/src/test/find-props-to-delete.test.ts
+++ b/packages/core/src/test/find-props-to-delete.test.ts
@@ -1,24 +1,25 @@
import {expect, test} from 'bun:test';
import {Internals} from '../internals';
+import {NoReactInternals} from '../no-react';
test('find right values to delete when upgrading a discriminated union', () => {
expect(() =>
Internals.findPropsToDelete({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
key: 'unknown',
value: 'none',
}),
).toThrow('Key "unknown" not found in schema');
expect(() =>
Internals.findPropsToDelete({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
key: 'layout',
value: 123,
}),
).toThrow('Value must be a string, but is 123');
expect(() =>
Internals.findPropsToDelete({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
key: 'layout',
value: 'unknown',
}),
@@ -28,7 +29,7 @@ test('find right values to delete when upgrading a discriminated union', () => {
expect(
Internals.findPropsToDelete({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
key: 'layout',
value: 'none',
}),
@@ -45,7 +46,7 @@ test('find right values to delete when upgrading a discriminated union', () => {
expect(
Internals.findPropsToDelete({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
key: 'layout',
value: 'absolute-fill',
}),
diff --git a/packages/example/e2e/node-path-cache.test.mts b/packages/example/e2e/node-path-cache.test.mts
index 03f80338f0..7d815b1f9e 100644
--- a/packages/example/e2e/node-path-cache.test.mts
+++ b/packages/example/e2e/node-path-cache.test.mts
@@ -1,7 +1,8 @@
import fs from 'fs';
import assert from 'node:assert';
import {expect, test} from '@playwright/test';
-import {Internals} from 'remotion';
+import {getAllSchemaKeys} from '@remotion/studio-shared';
+import {NoReactInternals} from 'remotion/no-react';
import {apiCall} from './api-call.mts';
import {newVideoFile} from './constants.mts';
import {startStudio, stopStudio} from './studio-server.mts';
@@ -56,7 +57,8 @@ test.describe('node-path cache for stale source maps', () => {
fileName: 'src/NewVideo.tsx',
line: videoLine,
column: 0,
- schema: Internals.sequenceSchema,
+ effects: [],
+ keys: getAllSchemaKeys(NoReactInternals.sequenceSchema),
clientId: 'e2e-cache-test-1',
});
expect(result1.success).toBe(true);
@@ -88,7 +90,8 @@ test.describe('node-path cache for stale source maps', () => {
fileName: 'src/NewVideo.tsx',
line: videoLine, // stale line number
column: 0,
- schema: Internals.sequenceSchema,
+ keys: getAllSchemaKeys(NoReactInternals.sequenceSchema),
+ effects: [],
clientId: 'e2e-cache-test-2',
});
expect(result2.success).toBe(true);
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 eee4f727c4..738c20661c 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
@@ -6,7 +6,7 @@ import type {
SaveSequencePropsResponse,
} from '@remotion/studio-shared';
import {getAllSchemaKeys} from '@remotion/studio-shared';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {updateSequenceProps} from '../../codemods/update-sequence-props/update-sequence-props';
import {writeFileAndNotifyFileWatchers} from '../../file-watcher';
import type {ApiHandler} from '../api-types';
@@ -51,7 +51,7 @@ export const saveSequencePropsHandler: ApiHandler<
defaultValue: defaultValue !== null ? JSON.parse(defaultValue) : null,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
diff --git a/packages/studio-server/src/test/code-shift.test.ts b/packages/studio-server/src/test/code-shift.test.ts
index 70e47ffc8f..e7bfa0205e 100644
--- a/packages/studio-server/src/test/code-shift.test.ts
+++ b/packages/studio-server/src/test/code-shift.test.ts
@@ -1,5 +1,5 @@
import {expect, test} from 'bun:test';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {updateSequenceProps} from '../codemods/update-sequence-props/update-sequence-props';
import {lineColumnToNodePath} from './test-utils';
@@ -22,7 +22,7 @@ test('Should add style.scale to a Video component and format with prettier', asy
bracketSpacing: false,
useTabs: true,
},
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
diff --git a/packages/studio-server/src/test/discriminated-union-update.test.ts b/packages/studio-server/src/test/discriminated-union-update.test.ts
index 2009ed3977..655acb559c 100644
--- a/packages/studio-server/src/test/discriminated-union-update.test.ts
+++ b/packages/studio-server/src/test/discriminated-union-update.test.ts
@@ -3,7 +3,7 @@ import assert from 'node:assert';
import {readFileSync} from 'node:fs';
import path from 'node:path';
import {getFieldsToShow} from '@remotion/studio-shared';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {parseAst} from '../codemods/parse-ast';
import {updateSequencePropsAst} from '../codemods/update-sequence-props/update-sequence-props';
import {lineColumnToNodePath} from '../preview-server/routes/can-update-sequence-props';
@@ -11,7 +11,7 @@ import {prettify} from './test-utils';
test('Should correctly separate discriminated union for layout', () => {
const schemaFields = getFieldsToShow({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
currentRuntimeValueDotNotation: {
layout: 'none',
},
@@ -29,7 +29,7 @@ test('Should correctly separate discriminated union for layout', () => {
test('Should expose absolute-fill variant fields when active', () => {
const schemaFields = getFieldsToShow({
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
currentRuntimeValueDotNotation: {
layout: 'absolute-fill',
},
@@ -70,10 +70,10 @@ test('Should be able to update a discriminated union', async () => {
{
key: 'layout',
value: 'none',
- defaultValue: Internals.sequenceSchema.layout.default,
+ defaultValue: NoReactInternals.sequenceSchema.layout.default,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const expected = readFileSync(
@@ -102,10 +102,10 @@ test('Should remove variant-specific props when switching enum value', async ()
{
key: 'layout',
value: 'none',
- defaultValue: Internals.sequenceSchema.layout.default,
+ defaultValue: NoReactInternals.sequenceSchema.layout.default,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const expected = readFileSync(
@@ -138,10 +138,10 @@ test('Should remove premountFor and styleWhile* when switching to layout="none"'
{
key: 'layout',
value: 'none',
- defaultValue: Internals.sequenceSchema.layout.default,
+ defaultValue: NoReactInternals.sequenceSchema.layout.default,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const expected = readFileSync(
diff --git a/packages/studio-server/src/test/get-all-schema-keys.test.ts b/packages/studio-server/src/test/get-all-schema-keys.test.ts
index 2564df0b55..0fa37c820b 100644
--- a/packages/studio-server/src/test/get-all-schema-keys.test.ts
+++ b/packages/studio-server/src/test/get-all-schema-keys.test.ts
@@ -2,11 +2,12 @@ import {expect, test} from 'bun:test';
import {getAllSchemaKeys} from '@remotion/studio-shared';
import type {SequenceSchema} from 'remotion';
import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
const {getFlatSchemaWithAllKeys} = Internals;
test('getAllSchemaKeys returns every key across all enum variants', () => {
- const keys = getAllSchemaKeys(Internals.sequenceSchema);
+ const keys = getAllSchemaKeys(NoReactInternals.sequenceSchema);
expect(keys.sort()).toEqual(
[
'layout',
diff --git a/packages/studio-server/src/test/log-update.test.ts b/packages/studio-server/src/test/log-update.test.ts
index cdcec3acd0..b02c033472 100644
--- a/packages/studio-server/src/test/log-update.test.ts
+++ b/packages/studio-server/src/test/log-update.test.ts
@@ -6,7 +6,7 @@ process.env.FORCE_COLOR = '1';
import {readFileSync} from 'node:fs';
import path from 'node:path';
import {RenderInternals} from '@remotion/renderer';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {updateSequenceProps} from '../codemods/update-sequence-props/update-sequence-props';
import {formatPropChange} from '../preview-server/routes/log-updates/format-prop-change';
import {
@@ -58,7 +58,7 @@ test('logUpdate emits Monokai-colored output after an AST update', async () => {
input,
nodePath: lineColumnToNodePath(input, 8),
updates: [{key: 'hueShift', value: 90, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
expect(oldValueStrings[0]).toBe('30');
@@ -111,10 +111,10 @@ test('logUpdate emits change-from-default output for discriminated union enum ch
{
key: 'layout',
value: 'none',
- defaultValue: Internals.sequenceSchema.layout.default,
+ defaultValue: NoReactInternals.sequenceSchema.layout.default,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
expect(oldValueStrings[0]).toBe('"absolute-fill"');
@@ -124,7 +124,7 @@ test('logUpdate emits change-from-default output for discriminated union enum ch
const newValueString = JSON.stringify('none');
const defaultValueString = JSON.stringify(
- Internals.sequenceSchema.layout.default,
+ NoReactInternals.sequenceSchema.layout.default,
);
const consoleSpy = spyOn(console, 'log').mockImplementation(() => undefined);
@@ -190,10 +190,10 @@ test('Undo prop change should not nest key={key={value}} for re-added props', as
{
key: 'layout',
value: 'none',
- defaultValue: Internals.sequenceSchema.layout.default,
+ defaultValue: NoReactInternals.sequenceSchema.layout.default,
},
],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const premount = removedProps.find((p) => p.key === 'premountFor');
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 1152d6c920..c4f1a355ff 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
@@ -1,5 +1,5 @@
import {expect, test} from 'bun:test';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {updateSequenceProps} from '../codemods/update-sequence-props/update-sequence-props';
import {lineColumnToNodePath} from './test-utils';
@@ -21,7 +21,7 @@ test('updateSequenceProps should update a nested style property', async () => {
input: nestedInput,
nodePath: lineColumnToNodePath(nestedInput, 7),
updates: [{key: 'style.opacity', value: 0.8, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -35,7 +35,7 @@ test('updateSequenceProps should add a nested property to existing object', asyn
input: nestedInput,
nodePath: lineColumnToNodePath(nestedInput, 7),
updates: [{key: 'style.rotate', value: 45, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -51,7 +51,7 @@ test('updateSequenceProps should create style attribute when it does not exist',
input: nestedInput,
nodePath: lineColumnToNodePath(nestedInput, 8),
updates: [{key: 'style.opacity', value: 0.3, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -65,7 +65,7 @@ test('updateSequenceProps should remove nested property when value equals defaul
input: nestedInput,
nodePath: lineColumnToNodePath(nestedInput, 7),
updates: [{key: 'style.opacity', value: 1, defaultValue: 1}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -88,7 +88,7 @@ export const Example: React.FC = () => {
input: singlePropInput,
nodePath: lineColumnToNodePath(singlePropInput, 4),
updates: [{key: 'style.opacity', value: 1, defaultValue: 1}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -101,7 +101,7 @@ test('updateSequenceProps should report default as oldValueString for missing ne
input: nestedInput,
nodePath: lineColumnToNodePath(nestedInput, 8),
updates: [{key: 'style.opacity', value: 0.5, defaultValue: 1}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
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 d4b908a56c..0d223b3ed2 100644
--- a/packages/studio-server/src/test/update-sequence-props.test.ts
+++ b/packages/studio-server/src/test/update-sequence-props.test.ts
@@ -1,5 +1,5 @@
import {expect, test} from 'bun:test';
-import {Internals} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {updateSequenceProps} from '../codemods/update-sequence-props/update-sequence-props';
import {lineColumnToNodePath} from './test-utils';
@@ -22,7 +22,7 @@ test('updateSequenceProps should update a number value', async () => {
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 8),
updates: [{key: 'hueShift', value: 90, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -37,7 +37,7 @@ test('updateSequenceProps should update durationInFrames', async () => {
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 9),
updates: [{key: 'durationInFrames', value: 120, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -52,7 +52,7 @@ test('updateSequenceProps should add a new attribute', async () => {
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 9),
updates: [{key: 'speed', value: 2, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -65,7 +65,7 @@ test('updateSequenceProps should remove attribute when value equals default', as
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 9),
updates: [{key: 'hueShift', value: 0, defaultValue: 0}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -80,7 +80,7 @@ test('updateSequenceProps should set boolean true as shorthand', async () => {
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 8),
updates: [{key: 'loop', value: true, defaultValue: false}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
// true booleans become shorthand: `loop` not `loop={true}`
@@ -93,7 +93,7 @@ test('updateSequenceProps should report oldValueString for computed expressions'
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 8),
updates: [{key: 'seed', value: 5, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -105,7 +105,7 @@ test('updateSequenceProps should report default as oldValueString for missing at
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 8),
updates: [{key: 'speed', value: 2, defaultValue: 1}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
const oldValueString = oldValueStrings[0];
@@ -118,7 +118,7 @@ test('updateSequenceProps should throw for non-existent nodePath', async () => {
input: lightLeakInput,
nodePath: ['program', 'body', 999],
updates: [{key: 'hueShift', value: 90, defaultValue: null}],
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
}),
).rejects.toThrow(
'Could not find a JSX element at the specified line to update',
diff --git a/packages/studio-shared/src/test/optimistic-update-for-code-values.test.ts b/packages/studio-shared/src/test/optimistic-update-for-code-values.test.ts
index a1f1551caf..9ac51c3377 100644
--- a/packages/studio-shared/src/test/optimistic-update-for-code-values.test.ts
+++ b/packages/studio-shared/src/test/optimistic-update-for-code-values.test.ts
@@ -1,5 +1,6 @@
import {expect, test} from 'bun:test';
-import {Internals, type CanUpdateSequencePropsResponse} from 'remotion';
+import {type CanUpdateSequencePropsResponse} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
import {optimisticUpdateForCodeValues} from '../optimistic-update-for-code-values';
test('optimisticUpdateForCodeValues should return the correct response', () => {
@@ -17,7 +18,7 @@ test('optimisticUpdateForCodeValues should return the correct response', () => {
previous,
fieldKey: 'style.opacity',
value: 0.6,
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
expect(updated).toEqual({
@@ -35,7 +36,7 @@ test('optimisticUpdateForCodeValues should return the correct response', () => {
previous: updated,
fieldKey: 'layout',
value: 'none',
- schema: Internals.sequenceSchema,
+ schema: NoReactInternals.sequenceSchema,
});
expect(layout).toEqual({
canUpdate: true,