Fixes https://github.com/xtermjs/xterm.js/issues/5896 TypeScript path mappings for common/*, browser/*, and headless/* were not rewritten in emitted JavaScript, which forced webpack resolve aliases and NODE_PATH workarounds so runtime could resolve modules. That added build complexity and broke tooling such as ESLint import/no-cycle. Changes: - Convert ~750 imports across src/, addons/, and test/ to relative paths - Remove common/browser/headless paths and src catch-all mappings from tsconfigs (keep @xterm/addon-* demo and addon typings paths) - Remove webpack resolve.alias for common, browser, headless, and vs - Drop NODE_PATH from unit tests, benchmarks, and VS Code launch config - Fix addon-image IIPImageStorage to import ./Types after removing catch-all * Verified: npm run build, esbuild, package, package-headless Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
/**
|
|
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
* @license MIT
|
|
*/
|
|
|
|
import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';
|
|
import { IBuffer } from '../buffer/Types';
|
|
import { BufferLineApiView } from './BufferLineApiView';
|
|
import { CellData } from '../buffer/CellData';
|
|
|
|
export class BufferApiView implements IBufferApi {
|
|
constructor(
|
|
private _buffer: IBuffer,
|
|
public readonly type: 'normal' | 'alternate'
|
|
) { }
|
|
|
|
public init(buffer: IBuffer): BufferApiView {
|
|
this._buffer = buffer;
|
|
return this;
|
|
}
|
|
|
|
public get cursorY(): number { return this._buffer.y; }
|
|
public get cursorX(): number { return this._buffer.x; }
|
|
public get viewportY(): number { return this._buffer.ydisp; }
|
|
public get baseY(): number { return this._buffer.ybase; }
|
|
public get length(): number { return this._buffer.lines.length; }
|
|
public getLine(y: number): IBufferLineApi | undefined {
|
|
const line = this._buffer.lines.get(y);
|
|
if (!line) {
|
|
return undefined;
|
|
}
|
|
return new BufferLineApiView(line);
|
|
}
|
|
public getNullCell(): IBufferCellApi { return new CellData(); }
|
|
}
|