From 18100d32fbeb8f394579eda345278778cbdbae32 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 28 May 2026 01:28:31 +0000 Subject: [PATCH] Use src/ imports in addons; bundle test output via esbuild Addons no longer import from out/ or out-esbuild in source. TypeScript and editors resolve ../../../src/common|browser directly. Addon unit test artifacts bundle those dependencies from source (platform node, npm packages external). Reverts preserveConstEnums; const enums are handled in bundled output. Co-authored-by: Daniel Imms --- addons/addon-fit/src/FitAddon.ts | 2 +- addons/addon-image/src/ImageAddon.ts | 2 +- addons/addon-image/src/ImageRenderer.ts | 2 +- addons/addon-image/src/Types.ts | 14 +++++----- addons/addon-progress/src/ProgressAddon.ts | 2 +- addons/addon-search/src/DecorationManager.ts | 2 +- addons/addon-search/src/SearchAddon.ts | 6 ++--- addons/addon-search/src/SearchEngine.test.ts | 4 +-- .../addon-search/src/SearchLineCache.test.ts | 4 +-- addons/addon-search/src/SearchLineCache.ts | 4 +-- .../addon-search/src/SearchResultTracker.ts | 4 +-- .../benchmark/SerializeAddon.benchmark.ts | 4 +-- .../src/SerializeAddon.test.ts | 8 +++--- addons/addon-serialize/src/SerializeAddon.ts | 6 ++--- .../UnicodeGraphemeAddon.benchmark.ts | 4 +-- .../src/UnicodeGraphemeProvider.ts | 4 +-- addons/addon-unicode11/src/UnicodeV11.ts | 4 +-- addons/addon-webgl/src/CellColorResolver.ts | 16 ++++++------ addons/addon-webgl/src/CharAtlasCache.ts | 4 +-- addons/addon-webgl/src/CharAtlasUtils.test.ts | 4 +-- addons/addon-webgl/src/CharAtlasUtils.ts | 6 ++--- addons/addon-webgl/src/Constants.ts | 2 +- .../src/CursorBlinkStateManager.ts | 4 +-- addons/addon-webgl/src/DevicePixelObserver.ts | 2 +- addons/addon-webgl/src/GlyphRenderer.ts | 10 +++---- addons/addon-webgl/src/RectangleRenderer.ts | 16 ++++++------ addons/addon-webgl/src/RenderModel.ts | 4 +-- addons/addon-webgl/src/TextureAtlas.ts | 20 +++++++------- addons/addon-webgl/src/Types.ts | 8 +++--- addons/addon-webgl/src/WebglAddon.ts | 12 ++++----- addons/addon-webgl/src/WebglRenderer.ts | 26 +++++++++---------- addons/addon-webgl/src/WebglUtils.ts | 4 +-- .../src/customGlyphs/CustomGlyphRasterizer.ts | 4 +-- .../src/renderLayer/BaseRenderLayer.ts | 14 +++++----- .../src/renderLayer/LinkRenderLayer.ts | 10 +++---- addons/addon-webgl/src/renderLayer/Types.ts | 2 +- bin/esbuild.mjs | 13 +++++++--- headless/package.json | 12 ++++----- src/tsconfig-library-base.json | 3 +-- 39 files changed, 138 insertions(+), 134 deletions(-) diff --git a/addons/addon-fit/src/FitAddon.ts b/addons/addon-fit/src/FitAddon.ts index 4d7b6bbc8..812d31d3f 100644 --- a/addons/addon-fit/src/FitAddon.ts +++ b/addons/addon-fit/src/FitAddon.ts @@ -5,7 +5,7 @@ import type { Terminal, ITerminalAddon, IRenderDimensions } from '@xterm/xterm'; import type { FitAddon as IFitApi } from '@xterm/addon-fit'; -import { ViewportConstants } from '../../../out/browser/shared/Constants'; +import { ViewportConstants } from '../../../src/browser/shared/Constants'; interface ITerminalDimensions { /** diff --git a/addons/addon-image/src/ImageAddon.ts b/addons/addon-image/src/ImageAddon.ts index 47ad70614..c8d279dcc 100644 --- a/addons/addon-image/src/ImageAddon.ts +++ b/addons/addon-image/src/ImageAddon.ts @@ -5,7 +5,7 @@ import type { ITerminalAddon, IDisposable } from '@xterm/xterm'; import type { ImageAddon as IImageApi } from '@xterm/addon-image'; -import { Emitter, type IEvent } from '../../../out/common/Event'; +import { Emitter, type IEvent } from '../../../src/common/Event'; import { IIPHandler } from './IIPHandler'; import { ImageRenderer } from './ImageRenderer'; import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage'; diff --git a/addons/addon-image/src/ImageRenderer.ts b/addons/addon-image/src/ImageRenderer.ts index c103e11b6..fc427ccd7 100644 --- a/addons/addon-image/src/ImageRenderer.ts +++ b/addons/addon-image/src/ImageRenderer.ts @@ -6,7 +6,7 @@ import { toRGBA8888 } from 'sixel/lib/Colors'; import { IDisposable } from '@xterm/xterm'; import { ICellSize, ImageLayer, ITerminalExt, IImageSpec, IRenderDimensions, IRenderService } from './Types'; -import { Disposable, MutableDisposable, toDisposable } from '../../../out/common/Lifecycle'; +import { Disposable, MutableDisposable, toDisposable } from '../../../src/common/Lifecycle'; const enum Constants { PLACEHOLDER_LENGTH = 4096, diff --git a/addons/addon-image/src/Types.ts b/addons/addon-image/src/Types.ts index 4370f6562..e6213d3c8 100644 --- a/addons/addon-image/src/Types.ts +++ b/addons/addon-image/src/Types.ts @@ -6,13 +6,13 @@ import { IDisposable, IMarker, Terminal } from '@xterm/xterm'; // private imports from base repo we build against -import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from '../../../out/common/buffer/Constants'; -import type { AttributeData } from '../../../out/common/buffer/AttributeData'; -import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from '../../../out/common/parser/Types'; -import type { IBufferLine, IExtendedAttrs, IInputHandler } from '../../../out/common/Types'; -import type { ITerminal, ReadonlyColorSet } from '../../../out/browser/Types'; -import type { IRenderDimensions } from '../../../out/browser/renderer/shared/Types'; -import type { ICoreBrowserService, IRenderService, IThemeService } from '../../../out/browser/services/Services'; +import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from '../../../src/common/buffer/Constants'; +import type { AttributeData } from '../../../src/common/buffer/AttributeData'; +import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from '../../../src/common/parser/Types'; +import type { IBufferLine, IExtendedAttrs, IInputHandler } from '../../../src/common/Types'; +import type { ITerminal, ReadonlyColorSet } from '../../../src/browser/Types'; +import type { IRenderDimensions } from '../../../src/browser/renderer/shared/Types'; +import type { ICoreBrowserService, IRenderService, IThemeService } from '../../../src/browser/services/Services'; export const enum Cell { CONTENT = 0, // codepoint and wcwidth information (enum Content) diff --git a/addons/addon-progress/src/ProgressAddon.ts b/addons/addon-progress/src/ProgressAddon.ts index 6ac00e9fb..e474edca3 100644 --- a/addons/addon-progress/src/ProgressAddon.ts +++ b/addons/addon-progress/src/ProgressAddon.ts @@ -5,7 +5,7 @@ import type { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm'; import type { ProgressAddon as IProgressApi, IProgressState } from '@xterm/addon-progress'; -import type { Emitter, IEvent } from '../../../out/common/Event'; +import type { Emitter, IEvent } from '../../../src/common/Event'; const enum ProgressType { diff --git a/addons/addon-search/src/DecorationManager.ts b/addons/addon-search/src/DecorationManager.ts index 1da171c91..1675ef10f 100644 --- a/addons/addon-search/src/DecorationManager.ts +++ b/addons/addon-search/src/DecorationManager.ts @@ -5,7 +5,7 @@ import type { Terminal, IDisposable, IDecoration } from '@xterm/xterm'; import type { ISearchDecorationOptions } from '@xterm/addon-search'; -import { dispose, Disposable, toDisposable } from '../../../out/common/Lifecycle'; +import { dispose, Disposable, toDisposable } from '../../../src/common/Lifecycle'; import type { ISearchResult } from './SearchEngine'; /** diff --git a/addons/addon-search/src/SearchAddon.ts b/addons/addon-search/src/SearchAddon.ts index 519d12560..720ed26f0 100644 --- a/addons/addon-search/src/SearchAddon.ts +++ b/addons/addon-search/src/SearchAddon.ts @@ -5,9 +5,9 @@ import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm'; import type { SearchAddon as ISearchApi, ISearchOptions, ISearchAddonOptions, ISearchResultChangeEvent, ISearchDecorationOptions } from '@xterm/addon-search'; -import { Emitter, type IEvent } from '../../../out/common/Event'; -import { Disposable, MutableDisposable, toDisposable } from '../../../out/common/Lifecycle'; -import { disposableTimeout } from '../../../out/common/Async'; +import { Emitter, type IEvent } from '../../../src/common/Event'; +import { Disposable, MutableDisposable, toDisposable } from '../../../src/common/Lifecycle'; +import { disposableTimeout } from '../../../src/common/Async'; import { SearchLineCache } from './SearchLineCache'; import { SearchState } from './SearchState'; import { SearchEngine, type ISearchResult } from './SearchEngine'; diff --git a/addons/addon-search/src/SearchEngine.test.ts b/addons/addon-search/src/SearchEngine.test.ts index c69f04acc..e2ab9939b 100644 --- a/addons/addon-search/src/SearchEngine.test.ts +++ b/addons/addon-search/src/SearchEngine.test.ts @@ -5,9 +5,9 @@ import { assert } from 'chai'; import { SearchEngine } from './SearchEngine'; import { SearchLineCache } from './SearchLineCache'; -import { Terminal } from '../../../out/browser/public/Terminal'; +import { Terminal } from '../../../src/browser/public/Terminal'; import type { ISearchOptions } from '@xterm/addon-search'; -import { DisposableStore } from '../../../out/common/Lifecycle'; +import { DisposableStore } from '../../../src/common/Lifecycle'; function writeP(terminal: Terminal, data: string): Promise { return new Promise(r => terminal.write(data, r)); diff --git a/addons/addon-search/src/SearchLineCache.test.ts b/addons/addon-search/src/SearchLineCache.test.ts index b7891ea95..1a465858c 100644 --- a/addons/addon-search/src/SearchLineCache.test.ts +++ b/addons/addon-search/src/SearchLineCache.test.ts @@ -4,8 +4,8 @@ */ import { assert } from 'chai'; import { SearchLineCache, LineCacheEntry } from './SearchLineCache'; -import { Terminal } from '../../../out/browser/public/Terminal'; -import { timeout } from '../../../out/common/Async'; +import { Terminal } from '../../../src/browser/public/Terminal'; +import { timeout } from '../../../src/common/Async'; function writeP(terminal: Terminal, data: string): Promise { return new Promise(r => terminal.write(data, r)); diff --git a/addons/addon-search/src/SearchLineCache.ts b/addons/addon-search/src/SearchLineCache.ts index 6a1b1130f..1b590ec74 100644 --- a/addons/addon-search/src/SearchLineCache.ts +++ b/addons/addon-search/src/SearchLineCache.ts @@ -4,8 +4,8 @@ */ import type { Terminal } from '@xterm/xterm'; -import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from '../../../out/common/Lifecycle'; -import { disposableTimeout } from '../../../out/common/Async'; +import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from '../../../src/common/Lifecycle'; +import { disposableTimeout } from '../../../src/common/Async'; export type LineCacheEntry = [ /** diff --git a/addons/addon-search/src/SearchResultTracker.ts b/addons/addon-search/src/SearchResultTracker.ts index 9c834a184..9c7997741 100644 --- a/addons/addon-search/src/SearchResultTracker.ts +++ b/addons/addon-search/src/SearchResultTracker.ts @@ -5,8 +5,8 @@ import type { ISearchResultChangeEvent } from '@xterm/addon-search'; import type { IDisposable } from '@xterm/xterm'; -import { Emitter, type IEvent } from '../../../out/common/Event'; -import { Disposable } from '../../../out/common/Lifecycle'; +import { Emitter, type IEvent } from '../../../src/common/Event'; +import { Disposable } from '../../../src/common/Lifecycle'; import type { ISearchResult } from './SearchEngine'; /** diff --git a/addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts b/addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts index 815bd9b3b..88f518d71 100644 --- a/addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts +++ b/addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts @@ -6,8 +6,8 @@ import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark'; import { spawn } from 'node-pty'; -import { Utf8ToUtf32, stringFromCodePoint } from '../../../out/common/input/TextDecoder'; -import { Terminal } from '../../../out/browser/public/Terminal'; +import { Utf8ToUtf32, stringFromCodePoint } from '../../../src/common/input/TextDecoder'; +import { Terminal } from '../../../src/browser/public/Terminal'; import { SerializeAddon } from '../src/SerializeAddon'; class TestTerminal extends Terminal { diff --git a/addons/addon-serialize/src/SerializeAddon.test.ts b/addons/addon-serialize/src/SerializeAddon.test.ts index 2c3f51050..0cfc83258 100644 --- a/addons/addon-serialize/src/SerializeAddon.test.ts +++ b/addons/addon-serialize/src/SerializeAddon.test.ts @@ -6,10 +6,10 @@ import jsdom = require('jsdom'); import { assert } from 'chai'; import { SerializeAddon } from './SerializeAddon'; -import { Terminal } from '../../../out/browser/public/Terminal'; -import { SelectionModel } from '../../../out/browser/selection/SelectionModel'; -import { IBufferService } from '../../../out/common/services/Services'; -import { ThemeService } from '../../../out/browser/services/ThemeService'; +import { Terminal } from '../../../src/browser/public/Terminal'; +import { SelectionModel } from '../../../src/browser/selection/SelectionModel'; +import { IBufferService } from '../../../src/common/services/Services'; +import { ThemeService } from '../../../src/browser/services/ThemeService'; function sgr(...seq: string[]): string { return `\x1b[${seq.join(';')}m`; diff --git a/addons/addon-serialize/src/SerializeAddon.ts b/addons/addon-serialize/src/SerializeAddon.ts index 335d0cad7..fbcc65cfa 100644 --- a/addons/addon-serialize/src/SerializeAddon.ts +++ b/addons/addon-serialize/src/SerializeAddon.ts @@ -7,9 +7,9 @@ import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm'; import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize'; -import { IAttributeData, IColor } from '../../../out/common/Types'; -import { DEFAULT_ANSI_COLORS } from '../../../out/browser/Types'; -import { UnderlineStyle } from '../../../out/common/buffer/Constants'; +import { IAttributeData, IColor } from '../../../src/common/Types'; +import { DEFAULT_ANSI_COLORS } from '../../../src/browser/Types'; +import { UnderlineStyle } from '../../../src/common/buffer/Constants'; function constrain(value: number, low: number, high: number): number { return Math.max(low, Math.min(value, high)); diff --git a/addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts b/addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts index 51788b2cd..948ccc48d 100644 --- a/addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts +++ b/addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts @@ -6,8 +6,8 @@ import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark'; import { spawn } from 'node-pty'; -import { Utf8ToUtf32, stringFromCodePoint } from '../../../out/common/input/TextDecoder'; -import { CoreBrowserTerminal } from '../../../out/browser/CoreBrowserTerminal'; +import { Utf8ToUtf32, stringFromCodePoint } from '../../../src/common/input/TextDecoder'; +import { CoreBrowserTerminal } from '../../../src/browser/CoreBrowserTerminal'; import { UnicodeGraphemeProvider } from '../src/UnicodeGraphemeProvider'; diff --git a/addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts b/addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts index 275483bc2..ed258805d 100644 --- a/addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts +++ b/addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts @@ -4,8 +4,8 @@ */ import { IUnicodeVersionProvider } from '@xterm/xterm'; -import { UnicodeCharProperties, UnicodeCharWidth } from '../../../out/common/services/Services'; -import { UnicodeService } from '../../../out/common/services/UnicodeService'; +import { UnicodeCharProperties, UnicodeCharWidth } from '../../../src/common/services/Services'; +import { UnicodeService } from '../../../src/common/services/UnicodeService'; import * as UC from './third-party/UnicodeProperties'; export class UnicodeGraphemeProvider implements IUnicodeVersionProvider { diff --git a/addons/addon-unicode11/src/UnicodeV11.ts b/addons/addon-unicode11/src/UnicodeV11.ts index f55df9062..d80b60b80 100644 --- a/addons/addon-unicode11/src/UnicodeV11.ts +++ b/addons/addon-unicode11/src/UnicodeV11.ts @@ -4,8 +4,8 @@ */ import { IUnicodeVersionProvider } from '@xterm/xterm'; -import { UnicodeCharProperties, UnicodeCharWidth } from '../../../out/common/services/Services'; -import { UnicodeService } from '../../../out/common/services/UnicodeService'; +import { UnicodeCharProperties, UnicodeCharWidth } from '../../../src/common/services/Services'; +import { UnicodeService } from '../../../src/common/services/UnicodeService'; const BMP_COMBINING = [ [0x0300, 0x036F], [0x0483, 0x0489], [0x0591, 0x05BD], diff --git a/addons/addon-webgl/src/CellColorResolver.ts b/addons/addon-webgl/src/CellColorResolver.ts index 3f846920f..52e19a823 100644 --- a/addons/addon-webgl/src/CellColorResolver.ts +++ b/addons/addon-webgl/src/CellColorResolver.ts @@ -1,12 +1,12 @@ -import { ISelectionRenderModel } from '../../../out/browser/renderer/shared/Types'; -import { ICoreBrowserService, IThemeService } from '../../../out/browser/services/Services'; -import { ReadonlyColorSet } from '../../../out/browser/Types'; -import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from '../../../out/common/buffer/Constants'; -import { IDecorationService, IOptionsService } from '../../../out/common/services/Services'; -import { ICellData } from '../../../out/common/Types'; +import { ISelectionRenderModel } from '../../../src/browser/renderer/shared/Types'; +import { ICoreBrowserService, IThemeService } from '../../../src/browser/services/Services'; +import { ReadonlyColorSet } from '../../../src/browser/Types'; +import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from '../../../src/common/buffer/Constants'; +import { IDecorationService, IOptionsService } from '../../../src/common/services/Services'; +import { ICellData } from '../../../src/common/Types'; import { Terminal } from '@xterm/xterm'; -import { rgba } from '../../../out/common/Color'; -import { treatGlyphAsBackgroundColor } from '../../../out/browser/renderer/shared/RendererUtils'; +import { rgba } from '../../../src/common/Color'; +import { treatGlyphAsBackgroundColor } from '../../../src/browser/renderer/shared/RendererUtils'; import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions'; // Work variables to avoid garbage collection diff --git a/addons/addon-webgl/src/CharAtlasCache.ts b/addons/addon-webgl/src/CharAtlasCache.ts index f465a4a04..9aa165f12 100644 --- a/addons/addon-webgl/src/CharAtlasCache.ts +++ b/addons/addon-webgl/src/CharAtlasCache.ts @@ -5,10 +5,10 @@ import { TextureAtlas } from './TextureAtlas'; import { ITerminalOptions, Terminal } from '@xterm/xterm'; -import { ITerminal, ReadonlyColorSet } from '../../../out/browser/Types'; +import { ITerminal, ReadonlyColorSet } from '../../../src/browser/Types'; import { ICharAtlasConfig, ITextureAtlas } from './Types'; import { generateConfig, configEquals } from './CharAtlasUtils'; -import type { ILogService } from '../../../out/common/services/Services'; +import type { ILogService } from '../../../src/common/services/Services'; interface ITextureAtlasCacheEntry { atlas: ITextureAtlas; diff --git a/addons/addon-webgl/src/CharAtlasUtils.test.ts b/addons/addon-webgl/src/CharAtlasUtils.test.ts index a4dc0f50c..572989410 100644 --- a/addons/addon-webgl/src/CharAtlasUtils.test.ts +++ b/addons/addon-webgl/src/CharAtlasUtils.test.ts @@ -6,8 +6,8 @@ import { assert } from 'chai'; import { configEquals } from './CharAtlasUtils'; import { ICharAtlasConfig } from './Types'; -import { NULL_COLOR } from '../../../out/common/Color'; -import { IColor } from '../../../out/common/Types'; +import { NULL_COLOR } from '../../../src/common/Color'; +import { IColor } from '../../../src/common/Types'; function createTestConfig(overrides: Partial = {}): ICharAtlasConfig { const color: IColor = { css: '#ffffff', rgba: 0xffffffff }; diff --git a/addons/addon-webgl/src/CharAtlasUtils.ts b/addons/addon-webgl/src/CharAtlasUtils.ts index 901bd9dbb..6a98c9a8d 100644 --- a/addons/addon-webgl/src/CharAtlasUtils.ts +++ b/addons/addon-webgl/src/CharAtlasUtils.ts @@ -4,10 +4,10 @@ */ import { ICharAtlasConfig } from './Types'; -import { Attributes } from '../../../out/common/buffer/Constants'; +import { Attributes } from '../../../src/common/buffer/Constants'; import { ITerminalOptions } from '@xterm/xterm'; -import { IColorSet, ReadonlyColorSet } from '../../../out/browser/Types'; -import { NULL_COLOR } from '../../../out/common/Color'; +import { IColorSet, ReadonlyColorSet } from '../../../src/browser/Types'; +import { NULL_COLOR } from '../../../src/common/Color'; export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig { // null out some fields that don't matter diff --git a/addons/addon-webgl/src/Constants.ts b/addons/addon-webgl/src/Constants.ts index 1703f4da8..e37aecdb4 100644 --- a/addons/addon-webgl/src/Constants.ts +++ b/addons/addon-webgl/src/Constants.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { isFirefox, isLegacyEdge } from '../../../out/common/Platform'; +import { isFirefox, isLegacyEdge } from '../../../src/common/Platform'; export const DIM_OPACITY = 0.5; // The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge diff --git a/addons/addon-webgl/src/CursorBlinkStateManager.ts b/addons/addon-webgl/src/CursorBlinkStateManager.ts index 9ead4d8bc..1339dae03 100644 --- a/addons/addon-webgl/src/CursorBlinkStateManager.ts +++ b/addons/addon-webgl/src/CursorBlinkStateManager.ts @@ -3,8 +3,8 @@ * @license MIT */ -import { RendererConstants } from '../../../out/browser/renderer/shared/Constants'; -import { ICoreBrowserService } from '../../../out/browser/services/Services'; +import { RendererConstants } from '../../../src/browser/renderer/shared/Constants'; +import { ICoreBrowserService } from '../../../src/browser/services/Services'; const enum Constants { /** diff --git a/addons/addon-webgl/src/DevicePixelObserver.ts b/addons/addon-webgl/src/DevicePixelObserver.ts index 111409910..50ed09941 100644 --- a/addons/addon-webgl/src/DevicePixelObserver.ts +++ b/addons/addon-webgl/src/DevicePixelObserver.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { toDisposable, IDisposable } from '../../../out/common/Lifecycle'; +import { toDisposable, IDisposable } from '../../../src/common/Lifecycle'; export function observeDevicePixelDimensions(element: HTMLElement, parentWindow: Window & typeof globalThis, callback: (deviceWidth: number, deviceHeight: number) => void): IDisposable { // Observe any resizes to the element and extract the actual pixel size of the element if the diff --git a/addons/addon-webgl/src/GlyphRenderer.ts b/addons/addon-webgl/src/GlyphRenderer.ts index 523c94b41..915979206 100644 --- a/addons/addon-webgl/src/GlyphRenderer.ts +++ b/addons/addon-webgl/src/GlyphRenderer.ts @@ -3,14 +3,14 @@ * @license MIT */ import { TextureAtlas } from './TextureAtlas'; -import { IRenderDimensions } from '../../../out/browser/renderer/shared/Types'; -import { NULL_CELL_CODE } from '../../../out/common/buffer/Constants'; -import { Disposable, toDisposable } from '../../../out/common/Lifecycle'; +import { IRenderDimensions } from '../../../src/browser/renderer/shared/Types'; +import { NULL_CELL_CODE } from '../../../src/common/buffer/Constants'; +import { Disposable, toDisposable } from '../../../src/common/Lifecycle'; import { Terminal } from '@xterm/xterm'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types'; import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils'; -import type { ILogService, IOptionsService } from '../../../out/common/services/Services'; -import { allowRescaling, throwIfFalsy } from '../../../out/browser/renderer/shared/RendererUtils'; +import type { ILogService, IOptionsService } from '../../../src/common/services/Services'; +import { allowRescaling, throwIfFalsy } from '../../../src/browser/renderer/shared/RendererUtils'; interface IVertices { attributes: Float32Array; diff --git a/addons/addon-webgl/src/RectangleRenderer.ts b/addons/addon-webgl/src/RectangleRenderer.ts index 7eb8b0506..0eb45a11c 100644 --- a/addons/addon-webgl/src/RectangleRenderer.ts +++ b/addons/addon-webgl/src/RectangleRenderer.ts @@ -3,18 +3,18 @@ * @license MIT */ -import { IRenderDimensions } from '../../../out/browser/renderer/shared/Types'; -import { IThemeService } from '../../../out/browser/services/Services'; -import { ReadonlyColorSet } from '../../../out/browser/Types'; -import { Attributes, FgFlags } from '../../../out/common/buffer/Constants'; -import { Disposable, toDisposable } from '../../../out/common/Lifecycle'; -import { IColor } from '../../../out/common/Types'; +import { IRenderDimensions } from '../../../src/browser/renderer/shared/Types'; +import { IThemeService } from '../../../src/browser/services/Services'; +import { ReadonlyColorSet } from '../../../src/browser/Types'; +import { Attributes, FgFlags } from '../../../src/common/buffer/Constants'; +import { Disposable, toDisposable } from '../../../src/common/Lifecycle'; +import { IColor } from '../../../src/common/Types'; import { Terminal } from '@xterm/xterm'; import { RenderModelConstants } from './RenderModel'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types'; import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils'; -import { throwIfFalsy } from '../../../out/browser/renderer/shared/RendererUtils'; -import type { ILogService } from '../../../out/common/services/Services'; +import { throwIfFalsy } from '../../../src/browser/renderer/shared/RendererUtils'; +import type { ILogService } from '../../../src/common/services/Services'; const enum VertexAttribLocations { POSITION = 0, diff --git a/addons/addon-webgl/src/RenderModel.ts b/addons/addon-webgl/src/RenderModel.ts index d277bf2cc..e1fe54628 100644 --- a/addons/addon-webgl/src/RenderModel.ts +++ b/addons/addon-webgl/src/RenderModel.ts @@ -4,8 +4,8 @@ */ import { ICursorRenderModel, IRenderModel } from './Types'; -import { ISelectionRenderModel } from '../../../out/browser/renderer/shared/Types'; -import { createSelectionRenderModel } from '../../../out/browser/renderer/shared/SelectionRenderModel'; +import { ISelectionRenderModel } from '../../../src/browser/renderer/shared/Types'; +import { createSelectionRenderModel } from '../../../src/browser/renderer/shared/SelectionRenderModel'; export const enum RenderModelConstants { INDICIES_PER_CELL = 4, diff --git a/addons/addon-webgl/src/TextureAtlas.ts b/addons/addon-webgl/src/TextureAtlas.ts index 2cef96b07..a6dda7b71 100644 --- a/addons/addon-webgl/src/TextureAtlas.ts +++ b/addons/addon-webgl/src/TextureAtlas.ts @@ -3,19 +3,19 @@ * @license MIT */ -import { IColorContrastCache } from '../../../out/browser/Types'; +import { IColorContrastCache } from '../../../src/browser/Types'; import { DIM_OPACITY, TEXT_BASELINE } from './Constants'; import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer'; -import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from '../../../out/browser/renderer/shared/RendererUtils'; +import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from '../../../src/browser/renderer/shared/RendererUtils'; import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types'; -import { NULL_COLOR, channels, color, rgba } from '../../../out/common/Color'; -import { FourKeyMap } from '../../../out/common/MultiKeyMap'; -import { IdleTaskQueue } from '../../../out/common/TaskQueue'; -import { IColor } from '../../../out/common/Types'; -import { AttributeData } from '../../../out/common/buffer/AttributeData'; -import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from '../../../out/common/buffer/Constants'; -import { ILogService, IUnicodeService } from '../../../out/common/services/Services'; -import { Emitter } from '../../../out/common/Event'; +import { NULL_COLOR, channels, color, rgba } from '../../../src/common/Color'; +import { FourKeyMap } from '../../../src/common/MultiKeyMap'; +import { IdleTaskQueue } from '../../../src/common/TaskQueue'; +import { IColor } from '../../../src/common/Types'; +import { AttributeData } from '../../../src/common/buffer/AttributeData'; +import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from '../../../src/common/buffer/Constants'; +import { ILogService, IUnicodeService } from '../../../src/common/services/Services'; +import { Emitter } from '../../../src/common/Event'; /** * A shared object which is used to draw nothing for a particular cell. diff --git a/addons/addon-webgl/src/Types.ts b/addons/addon-webgl/src/Types.ts index 6ca47502d..913d9c8ab 100644 --- a/addons/addon-webgl/src/Types.ts +++ b/addons/addon-webgl/src/Types.ts @@ -4,10 +4,10 @@ */ import { FontWeight } from '@xterm/xterm'; -import { IColorSet } from '../../../out/browser/Types'; -import { ISelectionRenderModel } from '../../../out/browser/renderer/shared/Types'; -import { CursorInactiveStyle, CursorStyle, type IDisposable } from '../../../out/common/Types'; -import type { IEvent } from '../../../out/common/Event'; +import { IColorSet } from '../../../src/browser/Types'; +import { ISelectionRenderModel } from '../../../src/browser/renderer/shared/Types'; +import { CursorInactiveStyle, CursorStyle, type IDisposable } from '../../../src/common/Types'; +import type { IEvent } from '../../../src/common/Event'; export interface IRenderModel { cells: Uint32Array; diff --git a/addons/addon-webgl/src/WebglAddon.ts b/addons/addon-webgl/src/WebglAddon.ts index aa0516755..b370d2955 100644 --- a/addons/addon-webgl/src/WebglAddon.ts +++ b/addons/addon-webgl/src/WebglAddon.ts @@ -5,14 +5,14 @@ import type { ITerminalAddon, Terminal } from '@xterm/xterm'; import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl'; -import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from '../../../out/browser/services/Services'; -import { ITerminal } from '../../../out/browser/Types'; -import { Disposable, toDisposable } from '../../../out/common/Lifecycle'; -import { getSafariVersion, isSafari } from '../../../out/common/Platform'; -import { ICoreService, IDecorationService, ILogService, IOptionsService } from '../../../out/common/services/Services'; +import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from '../../../src/browser/services/Services'; +import { ITerminal } from '../../../src/browser/Types'; +import { Disposable, toDisposable } from '../../../src/common/Lifecycle'; +import { getSafariVersion, isSafari } from '../../../src/common/Platform'; +import { ICoreService, IDecorationService, ILogService, IOptionsService } from '../../../src/common/services/Services'; import { IWebGL2RenderingContext } from './Types'; import { WebglRenderer } from './WebglRenderer'; -import { Emitter, EventUtils } from '../../../out/common/Event'; +import { Emitter, EventUtils } from '../../../src/common/Event'; export class WebglAddon extends Disposable implements ITerminalAddon, IWebglApi { private _terminal?: Terminal; diff --git a/addons/addon-webgl/src/WebglRenderer.ts b/addons/addon-webgl/src/WebglRenderer.ts index 7d6ee54f7..7fd815df9 100644 --- a/addons/addon-webgl/src/WebglRenderer.ts +++ b/addons/addon-webgl/src/WebglRenderer.ts @@ -3,19 +3,19 @@ * @license MIT */ -import { ITerminal } from '../../../out/browser/Types'; +import { ITerminal } from '../../../src/browser/Types'; import { CellColorResolver } from './CellColorResolver'; import { acquireTextureAtlas, removeTerminalFromCache } from './CharAtlasCache'; import { CursorBlinkStateManager } from './CursorBlinkStateManager'; import { observeDevicePixelDimensions } from './DevicePixelObserver'; -import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from '../../../out/browser/renderer/shared/Types'; -import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from '../../../out/browser/services/Services'; -import { CharData, IBufferLine, ICellData } from '../../../out/common/Types'; -import { AttributeData } from '../../../out/common/buffer/AttributeData'; -import { CellData } from '../../../out/common/buffer/CellData'; -import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from '../../../out/common/buffer/Constants'; -import { TextBlinkStateManager } from '../../../out/browser/renderer/shared/TextBlinkStateManager'; -import { ICoreService, IDecorationService, ILogService, IOptionsService } from '../../../out/common/services/Services'; +import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from '../../../src/browser/renderer/shared/Types'; +import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from '../../../src/browser/services/Services'; +import { CharData, IBufferLine, ICellData } from '../../../src/common/Types'; +import { AttributeData } from '../../../src/common/buffer/AttributeData'; +import { CellData } from '../../../src/common/buffer/CellData'; +import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from '../../../src/common/buffer/Constants'; +import { TextBlinkStateManager } from '../../../src/browser/renderer/shared/TextBlinkStateManager'; +import { ICoreService, IDecorationService, ILogService, IOptionsService } from '../../../src/common/services/Services'; import { Terminal } from '@xterm/xterm'; import { GlyphRenderer } from './GlyphRenderer'; import { RectangleRenderer } from './RectangleRenderer'; @@ -23,10 +23,10 @@ import { COMBINED_CHAR_BIT_MASK, RenderModel, RenderModelConstants } from './Ren import { IWebGL2RenderingContext, type ITextureAtlas } from './Types'; import { LinkRenderLayer } from './renderLayer/LinkRenderLayer'; import { IRenderLayer } from './renderLayer/Types'; -import { Emitter, EventUtils } from '../../../out/common/Event'; -import { addDisposableListener } from '../../../out/browser/Dom'; -import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from '../../../out/common/Lifecycle'; -import { createRenderDimensions } from '../../../out/browser/renderer/shared/RendererUtils'; +import { Emitter, EventUtils } from '../../../src/common/Event'; +import { addDisposableListener } from '../../../src/browser/Dom'; +import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from '../../../src/common/Lifecycle'; +import { createRenderDimensions } from '../../../src/browser/renderer/shared/RendererUtils'; const enum Constants { MERGE_RETRY_LIMIT = 32 diff --git a/addons/addon-webgl/src/WebglUtils.ts b/addons/addon-webgl/src/WebglUtils.ts index 497143824..b106f7d56 100644 --- a/addons/addon-webgl/src/WebglUtils.ts +++ b/addons/addon-webgl/src/WebglUtils.ts @@ -3,8 +3,8 @@ * @license MIT */ -import { throwIfFalsy } from '../../../out/browser/renderer/shared/RendererUtils'; -import type { ILogService } from '../../../out/common/services/Services'; +import { throwIfFalsy } from '../../../src/browser/renderer/shared/RendererUtils'; +import type { ILogService } from '../../../src/common/services/Services'; /** * A matrix that when multiplies will translate 0-1 coordinates (left to right, diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts index 12440ed7c..d1c9fd83c 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts @@ -3,8 +3,8 @@ * @license MIT */ -import { throwIfFalsy } from '../../../../out/browser/renderer/shared/RendererUtils'; -import type { ILogService } from '../../../../out/common/services/Services'; +import { throwIfFalsy } from '../../../../src/browser/renderer/shared/RendererUtils'; +import type { ILogService } from '../../../../src/common/services/Services'; import { customGlyphDefinitions } from './CustomGlyphDefinitions'; import { CustomGlyphDefinitionType, CustomGlyphScaleType, CustomGlyphVectorType, type CustomGlyphDefinitionPart, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from './Types'; diff --git a/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts b/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts index 382ae5a76..4c286284d 100644 --- a/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts +++ b/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts @@ -3,16 +3,16 @@ * @license MIT */ -import { ReadonlyColorSet } from '../../../../out/browser/Types'; +import { ReadonlyColorSet } from '../../../../src/browser/Types'; import { acquireTextureAtlas } from '../CharAtlasCache'; -import { IRenderDimensions } from '../../../../out/browser/renderer/shared/Types'; -import { ICoreBrowserService, IThemeService } from '../../../../out/browser/services/Services'; -import { Disposable, toDisposable } from '../../../../out/common/Lifecycle'; -import { CellData } from '../../../../out/common/buffer/CellData'; -import { IOptionsService } from '../../../../out/common/services/Services'; +import { IRenderDimensions } from '../../../../src/browser/renderer/shared/Types'; +import { ICoreBrowserService, IThemeService } from '../../../../src/browser/services/Services'; +import { Disposable, toDisposable } from '../../../../src/common/Lifecycle'; +import { CellData } from '../../../../src/common/buffer/CellData'; +import { IOptionsService } from '../../../../src/common/services/Services'; import { Terminal } from '@xterm/xterm'; import { IRenderLayer } from './Types'; -import { throwIfFalsy } from '../../../../out/browser/renderer/shared/RendererUtils'; +import { throwIfFalsy } from '../../../../src/browser/renderer/shared/RendererUtils'; import { TEXT_BASELINE } from '../Constants'; import type { ITextureAtlas } from '../Types'; diff --git a/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts b/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts index ddb4fb594..e076b9bd7 100644 --- a/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts +++ b/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts @@ -4,11 +4,11 @@ */ import { is256Color } from '../CharAtlasUtils'; -import { INVERTED_DEFAULT_COLOR } from '../../../../out/browser/renderer/shared/Constants'; -import { IRenderDimensions } from '../../../../out/browser/renderer/shared/Types'; -import { ICoreBrowserService, IThemeService } from '../../../../out/browser/services/Services'; -import { ILinkifier2, ILinkifierEvent } from '../../../../out/browser/Types'; -import { IOptionsService } from '../../../../out/common/services/Services'; +import { INVERTED_DEFAULT_COLOR } from '../../../../src/browser/renderer/shared/Constants'; +import { IRenderDimensions } from '../../../../src/browser/renderer/shared/Types'; +import { ICoreBrowserService, IThemeService } from '../../../../src/browser/services/Services'; +import { ILinkifier2, ILinkifierEvent } from '../../../../src/browser/Types'; +import { IOptionsService } from '../../../../src/common/services/Services'; import { Terminal } from '@xterm/xterm'; import { BaseRenderLayer } from './BaseRenderLayer'; diff --git a/addons/addon-webgl/src/renderLayer/Types.ts b/addons/addon-webgl/src/renderLayer/Types.ts index 763348ec8..74cd5e27b 100644 --- a/addons/addon-webgl/src/renderLayer/Types.ts +++ b/addons/addon-webgl/src/renderLayer/Types.ts @@ -4,7 +4,7 @@ */ import { IDisposable, Terminal } from '@xterm/xterm'; -import { IRenderDimensions } from '../../../../out/browser/renderer/shared/Types'; +import { IRenderDimensions } from '../../../../src/browser/renderer/shared/Types'; export interface IRenderLayer extends IDisposable { /** diff --git a/bin/esbuild.mjs b/bin/esbuild.mjs index 9e5f2d232..f4ae4848d 100644 --- a/bin/esbuild.mjs +++ b/bin/esbuild.mjs @@ -107,13 +107,20 @@ if (config.addon) { }; outConfig = { ...outConfig, + bundle: true, + platform: 'node', + packages: 'external', entryPoints: [`addons/addon-${config.addon}/src/**/*.ts`], - outdir: `addons/addon-${config.addon}/out-esbuild/` + outdir: `addons/addon-${config.addon}/out-esbuild/`, + // Public API stays external; src/common|browser are bundled from source. + external: ['@xterm/xterm', '@xterm/headless', '@xterm/addon-*'], }; + // Playwright suites only (not run by unit tests); keep unbundled. outTestConfig = { - ...outConfig, + format: 'cjs', + sourcemap: true, entryPoints: [`addons/addon-${config.addon}/test/**/*.ts`], - outdir: `addons/addon-${config.addon}/out-esbuild-test/` + outdir: `addons/addon-${config.addon}/out-esbuild-test/`, }; if (config.addon === 'ligatures') { diff --git a/headless/package.json b/headless/package.json index 6ca8d3876..fda5eae6a 100644 --- a/headless/package.json +++ b/headless/package.json @@ -3,15 +3,13 @@ "description": "A headless terminal component that runs in Node.js", "version": "6.0.0", "main": "lib-headless/xterm-headless.js", - "module": "lib-headless/xterm-headless.mjs", + "module": "lib/xterm.mjs", "types": "typings/xterm-headless.d.ts", - "exports": { - "types": "./typings/xterm-headless.d.ts", - "import": "./lib-headless/xterm-headless.mjs", - "require": "./lib-headless/xterm-headless.js" - }, "repository": "https://github.com/xtermjs/xterm.js", "license": "MIT", + "workspaces": [ + "addons/*" + ], "keywords": [ "cli", "command-line", @@ -27,4 +25,4 @@ "webgl", "xterm" ] -} +} \ No newline at end of file diff --git a/src/tsconfig-library-base.json b/src/tsconfig-library-base.json index 3bd3fc0aa..00cecc066 100644 --- a/src/tsconfig-library-base.json +++ b/src/tsconfig-library-base.json @@ -5,7 +5,6 @@ "strict": true, "declarationMap": true, "experimentalDecorators": true, - "downlevelIteration": true, - "preserveConstEnums": true + "downlevelIteration": true } }