Remove TypeScript path mappings in favor of relative imports

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>
This commit is contained in:
Daniel Imms
2026-05-31 09:16:10 -07:00
co-authored by Cursor
parent 43e8365f0e
commit 17ad33dc3d
234 changed files with 867 additions and 1005 deletions
+3 -3
View File
@@ -3,9 +3,9 @@
* @license MIT
*/
import { assert } from 'chai';
import { ApcParser, ApcHandler } from 'common/parser/ApcParser';
import { StringToUtf32, utf32ToString } from 'common/input/TextDecoder';
import { IApcHandler, IFunctionIdentifier } from 'common/parser/Types';
import { ApcParser, ApcHandler } from './ApcParser';
import { StringToUtf32, utf32ToString } from '../input/TextDecoder';
import { IApcHandler, IFunctionIdentifier } from './Types';
function toUtf32(s: string): Uint32Array {
const utf32 = new Uint32Array(s.length);
+5 -5
View File
@@ -3,11 +3,11 @@
* @license MIT
*/
import { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from 'common/parser/Types';
import { ParserConstants } from 'common/parser/Constants';
import { utf32ToString } from 'common/input/TextDecoder';
import { IDisposable } from 'common/Types';
import { LimitedStringBuilder } from 'common/StringBuilder';
import { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from './Types';
import { ParserConstants } from './Constants';
import { utf32ToString } from '../input/TextDecoder';
import { IDisposable } from '../Types';
import { LimitedStringBuilder } from '../StringBuilder';
const EMPTY_HANDLERS: IApcHandler[] = [];
+4 -4
View File
@@ -3,10 +3,10 @@
* @license MIT
*/
import { assert } from 'chai';
import { DcsParser, DcsHandler } from 'common/parser/DcsParser';
import { IDcsHandler, IParams, IFunctionIdentifier } from 'common/parser/Types';
import { utf32ToString, StringToUtf32 } from 'common/input/TextDecoder';
import { Params } from 'common/parser/Params';
import { DcsParser, DcsHandler } from './DcsParser';
import { IDcsHandler, IParams, IFunctionIdentifier } from './Types';
import { utf32ToString, StringToUtf32 } from '../input/TextDecoder';
import { Params } from './Params';
function toUtf32(s: string): Uint32Array {
const utf32 = new Uint32Array(s.length);
+6 -6
View File
@@ -3,12 +3,12 @@
* @license MIT
*/
import { IDisposable } from 'common/Types';
import { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';
import { utf32ToString } from 'common/input/TextDecoder';
import { Params } from 'common/parser/Params';
import { ParserConstants } from 'common/parser/Constants';
import { LimitedStringBuilder } from 'common/StringBuilder';
import { IDisposable } from '../Types';
import { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from './Types';
import { utf32ToString } from '../input/TextDecoder';
import { Params } from './Params';
import { ParserConstants } from './Constants';
import { LimitedStringBuilder } from '../StringBuilder';
const EMPTY_HANDLERS: IDcsHandler[] = [];
@@ -3,16 +3,16 @@
* @license MIT
*/
import { IParsingState, IParams, ParamsArray, IOscParser, IOscHandler, OscFallbackHandlerType, IFunctionIdentifier, IParserStackState, ParserStackType } from 'common/parser/Types';
import { EscapeSequenceParser, TransitionTable, VT500_TRANSITION_TABLE } from 'common/parser/EscapeSequenceParser';
import { IParsingState, IParams, ParamsArray, IOscParser, IOscHandler, OscFallbackHandlerType, IFunctionIdentifier, IParserStackState, ParserStackType } from './Types';
import { EscapeSequenceParser, TransitionTable, VT500_TRANSITION_TABLE } from './EscapeSequenceParser';
import { assert } from 'chai';
import { StringToUtf32, stringFromCodePoint, utf32ToString } from 'common/input/TextDecoder';
import { ParserState } from 'common/parser/Constants';
import { Params } from 'common/parser/Params';
import { OscHandler } from 'common/parser/OscParser';
import { IDisposable } from 'common/Types';
import { DcsHandler } from 'common/parser/DcsParser';
import { ApcHandler } from 'common/parser/ApcParser';
import { StringToUtf32, stringFromCodePoint, utf32ToString } from '../input/TextDecoder';
import { ParserState } from './Constants';
import { Params } from './Params';
import { OscHandler } from './OscParser';
import { IDisposable } from '../Types';
import { DcsHandler } from './DcsParser';
import { ApcHandler } from './ApcParser';
function r(a: number, b: number): string[] {
+8 -8
View File
@@ -3,14 +3,14 @@
* @license MIT
*/
import { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType, IApcHandler, IApcParser, ApcFallbackHandlerType } from 'common/parser/Types';
import { ParserState, ParserAction } from 'common/parser/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { IDisposable } from 'common/Types';
import { Params } from 'common/parser/Params';
import { OscParser } from 'common/parser/OscParser';
import { DcsParser } from 'common/parser/DcsParser';
import { ApcParser } from 'common/parser/ApcParser';
import { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType, IApcHandler, IApcParser, ApcFallbackHandlerType } from './Types';
import { ParserState, ParserAction } from './Constants';
import { Disposable, toDisposable } from '../Lifecycle';
import { IDisposable } from '../Types';
import { Params } from './Params';
import { OscParser } from './OscParser';
import { DcsParser } from './DcsParser';
import { ApcParser } from './ApcParser';
/**
* VT commands done by the parser
+3 -3
View File
@@ -3,9 +3,9 @@
* @license MIT
*/
import { assert } from 'chai';
import { OscParser, OscHandler } from 'common/parser/OscParser';
import { StringToUtf32, utf32ToString } from 'common/input/TextDecoder';
import { IOscHandler } from 'common/parser/Types';
import { OscParser, OscHandler } from './OscParser';
import { StringToUtf32, utf32ToString } from '../input/TextDecoder';
import { IOscHandler } from './Types';
function toUtf32(s: string): Uint32Array {
const utf32 = new Uint32Array(s.length);
+5 -5
View File
@@ -3,11 +3,11 @@
* @license MIT
*/
import { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';
import { OscState, ParserConstants } from 'common/parser/Constants';
import { utf32ToString } from 'common/input/TextDecoder';
import { IDisposable } from 'common/Types';
import { LimitedStringBuilder } from 'common/StringBuilder';
import { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from './Types';
import { OscState, ParserConstants } from './Constants';
import { utf32ToString } from '../input/TextDecoder';
import { IDisposable } from '../Types';
import { LimitedStringBuilder } from '../StringBuilder';
const EMPTY_HANDLERS: IOscHandler[] = [];
+2 -2
View File
@@ -3,8 +3,8 @@
* @license MIT
*/
import { assert } from 'chai';
import { Params } from 'common/parser/Params';
import { ParamsArray } from 'common/parser/Types';
import { Params } from './Params';
import { ParamsArray } from './Types';
class TestParams extends Params {
public get subParams(): Int32Array {
+1 -1
View File
@@ -2,7 +2,7 @@
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IParams, ParamsArray } from 'common/parser/Types';
import { IParams, ParamsArray } from './Types';
const enum Constants {
/**
+2 -2
View File
@@ -3,8 +3,8 @@
* @license MIT
*/
import { IDisposable } from 'common/Types';
import { ParserState } from 'common/parser/Constants';
import { IDisposable } from '../Types';
import { ParserState } from './Constants';
/** sequence params serialized to js arrays */