Files
xterm.js/src/common/REARCHITECTURE.md
T
Cursor AgentandDaniel Imms ba582efbfa Inline compiler options in common layer tsconfigs; remove tsconfig.compiler.json
Each subfolder tsconfig.json now explicitly lists lib, types, paths, and
project references instead of extending a shared tsconfig.compiler.json.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-05-30 17:54:54 +00:00

2.3 KiB

Common folder rearchitecture

Layered layout for src/common/ as proposed in issue #5963.

Dependency graph (target)

flowchart BT
  subgraph platform["Platform layer"]
    direction LR
    base["common/base"]
    encoding["common/encoding"]
    data["common/data"]
    buffer["common/buffer"]
    parser["common/parser"]
    input["common/input"]

    encoding --> base
    data --> base
    buffer --> encoding
    buffer --> data
    parser --> buffer
    input --> parser
  end

  subgraph integration["Integration layer"]
    direction LR
    services["common/services"]
    terminal["common/terminal"]
    terminal --> services
  end

  subgraph api_layer["API layer"]
    public["common/public"]
  end

  integration --> platform
  api_layer --> integration

Package contents

Project Role Notable sources
common/base Core utilities (lifecycle, events, platform) Async, Event, Lifecycle, Platform, StringBuilder, Version, CircularList, Color, ColorTypes
common/encoding UTF conversion TextDecoder (moved from input/)
common/data Static terminal data Charsets, EscapeSequences
common/buffer Screen buffer Buffer, BufferLine, …
common/parser Escape sequence parser EscapeSequenceParser, …
common/input Keyboard / write path helpers Keyboard, WriteBuffer, …
common/services DI service implementations Services, Types (modes, mouse, osc link), …
common/terminal Core terminal + input handler CoreTerminal, CoreTerminalTypes, InputHandler, InputHandlerTypes, WindowsMode
common/public Public API adapters AddonManager, buffer API views

TypeScript projects

  • common/tsconfig.json — solution root; references each layer project (no sources).
  • common/<layer>/tsconfig.json — self-contained composite project (lib, paths, types, references, outDir). Test files (**/*.test.ts) are excluded from composite builds; unit tests compile via esbuild.

Buffer-layer code depends on buffer/BufferService, buffer/BufferOptions, and buffer/BufferLog instead of services so the buffer project does not reference services.