deleteNodes()v4.0.530
Deletes one or more nodes identified by their references. It works with any element, including <Sequence> and <Solid>.
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.
delete-nodes.tsimport {deleteNodes , typeCodemodProject } from '@remotion/codemods'; import type {SequenceNodePath } from 'remotion'; declare constproject :CodemodProject ; declare constnodePath :SequenceNodePath ; constresult = awaitdeleteNodes ({project ,nodes : [{filePath : 'src/Video.tsx',nodePath }], });console .log (result .changes );
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.
nodes
The nodes to delete. Nodes may belong to different project files.
filePath
The source file containing the node. Absolute paths emitted by a mounted layer and project-relative paths are both accepted.
nodePath
The SequenceNodePath identifying the node to delete. Obtain it from getNodes(), an insertion result, or a mounted layer. Canvas layers expose it as nodePathInfo.sequenceSubscriptionKey.nodePath.
Return value
A promise resolving to an object with the following properties.
changes
An array describing each changed file with its filePath, previousContents, and nextContents.
nodePathRemappings
File-qualified {filePath, oldNodePath, newNodePath} mappings for keeping node references after the edit. A null old path indicates an insertion; a null new path indicates removal. See node references.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||