Skip to content

GIF artifact rendering fails on Node 20: GIFEncoder is not a function #183

Description

@konard

Reproduction

On Node 20.20.2 with command-stream@0.17.0, any terminal capture with
artifactDirectory fails while writing the newly added GIF:

import { captureTerminal } from 'command-stream';

await captureTerminal({
  file: process.execPath,
  args: ['-e', 'console.log("hello")'],
  artifactDirectory: '/tmp/terminal-artifacts',
});
TypeError: GIFEncoder is not a function
    at renderGif (.../node_modules/command-stream/src/terminal-artifacts.mjs:429:15)
    at async writeTerminalArtifacts (.../terminal-artifacts.mjs:502:15)

The dynamic import only exposes default on Node:

Object.keys(await import('gifenc')) = [ 'default' ]
Object.keys((await import('gifenc')).default) includes GIFEncoder, applyPalette, quantize

The current destructuring assumes synthetic named exports. Normalizing the
module first (const gifenc = module.default ?? module) should preserve Bun
behavior and support the package's declared Node >=20 engine.

This blocks link-assistant/agent-commander#46 from consuming 0.17.0 and
verifying default SVG+GIF replay bundles on its Node CI matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions