deleteJsxNodes()v4.0.527
Deletes one or more JSX elements identified by mounted layer node paths. It works with any JSX layer, 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-jsx-nodes.tsimport {deleteJsxNodes , typeCodemodProject } from '@remotion/codemods'; import type {SequenceNodePath } from 'remotion'; declare constproject :CodemodProject ; declare constnodePath :SequenceNodePath ; constresult = awaitdeleteJsxNodes ({project ,nodes : [{filePath : 'src/Video.tsx',nodePath }], });console .log (result .project .files );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 JSX elements to delete. Nodes may belong to different project files.
filePath
The source file containing the JSX element. Absolute paths emitted by a mounted layer and project-relative paths are both accepted.
nodePath
The SequenceNodePath identifying the JSX element to delete. Canvas layers expose it as nodePathInfo.sequenceSubscriptionKey.nodePath.
Return value
A promise resolving to 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.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||