Follow-up to https://github.com/xtermjs/xterm.js/issues/5896 / PR #5966. Converting addons to ../../../src/common relative imports broke unit tests: esbuild emits addon code under addons/*/out-esbuild/ without mirroring the shared tree, so Node could not load TypeScript sources at runtime (Cannot find module '../../../src/common/Lifecycle'). Core src/, test/, and headless continue to use relative imports with no common/* path mappings. Addons keep the prior model until build layout can share out-esbuild the same way as the main package. Changes: - Restore common/* and browser/* paths in addon src/test/benchmark tsconfigs - Revert addon imports to common/ and browser/ path-mapped specifiers - Restore NODE_PATH=out-esbuild in bin/test_unit.js for Mocha resolution - Restore webpack resolve.alias on addons that bundle against out/ Fixes CI test-unit failures on remove-path-mappings-5896. Co-authored-by: Cursor <cursoragent@cursor.com>
@xterm/addon-serialize
An addon for xterm.js that enables xterm.js to serialize a terminal framebuffer into string or html. This addon requires xterm.js v4+.
⚠️ This is an experimental addon that is still under construction ⚠️
Install
npm install --save @xterm/addon-serialize
Usage
import { Terminal } from "@xterm/xterm";
import { SerializeAddon } from "@xterm/addon-serialize";
const terminal = new Terminal();
const serializeAddon = new SerializeAddon();
terminal.loadAddon(serializeAddon);
terminal.write("something...", () => {
console.log(serializeAddon.serialize());
});
See the full API for more advanced usage.
Benchmark
⚠️ Ensure you have lolcat, hexdump programs installed in your computer
$ git clone https://github.com/xtermjs/xterm.js.git
$ cd xterm.js
$ npm ci
$ cd addons/addon-serialize
$ npm run benchmark && npm run benchmark-baseline
$ # change some code in `@xterm/addon-serialize`
$ npm run benchmark-eval