Skip to main content

getNodeProps()v4.0.530

Inspects props and inline effects without executing the project.

warning

Draft API: This API is experimental and may change.

get-node-props.ts
import {getNodeProps, type CodemodProject, type NodeReference} from '@remotion/codemods'; declare const project: CodemodProject; declare const node: NodeReference; const result = getNodeProps({ project, node, keys: ['children', 'style.opacity'], }); console.log(result);

A spread that may override a prop makes that prop computed. Static source values are not resolved runtime props.

Options​

project​

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

node​

A NodeReference from getNodes() or a previous operation. It contains filePath and nodePath.

keys​

The props to inspect. Use children for static text or a one-level path such as style.opacity.

effectKeys?​

An array of prop-name arrays indexed by effect position. By default, inline effect calls and their explicit configuration keys are discovered from source. Pass [] to skip effect inspection.

assetKeys?​

Names from keys for which staticFile() calls and new Date() expressions should be read as serialized asset and date values. Defaults to []; these expressions are otherwise treated as computed.

componentIdentity?​

The expected component identity, such as 'dev.remotion.remotion.Sequence'. Remotion imports are resolved through named aliases and namespace imports. Throws if the node now refers to a different component. Defaults to null, which skips this check.

videoConfig?​

The composition's width, height, fps, and durationInFrames. Supply these to interpret supported expressions using useVideoConfig(). By default, those runtime values are unknown.

Return value​

Returns an object with the following properties.

canUpdate​

Always true when inspection succeeds. Check each prop's status and each effect's canUpdate before editing; this value does not mean every prop is static.

props​

A record keyed by the requested names. Each value has status: 'static' with codeValue, status: 'keyframed' with keyframes and interpolation settings, or status: 'computed' when the value cannot be statically understood. A missing prop is static with codeValue: undefined.

effects​

An array of effect descriptions. Editable entries include canUpdate: true, effectIndex, callee, importPath, and prop statuses. Unsupported entries include canUpdate: false and a reason. Automatically discovering effects requires an inline array.

Errors​

Throws when the target cannot be resolved, its component identity does not match, or the source cannot be parsed. Computed prop values are reported in props rather than causing an error.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​