Skip to main content

reorderEffect()v4.0.528

Moves an effect to another index in the same effects array.

warning

Draft API: This API is experimental and may change.

reorder-effect.ts
import {reorderEffect, type CodemodProject, type EffectReference} from '@remotion/codemods'; declare const project: CodemodProject; declare const effect: EffectReference; const result = await reorderEffect({ project, effect, toIndex: 0, }); console.log(result);

Effect order changes the order of application. Other effects' indices may shift.

Options​

project​

An in-memory CodemodProject. The input project is not mutated.

effect​

An EffectReference: filePath, nodePath, and a zero-based effectIndex in the node's inline effects array.

toIndex​

The final zero-based index. It must be an integer within the existing array.

Return value​

A promise resolving to an object with the following properties.

changes​

An array of {filePath, previousContents, nextContents} file changes. A null content value indicates a created or deleted file.

nodePathRemappings​

An array of {filePath, oldNodePath, newNodePath} mappings. A null old path indicates an insertion; a null new path indicates removal. Apply these mappings to references from the input project. See node references.

updatedEffect​

The moved effect reference with its new index.

Errors​

Throws or rejects when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​