addSolid()v4.0.527
Adds a <Solid> to a composition component and adds the required imports.
Draft API: This API is not yet stable. We are in the experimental phase of this package and reserve to change it at any time.
add-solid.tsimport {addSolid , typeCodemodProject } from '@remotion/codemods'; declare constproject :CodemodProject ; constresult =addSolid ({project ,compositionFile : 'src/Root.tsx',compositionId : 'MyComposition',width : 1920,height : 1080, });console .log (result .project .files );console .log (result .changes );console .log (result .insertedNode );
The input project is not mutated.
Options
Pass an object with the following properties.
project
An in-memory Remotion project containing rootDir and a files record.
compositionFile
The path to the file that registers the composition. The component may be declared in that file or imported from another project file.
compositionId
The ID of the <Composition> to edit.
width
The width of the inserted <Solid>.
height
The height of the inserted <Solid>.
from?
Wraps the <Solid> in a <Sequence> starting at this frame. By default, the solid is not wrapped in a sequence.
position?
Positions the solid at {x, y} pixels and adds a CSS translation. By default, the solid starts at the composition origin.
Return value
An object with the following properties.
project
A new project containing the transformed source. Unchanged project fields are preserved.
changes
An array describing each changed file with its filePath, previousContents, and nextContents.
insertedNode
The filePath and nodePath of the inserted JSX element. Pass these values as an item in nodes to deleteJsxNodes() to remove the element again.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||