From cfde4d634f630b8cf09d95209afbfcebd58e45b0 Mon Sep 17 00:00:00 2001 From: tisilent Date: Sun, 1 Oct 2023 20:39:10 +0800 Subject: [PATCH 01/46] Check option changes --- addons/xterm-addon-search/src/SearchAddon.ts | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index 959214c95..79cd010b3 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -134,9 +134,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon { if (!this._terminal) { throw new Error('Cannot use addon until it has been loaded'); } + const isOptionsChanged = this._lastSearchOptions ? this._isOptionsChange(this._lastSearchOptions, searchOptions) : true; this._lastSearchOptions = searchOptions; if (searchOptions?.decorations) { - if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm) { + if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || isOptionsChanged) { this._highlightAllMatches(term, searchOptions); } } @@ -302,9 +303,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon { if (!this._terminal) { throw new Error('Cannot use addon until it has been loaded'); } + const isOptionsChanged = this._lastSearchOptions ? this._isOptionsChange(this._lastSearchOptions, searchOptions) : true; this._lastSearchOptions = searchOptions; if (searchOptions?.decorations) { - if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm) { + if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || isOptionsChanged) { this._highlightAllMatches(term, searchOptions); } } @@ -316,6 +318,22 @@ export class SearchAddon extends Disposable implements ITerminalAddon { return found; } + private _isOptionsChange(lastSearchOptions: ISearchOptions, searchOptions?: ISearchOptions): boolean { + if (!searchOptions) { + return false; + } + if (lastSearchOptions.caseSensitive !== searchOptions.caseSensitive) { + return true; + } + if (lastSearchOptions.regex !== searchOptions.regex) { + return true; + } + if (lastSearchOptions.wholeWord !== searchOptions.wholeWord) { + return true; + } + return false; + } + private _fireResults(searchOptions?: ISearchOptions): void { if (searchOptions?.decorations) { let resultIndex = -1; From 41c62288f055a615302fa7fa95ee7f4b140496a4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:41:53 -0700 Subject: [PATCH 02/46] Expose a documentOverride setting This lets the embedder choose which Document object to use for creating elements, adding event listeners, etc. The reason this exists is because when working with multiple windows it can be convenient to create all elements under the primary window to make instanceof usage consistent. See microsoft/vscode#195595 --- src/browser/Terminal.ts | 3 +++ src/common/services/OptionsService.ts | 1 + src/common/services/Services.ts | 1 + typings/xterm.d.ts | 11 +++++++++++ 4 files changed, 16 insertions(+) diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index 18af3e4e2..621ee44c5 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -398,6 +398,9 @@ export class Terminal extends CoreTerminal implements ITerminal { } this._document = parent.ownerDocument!; + if (this.options.documentOverride && this.options.documentOverride instanceof Document) { + this._document = this.optionsService.rawOptions.documentOverride as Document; + } // Create main element container this.element = this._document.createElement('div'); diff --git a/src/common/services/OptionsService.ts b/src/common/services/OptionsService.ts index 3c572445e..eb9dbfa8c 100644 --- a/src/common/services/OptionsService.ts +++ b/src/common/services/OptionsService.ts @@ -18,6 +18,7 @@ export const DEFAULT_OPTIONS: Readonly> = { cursorInactiveStyle: 'outline', customGlyphs: true, drawBoldTextInBrightColors: true, + documentOverride: null, fastScrollModifier: 'alt', fastScrollSensitivity: 5, fontFamily: 'courier-new, courier, monospace', diff --git a/src/common/services/Services.ts b/src/common/services/Services.ts index 52c2a79fa..6ac73e37a 100644 --- a/src/common/services/Services.ts +++ b/src/common/services/Services.ts @@ -217,6 +217,7 @@ export interface ITerminalOptions { cursorInactiveStyle?: CursorInactiveStyle; customGlyphs?: boolean; disableStdin?: boolean; + documentOverride?: any | null; drawBoldTextInBrightColors?: boolean; fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift'; fastScrollSensitivity?: number; diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 3f603b9e1..b8028a181 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -89,6 +89,17 @@ declare module 'xterm' { */ disableStdin?: boolean; + /** + * A {@link Document} to use instead of the one that xterm.js was attached + * to. The purpose of this is to improve support in multi-window + * applications where HTML elements may be references across multiple + * windows which can cause problems with `instanceof`. + * + * The type is `any` because using `Document` can cause TS to have + * performance/compiler problems. + */ + documentOverride?: any | null; + /** * Whether to draw bold text in bright colors. The default is true. */ From c80453f602e700bb774757c1d86cdf0037e062bc Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:09:36 -0700 Subject: [PATCH 03/46] Use correct document when creating elements --- addons/xterm-addon-canvas/src/BaseRenderLayer.ts | 2 +- addons/xterm-addon-webgl/src/WebglRenderer.ts | 2 +- .../src/renderLayer/BaseRenderLayer.ts | 2 +- src/browser/AccessibilityManager.ts | 11 ++++++----- src/browser/Terminal.ts | 16 ++++++++-------- src/browser/TestUtils.test.ts | 3 +++ .../decorations/BufferDecorationRenderer.ts | 5 +++-- src/browser/decorations/OverviewRulerRenderer.ts | 16 ++++++++-------- src/browser/renderer/shared/CustomGlyphs.ts | 2 +- src/browser/services/CoreBrowserService.ts | 3 ++- src/browser/services/Services.ts | 5 +++++ src/common/Color.ts | 1 + 12 files changed, 40 insertions(+), 28 deletions(-) diff --git a/addons/xterm-addon-canvas/src/BaseRenderLayer.ts b/addons/xterm-addon-canvas/src/BaseRenderLayer.ts index 8c1993366..62fe71a74 100644 --- a/addons/xterm-addon-canvas/src/BaseRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/BaseRenderLayer.ts @@ -59,7 +59,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer ) { super(); this._cellColorResolver = new CellColorResolver(this._terminal, this._selectionModel, this._decorationService, this._coreBrowserService, this._themeService); - this._canvas = document.createElement('canvas'); + this._canvas = this._coreBrowserService.mainDocument.createElement('canvas'); this._canvas.classList.add(`xterm-${id}-layer`); this._canvas.style.zIndex = zIndex.toString(); this._initCanvas(); diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.ts b/addons/xterm-addon-webgl/src/WebglRenderer.ts index 8cc81b92c..517499845 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.ts @@ -88,7 +88,7 @@ export class WebglRenderer extends Disposable implements IRenderer { this._updateCursorBlink(); this.register(_optionsService.onOptionChange(() => this._handleOptionsChanged())); - this._canvas = document.createElement('canvas'); + this._canvas = this._coreBrowserService.mainDocument.createElement('canvas'); const contextAttributes = { antialias: false, diff --git a/addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts b/addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts index 3aaac435b..11f96ed8c 100644 --- a/addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts +++ b/addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts @@ -38,7 +38,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer protected readonly _themeService: IThemeService ) { super(); - this._canvas = document.createElement('canvas'); + this._canvas = this._coreBrowserService.mainDocument.createElement('canvas'); this._canvas.classList.add(`xterm-${id}-layer`); this._canvas.style.zIndex = zIndex.toString(); this._initCanvas(); diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index c878bd0af..1005414f0 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -8,7 +8,7 @@ import { ITerminal, IRenderDebouncer } from 'browser/Types'; import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; -import { IRenderService } from 'browser/services/Services'; +import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; import { addDisposableDomListener } from 'browser/Lifecycle'; import { IBuffer } from 'common/buffer/Types'; @@ -49,13 +49,14 @@ export class AccessibilityManager extends Disposable { constructor( private readonly _terminal: ITerminal, + @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService, @IRenderService private readonly _renderService: IRenderService ) { super(); - this._accessibilityContainer = document.createElement('div'); + this._accessibilityContainer = this._coreBrowserService.mainDocument.createElement('div'); this._accessibilityContainer.classList.add('xterm-accessibility'); - this._rowContainer = document.createElement('div'); + this._rowContainer = this._coreBrowserService.mainDocument.createElement('div'); this._rowContainer.setAttribute('role', 'list'); this._rowContainer.classList.add('xterm-accessibility-tree'); this._rowElements = []; @@ -72,7 +73,7 @@ export class AccessibilityManager extends Disposable { this._refreshRowsDimensions(); this._accessibilityContainer.appendChild(this._rowContainer); - this._liveRegion = document.createElement('div'); + this._liveRegion = this._coreBrowserService.mainDocument.createElement('div'); this._liveRegion.classList.add('live-region'); this._liveRegion.setAttribute('aria-live', 'assertive'); this._accessibilityContainer.appendChild(this._liveRegion); @@ -261,7 +262,7 @@ export class AccessibilityManager extends Disposable { } private _createAccessibilityTreeNode(): HTMLElement { - const element = document.createElement('div'); + const element = this._coreBrowserService.mainDocument.createElement('div'); element.setAttribute('role', 'listitem'); element.tabIndex = -1; this._refreshRowDimensions(element); diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index 621ee44c5..9d4ca5a02 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -411,25 +411,25 @@ export class Terminal extends CoreTerminal implements ITerminal { // Performance: Use a document fragment to build the terminal // viewport and helper elements detached from the DOM - const fragment = document.createDocumentFragment(); - this._viewportElement = document.createElement('div'); + const fragment = this._document.createDocumentFragment(); + this._viewportElement = this._document.createElement('div'); this._viewportElement.classList.add('xterm-viewport'); fragment.appendChild(this._viewportElement); - this._viewportScrollArea = document.createElement('div'); + this._viewportScrollArea = this._document.createElement('div'); this._viewportScrollArea.classList.add('xterm-scroll-area'); this._viewportElement.appendChild(this._viewportScrollArea); - this.screenElement = document.createElement('div'); + this.screenElement = this._document.createElement('div'); this.screenElement.classList.add('xterm-screen'); // Create the container that will hold helpers like the textarea for // capturing DOM Events. Then produce the helpers. - this._helperContainer = document.createElement('div'); + this._helperContainer = this._document.createElement('div'); this._helperContainer.classList.add('xterm-helpers'); this.screenElement.appendChild(this._helperContainer); fragment.appendChild(this.screenElement); - this.textarea = document.createElement('textarea'); + this.textarea = this._document.createElement('textarea'); this.textarea.classList.add('xterm-helper-textarea'); this.textarea.setAttribute('aria-label', Strings.promptLabel); if (!Browser.isChromeOS) { @@ -444,7 +444,7 @@ export class Terminal extends CoreTerminal implements ITerminal { // Register the core browser service before the generic textarea handlers are registered so it // handles them first. Otherwise the renderers may use the wrong focus state. - this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window); + this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, parent.ownerDocument.defaultView ?? window, this._document ?? window.document); this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService); this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._handleTextAreaFocus(ev))); @@ -466,7 +466,7 @@ export class Terminal extends CoreTerminal implements ITerminal { this.register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e))); this.onResize(e => this._renderService!.resize(e.cols, e.rows)); - this._compositionView = document.createElement('div'); + this._compositionView = this._document.createElement('div'); this._compositionView.classList.add('composition-view'); this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView); this._helperContainer.appendChild(this._compositionView); diff --git a/src/browser/TestUtils.test.ts b/src/browser/TestUtils.test.ts index 7b464a338..b36e3b497 100644 --- a/src/browser/TestUtils.test.ts +++ b/src/browser/TestUtils.test.ts @@ -355,6 +355,9 @@ export class MockCoreBrowserService implements ICoreBrowserService { public get window(): Window & typeof globalThis { throw Error('Window object not available in tests'); } + public get mainDocument(): Document { + throw Error('Document object not available in tests'); + } public dpr: number = 1; } diff --git a/src/browser/decorations/BufferDecorationRenderer.ts b/src/browser/decorations/BufferDecorationRenderer.ts index ba4f6ca8f..0cac7bc78 100644 --- a/src/browser/decorations/BufferDecorationRenderer.ts +++ b/src/browser/decorations/BufferDecorationRenderer.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { addDisposableDomListener } from 'browser/Lifecycle'; -import { IRenderService } from 'browser/services/Services'; +import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services'; @@ -19,6 +19,7 @@ export class BufferDecorationRenderer extends Disposable { constructor( private readonly _screenElement: HTMLElement, @IBufferService private readonly _bufferService: IBufferService, + @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService, @IDecorationService private readonly _decorationService: IDecorationService, @IRenderService private readonly _renderService: IRenderService ) { @@ -70,7 +71,7 @@ export class BufferDecorationRenderer extends Disposable { } private _createElement(decoration: IInternalDecoration): HTMLElement { - const element = document.createElement('div'); + const element = this._coreBrowserService.mainDocument.createElement('div'); element.classList.add('xterm-decoration'); element.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top'); element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`; diff --git a/src/browser/decorations/OverviewRulerRenderer.ts b/src/browser/decorations/OverviewRulerRenderer.ts index d57653859..d63d87450 100644 --- a/src/browser/decorations/OverviewRulerRenderer.ts +++ b/src/browser/decorations/OverviewRulerRenderer.ts @@ -52,10 +52,10 @@ export class OverviewRulerRenderer extends Disposable { @IDecorationService private readonly _decorationService: IDecorationService, @IRenderService private readonly _renderService: IRenderService, @IOptionsService private readonly _optionsService: IOptionsService, - @ICoreBrowserService private readonly _coreBrowseService: ICoreBrowserService + @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService ) { super(); - this._canvas = document.createElement('canvas'); + this._canvas = this._coreBrowserService.mainDocument.createElement('canvas'); this._canvas.classList.add('xterm-decoration-overview-ruler'); this._refreshCanvasDimensions(); this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement); @@ -112,7 +112,7 @@ export class OverviewRulerRenderer extends Disposable { // overview ruler width changed this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true))); // device pixel ratio changed - this.register(addDisposableDomListener(this._coreBrowseService.window, 'resize', () => this._queueRefresh(true))); + this.register(addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true))); // set the canvas dimensions this._queueRefresh(true); } @@ -135,11 +135,11 @@ export class OverviewRulerRenderer extends Disposable { } private _refreshDrawHeightConstants(): void { - drawHeight.full = Math.round(2 * this._coreBrowseService.dpr); + drawHeight.full = Math.round(2 * this._coreBrowserService.dpr); // Calculate actual pixels per line const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length; // Clamp actual pixels within a range - const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowseService.dpr); + const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowserService.dpr); drawHeight.left = nonFullHeight; drawHeight.center = nonFullHeight; drawHeight.right = nonFullHeight; @@ -157,9 +157,9 @@ export class OverviewRulerRenderer extends Disposable { private _refreshCanvasDimensions(): void { this._canvas.style.width = `${this._width}px`; - this._canvas.width = Math.round(this._width * this._coreBrowseService.dpr); + this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr); this._canvas.style.height = `${this._screenElement.clientHeight}px`; - this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowseService.dpr); + this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr); this._refreshDrawConstants(); this._refreshColorZonePadding(); } @@ -211,7 +211,7 @@ export class OverviewRulerRenderer extends Disposable { if (this._animationFrame !== undefined) { return; } - this._animationFrame = this._coreBrowseService.window.requestAnimationFrame(() => { + this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => { this._refreshDecorations(); this._animationFrame = undefined; }); diff --git a/src/browser/renderer/shared/CustomGlyphs.ts b/src/browser/renderer/shared/CustomGlyphs.ts index c08bc4b16..cf6292af4 100644 --- a/src/browser/renderer/shared/CustomGlyphs.ts +++ b/src/browser/renderer/shared/CustomGlyphs.ts @@ -474,7 +474,7 @@ function drawPatternChar( if (!pattern) { const width = charDefinition[0].length; const height = charDefinition.length; - const tmpCanvas = document.createElement('canvas'); + const tmpCanvas = ctx.canvas.ownerDocument.createElement('canvas'); tmpCanvas.width = width; tmpCanvas.height = height; const tmpCtx = throwIfFalsy(tmpCanvas.getContext('2d')); diff --git a/src/browser/services/CoreBrowserService.ts b/src/browser/services/CoreBrowserService.ts index e992f2554..ad61deecb 100644 --- a/src/browser/services/CoreBrowserService.ts +++ b/src/browser/services/CoreBrowserService.ts @@ -13,7 +13,8 @@ export class CoreBrowserService implements ICoreBrowserService { constructor( private _textarea: HTMLTextAreaElement, - public readonly window: Window & typeof globalThis + public readonly window: Window & typeof globalThis, + public readonly mainDocument: Document ) { this._textarea.addEventListener('focus', () => this._isFocused = true); this._textarea.addEventListener('blur', () => this._isFocused = false); diff --git a/src/browser/services/Services.ts b/src/browser/services/Services.ts index d96285f79..50c718258 100644 --- a/src/browser/services/Services.ts +++ b/src/browser/services/Services.ts @@ -34,6 +34,11 @@ export interface ICoreBrowserService { * window. */ readonly window: Window & typeof globalThis; + /** + * The document of the primary window if working with multiple windows. This + * is set by the documentOverride setting. + */ + readonly mainDocument: Document; /** * Helper for getting the devicePixelRatio of the parent window. */ diff --git a/src/common/Color.ts b/src/common/Color.ts index 108d72f36..9bfed4e64 100644 --- a/src/common/Color.ts +++ b/src/common/Color.ts @@ -113,6 +113,7 @@ export namespace css { let $ctx: CanvasRenderingContext2D | undefined; let $litmusColor: CanvasGradient | undefined; if (!isNode) { + // This is guaranteed to run in the first window, so document should be correct const canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = 1; From 45605db3c5028c5116c1bf7e732722ab2e2bdf86 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:39:48 -0700 Subject: [PATCH 04/46] Listen to window change and pass through to ScreenDprMonitor --- src/browser/AccessibilityManager.ts | 4 +++- src/browser/ScreenDprMonitor.ts | 12 +++++++++- src/browser/Terminal.ts | 21 +++++++++++++---- src/browser/TestUtils.test.ts | 1 + .../decorations/OverviewRulerRenderer.ts | 1 + src/browser/services/CoreBrowserService.ts | 23 +++++++++++++++++-- src/browser/services/RenderService.ts | 6 ++--- src/browser/services/Services.ts | 14 ++++++----- 8 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index 1005414f0..e8cd58886 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -11,6 +11,7 @@ import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; import { addDisposableDomListener } from 'browser/Lifecycle'; import { IBuffer } from 'common/buffer/Types'; +import { IInstantiationService } from 'common/services/Services'; const MAX_ROWS_TO_READ = 20; @@ -49,6 +50,7 @@ export class AccessibilityManager extends Disposable { constructor( private readonly _terminal: ITerminal, + @IInstantiationService instantiationService: IInstantiationService, @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService, @IRenderService private readonly _renderService: IRenderService ) { @@ -95,7 +97,7 @@ export class AccessibilityManager extends Disposable { this.register(this._terminal.onBlur(() => this._clearLiveRegion())); this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())); - this._screenDprMonitor = new ScreenDprMonitor(window); + this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); this.register(this._screenDprMonitor); this._screenDprMonitor.setListener(() => this._refreshRowsDimensions()); // This shouldn't be needed on modern browsers but is present in case the diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index 1c3f31b75..5bb2aa721 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -3,6 +3,7 @@ * @license MIT */ +import { ICoreBrowserService } from 'browser/services/Services'; import { Disposable, toDisposable } from 'common/Lifecycle'; export type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRatio?: number) => void; @@ -22,9 +23,18 @@ export class ScreenDprMonitor extends Disposable { private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; private _listener: ScreenDprListener | undefined; private _resolutionMediaMatchList: MediaQueryList | undefined; + private _parentWindow: Window; - constructor(private _parentWindow: Window) { + constructor(@ICoreBrowserService coreBrowserService: ICoreBrowserService) { super(); + this._parentWindow = coreBrowserService.window; + this.register(coreBrowserService.onWindowChange(w => { + this._parentWindow = w; + if (this._listener && this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio); + } + this._updateDpr(); + })); this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; this.register(toDisposable(() => { this.clearListener(); diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index 9d4ca5a02..b64c3b1d9 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -58,9 +58,6 @@ import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } import { WindowsOptionsReportType } from '../common/InputHandler'; import { AccessibilityManager } from './AccessibilityManager'; -// Let it work inside Node.js for automated testing purposes. -const document: Document = (typeof window !== 'undefined') ? window.document : null as any; - export class Terminal extends CoreTerminal implements ITerminal { public textarea: HTMLTextAreaElement | undefined; public element: HTMLElement | undefined; @@ -397,7 +394,16 @@ export class Terminal extends CoreTerminal implements ITerminal { this._logService.debug('Terminal.open was called on an element that was not attached to the DOM'); } - this._document = parent.ownerDocument!; + // If the terminal is already opened + if (this.element?.ownerDocument.defaultView && this._coreBrowserService) { + // Adjust the window if needed + if (this.element.ownerDocument.defaultView !== this._coreBrowserService.window) { + this._coreBrowserService.window = this.element.ownerDocument.defaultView; + } + return; + } + + this._document = parent.ownerDocument; if (this.options.documentOverride && this.options.documentOverride instanceof Document) { this._document = this.optionsService.rawOptions.documentOverride as Document; } @@ -444,7 +450,12 @@ export class Terminal extends CoreTerminal implements ITerminal { // Register the core browser service before the generic textarea handlers are registered so it // handles them first. Otherwise the renderers may use the wrong focus state. - this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, parent.ownerDocument.defaultView ?? window, this._document ?? window.document); + this._coreBrowserService = this.register(this._instantiationService.createInstance(CoreBrowserService, + this.textarea, + parent.ownerDocument.defaultView ?? window, + // Force unsafe null in node.js environment for tests + this._document ?? (typeof window !== 'undefined') ? window.document : null as any + )); this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService); this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._handleTextAreaFocus(ev))); diff --git a/src/browser/TestUtils.test.ts b/src/browser/TestUtils.test.ts index b36e3b497..1ad5bc76b 100644 --- a/src/browser/TestUtils.test.ts +++ b/src/browser/TestUtils.test.ts @@ -350,6 +350,7 @@ export class MockCompositionHelper implements ICompositionHelper { } export class MockCoreBrowserService implements ICoreBrowserService { + public onWindowChange = new EventEmitter().event; public serviceBrand: undefined; public isFocused: boolean = true; public get window(): Window & typeof globalThis { diff --git a/src/browser/decorations/OverviewRulerRenderer.ts b/src/browser/decorations/OverviewRulerRenderer.ts index d63d87450..8648248a7 100644 --- a/src/browser/decorations/OverviewRulerRenderer.ts +++ b/src/browser/decorations/OverviewRulerRenderer.ts @@ -112,6 +112,7 @@ export class OverviewRulerRenderer extends Disposable { // overview ruler width changed this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true))); // device pixel ratio changed + // TODO: Observe DPR instead this.register(addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true))); // set the canvas dimensions this._queueRefresh(true); diff --git a/src/browser/services/CoreBrowserService.ts b/src/browser/services/CoreBrowserService.ts index ad61deecb..2c598606f 100644 --- a/src/browser/services/CoreBrowserService.ts +++ b/src/browser/services/CoreBrowserService.ts @@ -3,23 +3,42 @@ * @license MIT */ +import { Disposable } from 'common/Lifecycle'; import { ICoreBrowserService } from './Services'; +import { EventEmitter } from 'common/EventEmitter'; -export class CoreBrowserService implements ICoreBrowserService { +export class CoreBrowserService extends Disposable implements ICoreBrowserService { public serviceBrand: undefined; private _isFocused = false; private _cachedIsFocused: boolean | undefined = undefined; + private readonly _onWindowChange = this.register(new EventEmitter()); + public readonly onWindowChange = this._onWindowChange.event; + constructor( private _textarea: HTMLTextAreaElement, - public readonly window: Window & typeof globalThis, + // TODO: Add getter and setter and event + private _window: Window & typeof globalThis, public readonly mainDocument: Document ) { + super(); + this._textarea.addEventListener('focus', () => this._isFocused = true); this._textarea.addEventListener('blur', () => this._isFocused = false); } + public get window(): Window & typeof globalThis { + return this._window; + } + + public set window(value: Window & typeof globalThis) { + if (this._window !== value) { + this._window = value; + this._onWindowChange.fire(this._window); + } + } + public get dpr(): number { return this.window.devicePixelRatio; } diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index e6d259c28..9fc3f8a9e 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -12,7 +12,7 @@ import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } import { EventEmitter } from 'common/EventEmitter'; import { Disposable, MutableDisposable } from 'common/Lifecycle'; import { DebouncedIdleTask } from 'common/TaskQueue'; -import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; +import { IBufferService, IDecorationService, IInstantiationService, IOptionsService } from 'common/services/Services'; interface ISelectionState { start: [number, number] | undefined; @@ -59,6 +59,7 @@ export class RenderService extends Disposable implements IRenderService { @IDecorationService decorationService: IDecorationService, @IBufferService bufferService: IBufferService, @ICoreBrowserService coreBrowserService: ICoreBrowserService, + @IInstantiationService instantiationService: IInstantiationService, @IThemeService themeService: IThemeService ) { super(); @@ -66,9 +67,8 @@ export class RenderService extends Disposable implements IRenderService { this._renderDebouncer = new RenderDebouncer(coreBrowserService.window, (start, end) => this._renderRows(start, end)); this.register(this._renderDebouncer); - this._screenDprMonitor = new ScreenDprMonitor(coreBrowserService.window); + this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); this._screenDprMonitor.setListener(() => this.handleDevicePixelRatioChange()); - this.register(this._screenDprMonitor); this.register(bufferService.onResize(() => this._fullRefresh())); this.register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear())); diff --git a/src/browser/services/Services.ts b/src/browser/services/Services.ts index 50c718258..a1faab3d1 100644 --- a/src/browser/services/Services.ts +++ b/src/browser/services/Services.ts @@ -28,15 +28,17 @@ export interface ICoreBrowserService { serviceBrand: undefined; readonly isFocused: boolean; + + onWindowChange: IEvent; /** - * Parent window that the terminal is rendered into. DOM and rendering APIs - * (e.g. requestAnimationFrame) should be invoked in the context of this - * window. + * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g. + * requestAnimationFrame) should be invoked in the context of this window. This should be set when + * the window hosting the xterm.js instance changes. */ - readonly window: Window & typeof globalThis; + window: Window & typeof globalThis; /** - * The document of the primary window if working with multiple windows. This - * is set by the documentOverride setting. + * The document of the primary window to be used to create elements when working with multiple + * windows. This is defined by the documentOverride setting. */ readonly mainDocument: Document; /** From 63790f8854d5b6773b0cf1e303b9e5167da5681e Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:49:28 -0700 Subject: [PATCH 05/46] Change ScreenDprMonitor to be event based --- src/browser/AccessibilityManager.ts | 4 +- src/browser/ScreenDprMonitor.ts | 52 +++++++++---------- .../decorations/BufferDecorationRenderer.ts | 1 + .../decorations/OverviewRulerRenderer.ts | 2 +- src/browser/services/RenderService.ts | 3 +- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index e8cd58886..ed2c12b0b 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -98,10 +98,10 @@ export class AccessibilityManager extends Disposable { this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())); this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); - this.register(this._screenDprMonitor); - this._screenDprMonitor.setListener(() => this._refreshRowsDimensions()); + this.register(this._screenDprMonitor.onDprChange(() => this._refreshRowsDimensions())); // This shouldn't be needed on modern browsers but is present in case the // media query that drives the ScreenDprMonitor isn't supported + // TODO: Listen to window change this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions())); this._refreshRows(); diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index 5bb2aa721..6ff016e5d 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -4,10 +4,9 @@ */ import { ICoreBrowserService } from 'browser/services/Services'; +import { EventEmitter } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; -export type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRatio?: number) => void; - /** * The screen device pixel ratio monitor allows listening for when the * window.devicePixelRatio value changes. This is done not with polling but with @@ -21,39 +20,41 @@ export type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRat export class ScreenDprMonitor extends Disposable { private _currentDevicePixelRatio: number; private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; - private _listener: ScreenDprListener | undefined; private _resolutionMediaMatchList: MediaQueryList | undefined; private _parentWindow: Window; + private readonly _onDprChange = this.register(new EventEmitter()); + public readonly onDprChange = this._onDprChange.event; + constructor(@ICoreBrowserService coreBrowserService: ICoreBrowserService) { super(); - this._parentWindow = coreBrowserService.window; - this.register(coreBrowserService.onWindowChange(w => { - this._parentWindow = w; - if (this._listener && this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { - this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio); - } - this._updateDpr(); - })); - this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; - this.register(toDisposable(() => { - this.clearListener(); - })); - } - public setListener(listener: ScreenDprListener): void { - if (this._listener) { - this.clearListener(); - } - this._listener = listener; + this._parentWindow = coreBrowserService.window; + + // Initialize listener and dpr value this._outerListener = () => { - if (!this._listener) { - return; + if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._onDprChange.fire(this._parentWindow.devicePixelRatio); } - this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio); this._updateDpr(); }; + this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; this._updateDpr(); + + // Listen for window changes + this.register(coreBrowserService.onWindowChange(w => { + this._parentWindow = w; + if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._onDprChange.fire(this._parentWindow.devicePixelRatio); + } + this._updateDpr(); + })); + + // Setup additional disposables + this.register(toDisposable(() => this.clearListener())); + } + + public setListener(): void { } private _updateDpr(): void { @@ -71,12 +72,11 @@ export class ScreenDprMonitor extends Disposable { } public clearListener(): void { - if (!this._resolutionMediaMatchList || !this._listener || !this._outerListener) { + if (!this._resolutionMediaMatchList || !this._outerListener) { return; } this._resolutionMediaMatchList.removeListener(this._outerListener); this._resolutionMediaMatchList = undefined; - this._listener = undefined; this._outerListener = undefined; } } diff --git a/src/browser/decorations/BufferDecorationRenderer.ts b/src/browser/decorations/BufferDecorationRenderer.ts index 0cac7bc78..3a0d78621 100644 --- a/src/browser/decorations/BufferDecorationRenderer.ts +++ b/src/browser/decorations/BufferDecorationRenderer.ts @@ -34,6 +34,7 @@ export class BufferDecorationRenderer extends Disposable { this._dimensionsChanged = true; this._queueRefresh(); })); + // TODO: Listen to window change this.register(addDisposableDomListener(window, 'resize', () => this._queueRefresh())); this.register(this._bufferService.buffers.onBufferActivate(() => { this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt; diff --git a/src/browser/decorations/OverviewRulerRenderer.ts b/src/browser/decorations/OverviewRulerRenderer.ts index 8648248a7..57b6dfc62 100644 --- a/src/browser/decorations/OverviewRulerRenderer.ts +++ b/src/browser/decorations/OverviewRulerRenderer.ts @@ -112,7 +112,7 @@ export class OverviewRulerRenderer extends Disposable { // overview ruler width changed this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true))); // device pixel ratio changed - // TODO: Observe DPR instead + // TODO: Observe DPR instead / listen to window change this.register(addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true))); // set the canvas dimensions this._queueRefresh(true); diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index 9fc3f8a9e..60c277980 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -68,7 +68,7 @@ export class RenderService extends Disposable implements IRenderService { this.register(this._renderDebouncer); this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); - this._screenDprMonitor.setListener(() => this.handleDevicePixelRatioChange()); + this.register(this._screenDprMonitor.onDprChange(() => this.handleDevicePixelRatioChange())); this.register(bufferService.onResize(() => this._fullRefresh())); this.register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear())); @@ -106,6 +106,7 @@ export class RenderService extends Disposable implements IRenderService { // dprchange should handle this case, we need this as well for browsers that don't support the // matchMedia query. + // TODO: Listen to window change this.register(addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange())); this.register(themeService.onChangeColors(() => this._fullRefresh())); From 4cc51ca08fa8a38e8859d60a5a594a876e28c3d5 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:55:07 -0700 Subject: [PATCH 06/46] Move ScreenDprMonitor into CoreBrowserService --- src/browser/AccessibilityManager.ts | 6 +----- src/browser/ScreenDprMonitor.ts | 22 +++++++--------------- src/browser/TestUtils.test.ts | 1 + src/browser/services/CoreBrowserService.ts | 10 ++++++++-- src/browser/services/RenderService.ts | 5 +---- src/browser/services/Services.ts | 4 +++- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index ed2c12b0b..703459f41 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -7,7 +7,6 @@ import * as Strings from 'browser/LocalizableStrings'; import { ITerminal, IRenderDebouncer } from 'browser/Types'; import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer'; import { Disposable, toDisposable } from 'common/Lifecycle'; -import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; import { addDisposableDomListener } from 'browser/Lifecycle'; import { IBuffer } from 'common/buffer/Types'; @@ -30,8 +29,6 @@ export class AccessibilityManager extends Disposable { private _liveRegionLineCount: number = 0; private _liveRegionDebouncer: IRenderDebouncer; - private _screenDprMonitor: ScreenDprMonitor; - private _topBoundaryFocusListener: (e: FocusEvent) => void; private _bottomBoundaryFocusListener: (e: FocusEvent) => void; @@ -97,8 +94,7 @@ export class AccessibilityManager extends Disposable { this.register(this._terminal.onBlur(() => this._clearLiveRegion())); this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())); - this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); - this.register(this._screenDprMonitor.onDprChange(() => this._refreshRowsDimensions())); + this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions())); // This shouldn't be needed on modern browsers but is present in case the // media query that drives the ScreenDprMonitor isn't supported // TODO: Listen to window change diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index 6ff016e5d..1152a55a5 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -3,7 +3,6 @@ * @license MIT */ -import { ICoreBrowserService } from 'browser/services/Services'; import { EventEmitter } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; @@ -21,16 +20,13 @@ export class ScreenDprMonitor extends Disposable { private _currentDevicePixelRatio: number; private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; private _resolutionMediaMatchList: MediaQueryList | undefined; - private _parentWindow: Window; private readonly _onDprChange = this.register(new EventEmitter()); public readonly onDprChange = this._onDprChange.event; - constructor(@ICoreBrowserService coreBrowserService: ICoreBrowserService) { + constructor(private _parentWindow: Window) { super(); - this._parentWindow = coreBrowserService.window; - // Initialize listener and dpr value this._outerListener = () => { if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { @@ -41,20 +37,16 @@ export class ScreenDprMonitor extends Disposable { this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; this._updateDpr(); - // Listen for window changes - this.register(coreBrowserService.onWindowChange(w => { - this._parentWindow = w; - if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { - this._onDprChange.fire(this._parentWindow.devicePixelRatio); - } - this._updateDpr(); - })); - // Setup additional disposables this.register(toDisposable(() => this.clearListener())); } - public setListener(): void { + public setWindow(parentWindow: Window): void { + this._parentWindow = parentWindow; + if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._onDprChange.fire(this._parentWindow.devicePixelRatio); + } + this._updateDpr(); } private _updateDpr(): void { diff --git a/src/browser/TestUtils.test.ts b/src/browser/TestUtils.test.ts index 1ad5bc76b..d557cd989 100644 --- a/src/browser/TestUtils.test.ts +++ b/src/browser/TestUtils.test.ts @@ -350,6 +350,7 @@ export class MockCompositionHelper implements ICompositionHelper { } export class MockCoreBrowserService implements ICoreBrowserService { + public onDprChange = new EventEmitter().event; public onWindowChange = new EventEmitter().event; public serviceBrand: undefined; public isFocused: boolean = true; diff --git a/src/browser/services/CoreBrowserService.ts b/src/browser/services/CoreBrowserService.ts index 2c598606f..8a189315d 100644 --- a/src/browser/services/CoreBrowserService.ts +++ b/src/browser/services/CoreBrowserService.ts @@ -5,25 +5,31 @@ import { Disposable } from 'common/Lifecycle'; import { ICoreBrowserService } from './Services'; -import { EventEmitter } from 'common/EventEmitter'; +import { EventEmitter, forwardEvent } from 'common/EventEmitter'; +import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; export class CoreBrowserService extends Disposable implements ICoreBrowserService { public serviceBrand: undefined; private _isFocused = false; private _cachedIsFocused: boolean | undefined = undefined; + private _screenDprMonitor = new ScreenDprMonitor(this._window); + private readonly _onDprChange = this.register(new EventEmitter()); + public readonly onDprChange = this._onDprChange.event; private readonly _onWindowChange = this.register(new EventEmitter()); public readonly onWindowChange = this._onWindowChange.event; constructor( private _textarea: HTMLTextAreaElement, - // TODO: Add getter and setter and event private _window: Window & typeof globalThis, public readonly mainDocument: Document ) { super(); + this.register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w))); + this.register(forwardEvent(this._screenDprMonitor.onDprChange, this._onDprChange)); + this._textarea.addEventListener('focus', () => this._isFocused = true); this._textarea.addEventListener('blur', () => this._isFocused = false); } diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index 60c277980..179ddeb2c 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -5,7 +5,6 @@ import { addDisposableDomListener } from 'browser/Lifecycle'; import { RenderDebouncer } from 'browser/RenderDebouncer'; -import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; import { IRenderDebouncerWithCallback } from 'browser/Types'; import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types'; import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services'; @@ -25,7 +24,6 @@ export class RenderService extends Disposable implements IRenderService { private _renderer: MutableDisposable = this.register(new MutableDisposable()); private _renderDebouncer: IRenderDebouncerWithCallback; - private _screenDprMonitor: ScreenDprMonitor; private _pausedResizeTask = new DebouncedIdleTask(); private _isPaused: boolean = false; @@ -67,8 +65,7 @@ export class RenderService extends Disposable implements IRenderService { this._renderDebouncer = new RenderDebouncer(coreBrowserService.window, (start, end) => this._renderRows(start, end)); this.register(this._renderDebouncer); - this._screenDprMonitor = this.register(instantiationService.createInstance(ScreenDprMonitor)); - this.register(this._screenDprMonitor.onDprChange(() => this.handleDevicePixelRatioChange())); + this.register(coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange())); this.register(bufferService.onResize(() => this._fullRefresh())); this.register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear())); diff --git a/src/browser/services/Services.ts b/src/browser/services/Services.ts index a1faab3d1..5c14fa8af 100644 --- a/src/browser/services/Services.ts +++ b/src/browser/services/Services.ts @@ -29,7 +29,9 @@ export interface ICoreBrowserService { readonly isFocused: boolean; - onWindowChange: IEvent; + readonly onDprChange: IEvent; + readonly onWindowChange: IEvent; + /** * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g. * requestAnimationFrame) should be invoked in the context of this window. This should be set when From 92535e539f371d46ea28de7666de1ce68f1f770f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:56:02 -0700 Subject: [PATCH 07/46] Inline ScreenDprMonitor into CoreBrowserService file --- src/browser/ScreenDprMonitor.ts | 74 ---------------------- src/browser/services/CoreBrowserService.ts | 71 ++++++++++++++++++++- 2 files changed, 69 insertions(+), 76 deletions(-) delete mode 100644 src/browser/ScreenDprMonitor.ts diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts deleted file mode 100644 index 1152a55a5..000000000 --- a/src/browser/ScreenDprMonitor.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2017 The xterm.js authors. All rights reserved. - * @license MIT - */ - -import { EventEmitter } from 'common/EventEmitter'; -import { Disposable, toDisposable } from 'common/Lifecycle'; - -/** - * The screen device pixel ratio monitor allows listening for when the - * window.devicePixelRatio value changes. This is done not with polling but with - * the use of window.matchMedia to watch media queries. When the event fires, - * the listener will be reattached using a different media query to ensure that - * any further changes will register. - * - * The listener should fire on both window zoom changes and switching to a - * monitor with a different DPI. - */ -export class ScreenDprMonitor extends Disposable { - private _currentDevicePixelRatio: number; - private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; - private _resolutionMediaMatchList: MediaQueryList | undefined; - - private readonly _onDprChange = this.register(new EventEmitter()); - public readonly onDprChange = this._onDprChange.event; - - constructor(private _parentWindow: Window) { - super(); - - // Initialize listener and dpr value - this._outerListener = () => { - if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { - this._onDprChange.fire(this._parentWindow.devicePixelRatio); - } - this._updateDpr(); - }; - this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; - this._updateDpr(); - - // Setup additional disposables - this.register(toDisposable(() => this.clearListener())); - } - - public setWindow(parentWindow: Window): void { - this._parentWindow = parentWindow; - if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { - this._onDprChange.fire(this._parentWindow.devicePixelRatio); - } - this._updateDpr(); - } - - private _updateDpr(): void { - if (!this._outerListener) { - return; - } - - // Clear listeners for old DPR - this._resolutionMediaMatchList?.removeListener(this._outerListener); - - // Add listeners for new DPR - this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; - this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`); - this._resolutionMediaMatchList.addListener(this._outerListener); - } - - public clearListener(): void { - if (!this._resolutionMediaMatchList || !this._outerListener) { - return; - } - this._resolutionMediaMatchList.removeListener(this._outerListener); - this._resolutionMediaMatchList = undefined; - this._outerListener = undefined; - } -} diff --git a/src/browser/services/CoreBrowserService.ts b/src/browser/services/CoreBrowserService.ts index 8a189315d..dfd3474d0 100644 --- a/src/browser/services/CoreBrowserService.ts +++ b/src/browser/services/CoreBrowserService.ts @@ -3,10 +3,9 @@ * @license MIT */ -import { Disposable } from 'common/Lifecycle'; +import { Disposable, toDisposable } from 'common/Lifecycle'; import { ICoreBrowserService } from './Services'; import { EventEmitter, forwardEvent } from 'common/EventEmitter'; -import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; export class CoreBrowserService extends Disposable implements ICoreBrowserService { public serviceBrand: undefined; @@ -57,3 +56,71 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic return this._cachedIsFocused; } } + + +/** + * The screen device pixel ratio monitor allows listening for when the + * window.devicePixelRatio value changes. This is done not with polling but with + * the use of window.matchMedia to watch media queries. When the event fires, + * the listener will be reattached using a different media query to ensure that + * any further changes will register. + * + * The listener should fire on both window zoom changes and switching to a + * monitor with a different DPI. + */ +class ScreenDprMonitor extends Disposable { + private _currentDevicePixelRatio: number; + private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; + private _resolutionMediaMatchList: MediaQueryList | undefined; + + private readonly _onDprChange = this.register(new EventEmitter()); + public readonly onDprChange = this._onDprChange.event; + + constructor(private _parentWindow: Window) { + super(); + + // Initialize listener and dpr value + this._outerListener = () => { + if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._onDprChange.fire(this._parentWindow.devicePixelRatio); + } + this._updateDpr(); + }; + this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; + this._updateDpr(); + + // Setup additional disposables + this.register(toDisposable(() => this.clearListener())); + } + + public setWindow(parentWindow: Window): void { + this._parentWindow = parentWindow; + if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { + this._onDprChange.fire(this._parentWindow.devicePixelRatio); + } + this._updateDpr(); + } + + private _updateDpr(): void { + if (!this._outerListener) { + return; + } + + // Clear listeners for old DPR + this._resolutionMediaMatchList?.removeListener(this._outerListener); + + // Add listeners for new DPR + this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; + this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`); + this._resolutionMediaMatchList.addListener(this._outerListener); + } + + public clearListener(): void { + if (!this._resolutionMediaMatchList || !this._outerListener) { + return; + } + this._resolutionMediaMatchList.removeListener(this._outerListener); + this._resolutionMediaMatchList = undefined; + this._outerListener = undefined; + } +} From 6e12d94f11bdb2b12d5b6bedd419f893c9004f64 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 09:10:04 -0700 Subject: [PATCH 08/46] Move window resize listeners over to onWindowChange --- src/browser/AccessibilityManager.ts | 9 ++++++--- src/browser/decorations/BufferDecorationRenderer.ts | 9 ++++++--- src/browser/decorations/OverviewRulerRenderer.ts | 9 ++++++--- src/browser/services/RenderService.ts | 8 ++++++-- src/common/EventEmitter.ts | 5 +++++ typings/xterm.d.ts | 3 ++- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index 703459f41..de00a1d34 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -6,11 +6,12 @@ import * as Strings from 'browser/LocalizableStrings'; import { ITerminal, IRenderDebouncer } from 'browser/Types'; import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer'; -import { Disposable, toDisposable } from 'common/Lifecycle'; +import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; import { addDisposableDomListener } from 'browser/Lifecycle'; import { IBuffer } from 'common/buffer/Types'; import { IInstantiationService } from 'common/services/Services'; +import { runAndSubscribe } from 'common/EventEmitter'; const MAX_ROWS_TO_READ = 20; @@ -97,8 +98,10 @@ export class AccessibilityManager extends Disposable { this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions())); // This shouldn't be needed on modern browsers but is present in case the // media query that drives the ScreenDprMonitor isn't supported - // TODO: Listen to window change - this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions())); + const windowResizeListener = this.register(new MutableDisposable()); + this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { + windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._refreshRowsDimensions()); + })); this._refreshRows(); this.register(toDisposable(() => { diff --git a/src/browser/decorations/BufferDecorationRenderer.ts b/src/browser/decorations/BufferDecorationRenderer.ts index 3a0d78621..3fe56512b 100644 --- a/src/browser/decorations/BufferDecorationRenderer.ts +++ b/src/browser/decorations/BufferDecorationRenderer.ts @@ -5,7 +5,8 @@ import { addDisposableDomListener } from 'browser/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; -import { Disposable, toDisposable } from 'common/Lifecycle'; +import { runAndSubscribe } from 'common/EventEmitter'; +import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services'; export class BufferDecorationRenderer extends Disposable { @@ -34,8 +35,10 @@ export class BufferDecorationRenderer extends Disposable { this._dimensionsChanged = true; this._queueRefresh(); })); - // TODO: Listen to window change - this.register(addDisposableDomListener(window, 'resize', () => this._queueRefresh())); + const windowResizeListener = this.register(new MutableDisposable()); + this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { + windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh()); + })); this.register(this._bufferService.buffers.onBufferActivate(() => { this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt; })); diff --git a/src/browser/decorations/OverviewRulerRenderer.ts b/src/browser/decorations/OverviewRulerRenderer.ts index 57b6dfc62..157775f92 100644 --- a/src/browser/decorations/OverviewRulerRenderer.ts +++ b/src/browser/decorations/OverviewRulerRenderer.ts @@ -6,7 +6,8 @@ import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore'; import { addDisposableDomListener } from 'browser/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; -import { Disposable, toDisposable } from 'common/Lifecycle'; +import { runAndSubscribe } from 'common/EventEmitter'; +import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; // Helper objects to avoid excessive calculation and garbage collection during rendering. These are @@ -112,8 +113,10 @@ export class OverviewRulerRenderer extends Disposable { // overview ruler width changed this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true))); // device pixel ratio changed - // TODO: Observe DPR instead / listen to window change - this.register(addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true))); + const windowResizeListener = this.register(new MutableDisposable()); + this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { + windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true)); + })); // set the canvas dimensions this._queueRefresh(true); } diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index 179ddeb2c..7b9e6d79c 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -8,7 +8,7 @@ import { RenderDebouncer } from 'browser/RenderDebouncer'; import { IRenderDebouncerWithCallback } from 'browser/Types'; import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types'; import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services'; -import { EventEmitter } from 'common/EventEmitter'; +import { EventEmitter, runAndSubscribe } from 'common/EventEmitter'; import { Disposable, MutableDisposable } from 'common/Lifecycle'; import { DebouncedIdleTask } from 'common/TaskQueue'; import { IBufferService, IDecorationService, IInstantiationService, IOptionsService } from 'common/services/Services'; @@ -103,7 +103,11 @@ export class RenderService extends Disposable implements IRenderService { // dprchange should handle this case, we need this as well for browsers that don't support the // matchMedia query. - // TODO: Listen to window change + // TODO: Merge this into onDprChange? + const windowResizeListener = this.register(new MutableDisposable()); + this.register(runAndSubscribe(coreBrowserService.onWindowChange, () => { + windowResizeListener.value = addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange()); + })); this.register(addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange())); this.register(themeService.onChangeColors(() => this._fullRefresh())); diff --git a/src/common/EventEmitter.ts b/src/common/EventEmitter.ts index fd9590424..589748a30 100644 --- a/src/common/EventEmitter.ts +++ b/src/common/EventEmitter.ts @@ -71,3 +71,8 @@ export class EventEmitter implements IEventEmitter { export function forwardEvent(from: IEvent, to: IEventEmitter): IDisposable { return from(e => to.fire(e)); } + +export function runAndSubscribe(event: IEvent, handler: (e: T | undefined) => any): IDisposable { + handler(undefined); + return event(e => handler(e)); +} diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index b8028a181..b8c114554 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -973,7 +973,8 @@ declare module 'xterm' { resize(columns: number, rows: number): void; /** - * Opens the terminal within an element. + * Opens the terminal within an element. This should also be called if the + * xterm.js element ever changes browser window. * @param parent The element to create the terminal within. This element * must be visible (have dimensions) when `open` is called as several DOM- * based measurements need to be performed when this function is called. From 81e0718a74635840c7fdbcf7bbb96ec3c7708002 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 09:18:46 -0700 Subject: [PATCH 09/46] Move window resize edge case into dpr monitor --- src/browser/AccessibilityManager.ts | 7 ------ .../decorations/BufferDecorationRenderer.ts | 9 ++----- .../decorations/OverviewRulerRenderer.ts | 9 ++----- src/browser/services/CoreBrowserService.ts | 25 +++++++++++++------ src/browser/services/RenderService.ts | 12 +-------- 5 files changed, 23 insertions(+), 39 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index de00a1d34..54f50ef2c 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -94,14 +94,7 @@ export class AccessibilityManager extends Disposable { this.register(this._terminal.onKey(e => this._handleKey(e.key))); this.register(this._terminal.onBlur(() => this._clearLiveRegion())); this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())); - this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions())); - // This shouldn't be needed on modern browsers but is present in case the - // media query that drives the ScreenDprMonitor isn't supported - const windowResizeListener = this.register(new MutableDisposable()); - this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { - windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._refreshRowsDimensions()); - })); this._refreshRows(); this.register(toDisposable(() => { diff --git a/src/browser/decorations/BufferDecorationRenderer.ts b/src/browser/decorations/BufferDecorationRenderer.ts index 3fe56512b..6ba9ae1ec 100644 --- a/src/browser/decorations/BufferDecorationRenderer.ts +++ b/src/browser/decorations/BufferDecorationRenderer.ts @@ -3,10 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { addDisposableDomListener } from 'browser/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; -import { runAndSubscribe } from 'common/EventEmitter'; -import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; +import { Disposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services'; export class BufferDecorationRenderer extends Disposable { @@ -35,10 +33,7 @@ export class BufferDecorationRenderer extends Disposable { this._dimensionsChanged = true; this._queueRefresh(); })); - const windowResizeListener = this.register(new MutableDisposable()); - this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { - windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh()); - })); + this.register(this._coreBrowserService.onDprChange(() => this._queueRefresh())); this.register(this._bufferService.buffers.onBufferActivate(() => { this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt; })); diff --git a/src/browser/decorations/OverviewRulerRenderer.ts b/src/browser/decorations/OverviewRulerRenderer.ts index 157775f92..103d5d9a6 100644 --- a/src/browser/decorations/OverviewRulerRenderer.ts +++ b/src/browser/decorations/OverviewRulerRenderer.ts @@ -4,10 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore'; -import { addDisposableDomListener } from 'browser/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; -import { runAndSubscribe } from 'common/EventEmitter'; -import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; +import { Disposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; // Helper objects to avoid excessive calculation and garbage collection during rendering. These are @@ -113,10 +111,7 @@ export class OverviewRulerRenderer extends Disposable { // overview ruler width changed this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true))); // device pixel ratio changed - const windowResizeListener = this.register(new MutableDisposable()); - this.register(runAndSubscribe(this._coreBrowserService.onWindowChange, () => { - windowResizeListener.value = addDisposableDomListener(this._coreBrowserService.window, 'resize', () => this._queueRefresh(true)); - })); + this.register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true))); // set the canvas dimensions this._queueRefresh(true); } diff --git a/src/browser/services/CoreBrowserService.ts b/src/browser/services/CoreBrowserService.ts index dfd3474d0..575b62b63 100644 --- a/src/browser/services/CoreBrowserService.ts +++ b/src/browser/services/CoreBrowserService.ts @@ -3,9 +3,10 @@ * @license MIT */ -import { Disposable, toDisposable } from 'common/Lifecycle'; +import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; import { ICoreBrowserService } from './Services'; import { EventEmitter, forwardEvent } from 'common/EventEmitter'; +import { addDisposableDomListener } from 'browser/Lifecycle'; export class CoreBrowserService extends Disposable implements ICoreBrowserService { public serviceBrand: undefined; @@ -26,6 +27,7 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic ) { super(); + // Monitor device pixel ratio this.register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w))); this.register(forwardEvent(this._screenDprMonitor.onDprChange, this._onDprChange)); @@ -72,6 +74,7 @@ class ScreenDprMonitor extends Disposable { private _currentDevicePixelRatio: number; private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; private _resolutionMediaMatchList: MediaQueryList | undefined; + private _windowResizeListener = this.register(new MutableDisposable()); private readonly _onDprChange = this.register(new EventEmitter()); public readonly onDprChange = this._onDprChange.event; @@ -80,21 +83,29 @@ class ScreenDprMonitor extends Disposable { super(); // Initialize listener and dpr value - this._outerListener = () => { - if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { - this._onDprChange.fire(this._parentWindow.devicePixelRatio); - } - this._updateDpr(); - }; + this._outerListener = () => this._setDprAndFireIfDiffers(); this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio; this._updateDpr(); + // Monitor active window resize + this._setWindowResizeListener(); + // Setup additional disposables this.register(toDisposable(() => this.clearListener())); } + public setWindow(parentWindow: Window): void { this._parentWindow = parentWindow; + this._setWindowResizeListener(); + this._setDprAndFireIfDiffers(); + } + + private _setWindowResizeListener(): void { + this._windowResizeListener.value = addDisposableDomListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers()); + } + + private _setDprAndFireIfDiffers(): void { if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) { this._onDprChange.fire(this._parentWindow.devicePixelRatio); } diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index 7b9e6d79c..9fa8d234c 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -3,12 +3,11 @@ * @license MIT */ -import { addDisposableDomListener } from 'browser/Lifecycle'; import { RenderDebouncer } from 'browser/RenderDebouncer'; import { IRenderDebouncerWithCallback } from 'browser/Types'; import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types'; import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services'; -import { EventEmitter, runAndSubscribe } from 'common/EventEmitter'; +import { EventEmitter } from 'common/EventEmitter'; import { Disposable, MutableDisposable } from 'common/Lifecycle'; import { DebouncedIdleTask } from 'common/TaskQueue'; import { IBufferService, IDecorationService, IInstantiationService, IOptionsService } from 'common/services/Services'; @@ -101,15 +100,6 @@ export class RenderService extends Disposable implements IRenderService { 'cursorStyle' ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true))); - // dprchange should handle this case, we need this as well for browsers that don't support the - // matchMedia query. - // TODO: Merge this into onDprChange? - const windowResizeListener = this.register(new MutableDisposable()); - this.register(runAndSubscribe(coreBrowserService.onWindowChange, () => { - windowResizeListener.value = addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange()); - })); - this.register(addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange())); - this.register(themeService.onChangeColors(() => this._fullRefresh())); // Detect whether IntersectionObserver is detected and enable renderer pause From 20a26a65897c51dcadc7be244bb8b27b66b03ac4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:54:29 -0700 Subject: [PATCH 10/46] Remove unused imports --- src/browser/AccessibilityManager.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/browser/AccessibilityManager.ts b/src/browser/AccessibilityManager.ts index 54f50ef2c..5f5295892 100644 --- a/src/browser/AccessibilityManager.ts +++ b/src/browser/AccessibilityManager.ts @@ -6,12 +6,10 @@ import * as Strings from 'browser/LocalizableStrings'; import { ITerminal, IRenderDebouncer } from 'browser/Types'; import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer'; -import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; +import { Disposable, toDisposable } from 'common/Lifecycle'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services'; -import { addDisposableDomListener } from 'browser/Lifecycle'; import { IBuffer } from 'common/buffer/Types'; import { IInstantiationService } from 'common/services/Services'; -import { runAndSubscribe } from 'common/EventEmitter'; const MAX_ROWS_TO_READ = 20; From 4681b319ca4712ae5d05433f6834a6f8a4a258b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:47:16 +0000 Subject: [PATCH 11/46] Bump @babel/traverse from 7.22.8 to 7.23.2 Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 94 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 77 insertions(+), 17 deletions(-) diff --git a/yarn.lock b/yarn.lock index ffebb5c5d..a0cb39da5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,6 +15,14 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + "@babel/code-frame@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" @@ -48,7 +56,7 @@ json5 "^2.2.2" semver "^6.3.1" -"@babel/generator@^7.22.7", "@babel/generator@^7.22.9": +"@babel/generator@^7.22.9": version "7.22.9" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d" integrity sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw== @@ -58,6 +66,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-compilation-targets@^7.22.9": version "7.22.9" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz#f9d0a7aaaa7cd32a3f31c9316a69f5a9bcacb892" @@ -69,18 +87,23 @@ lru-cache "^5.1.1" semver "^6.3.1" +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-environment-visitor@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98" integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q== -"@babel/helper-function-name@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be" - integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ== +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: - "@babel/template" "^7.22.5" - "@babel/types" "^7.22.5" + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" "@babel/helper-hoist-variables@^7.22.5": version "7.22.5" @@ -126,6 +149,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-identifier@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" @@ -145,6 +173,15 @@ "@babel/traverse" "^7.22.6" "@babel/types" "^7.22.5" +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@babel/highlight@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" @@ -154,6 +191,11 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/parser@^7.22.5", "@babel/parser@^7.22.7": version "7.22.7" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae" @@ -166,6 +208,15 @@ dependencies: regenerator-runtime "^0.13.11" +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + "@babel/template@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec" @@ -176,21 +227,30 @@ "@babel/types" "^7.22.5" "@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": - version "7.22.8" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.8.tgz#4d4451d31bc34efeae01eac222b514a77aa4000e" - integrity sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw== + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== dependencies: - "@babel/code-frame" "^7.22.5" - "@babel/generator" "^7.22.7" - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-function-name" "^7.22.5" + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" "@babel/helper-hoist-variables" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.22.7" - "@babel/types" "^7.22.5" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" +"@babel/types@^7.22.15", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@babel/types@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.5.tgz#cd93eeaab025880a3a47ec881f4b096a5b786fbe" @@ -1145,7 +1205,7 @@ chai@^4.3.4: pathval "^1.1.1" type-detect "^4.0.5" -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== From 6c5fb36c36d194f8ca990eb68556069f970159ec Mon Sep 17 00:00:00 2001 From: David Fiala Date: Thu, 19 Oct 2023 09:52:29 -0700 Subject: [PATCH 12/46] proper isNode detection for node v21.0.0 --- src/common/Platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 41d8552e4..2f3291995 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -13,7 +13,7 @@ interface INavigator { // we want this module to live in common. declare const navigator: INavigator; -export const isNode = (typeof navigator === 'undefined') ? true : false; +export const isNode = (typeof process !== 'undefined') ? true : false; const userAgent = (isNode) ? 'node' : navigator.userAgent; const platform = (isNode) ? 'node' : navigator.platform; From 0d0166b4bcae1db109baf3691d4472ea16171589 Mon Sep 17 00:00:00 2001 From: David Fiala Date: Thu, 19 Oct 2023 11:19:27 -0700 Subject: [PATCH 13/46] provide a declaration for 'process' needed for nodejs detect We provide no further type information as it will not be used except for a presence check for nodejs detection. --- src/common/Platform.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 2f3291995..1007fc0a3 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -12,6 +12,7 @@ interface INavigator { // We're declaring a navigator global here as we expect it in all runtimes (node and browser), but // we want this module to live in common. declare const navigator: INavigator; +declare const process: unknown; export const isNode = (typeof process !== 'undefined') ? true : false; const userAgent = (isNode) ? 'node' : navigator.userAgent; From de1304d19e8436427cfa7cb660861f373cd32a18 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 30 Oct 2023 10:44:18 +0100 Subject: [PATCH 14/46] fix: use globalThis instead of self to address non Browser consumption Currently using this package in a non Browser env will cause an error as Webpack will emit `self` which does not exist in all envs such as Node.js and Workers. This commit updates Webpack and force it to use `globalThis`. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis --- webpack.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index ca7c059ae..3769bfb0f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -39,8 +39,10 @@ const config = { output: { filename: 'xterm.js', path: path.resolve('./lib'), - libraryTarget: 'umd' + libraryTarget: 'umd', + // Force usage of globalThis instead of global / self. (This is cross-env compatible) + globalObject: 'globalThis', }, - mode: 'production' + mode: 'production', }; module.exports = config; From 6945e881a847b40dd5cb206ffb034c3ca1387892 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 31 Oct 2023 06:18:40 -0700 Subject: [PATCH 15/46] Update README.md --- addons/xterm-addon-unicode-graphemes/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/xterm-addon-unicode-graphemes/README.md b/addons/xterm-addon-unicode-graphemes/README.md index 2f5639fcc..5b8679f8e 100644 --- a/addons/xterm-addon-unicode-graphemes/README.md +++ b/addons/xterm-addon-unicode-graphemes/README.md @@ -8,9 +8,7 @@ The file `src/UnicodeProperties.ts` is generated and depends on the Unicode vers ### Install -```bash -npm install --save xterm-addon-unicode-graphemes -``` +This addon is not yet published to npm ### Usage From 974b275f6e7051fce8b00c42771488e9386dd8d2 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 31 Oct 2023 06:41:16 -0700 Subject: [PATCH 16/46] is -> did --- addons/xterm-addon-search/src/SearchAddon.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index 79cd010b3..c176a6f25 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -134,10 +134,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon { if (!this._terminal) { throw new Error('Cannot use addon until it has been loaded'); } - const isOptionsChanged = this._lastSearchOptions ? this._isOptionsChange(this._lastSearchOptions, searchOptions) : true; + const didOptionsChanged = this._lastSearchOptions ? this._didOptionsChange(this._lastSearchOptions, searchOptions) : true; this._lastSearchOptions = searchOptions; if (searchOptions?.decorations) { - if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || isOptionsChanged) { + if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || didOptionsChanged) { this._highlightAllMatches(term, searchOptions); } } @@ -303,10 +303,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon { if (!this._terminal) { throw new Error('Cannot use addon until it has been loaded'); } - const isOptionsChanged = this._lastSearchOptions ? this._isOptionsChange(this._lastSearchOptions, searchOptions) : true; + const didOptionsChanged = this._lastSearchOptions ? this._didOptionsChange(this._lastSearchOptions, searchOptions) : true; this._lastSearchOptions = searchOptions; if (searchOptions?.decorations) { - if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || isOptionsChanged) { + if (this._cachedSearchTerm === undefined || term !== this._cachedSearchTerm || didOptionsChanged) { this._highlightAllMatches(term, searchOptions); } } @@ -318,7 +318,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon { return found; } - private _isOptionsChange(lastSearchOptions: ISearchOptions, searchOptions?: ISearchOptions): boolean { + private _didOptionsChange(lastSearchOptions: ISearchOptions, searchOptions?: ISearchOptions): boolean { if (!searchOptions) { return false; } From add7f8133eb0144d491ac66fa9d5a6b9467dfbe2 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:44:26 -0700 Subject: [PATCH 17/46] Start @xterm scope with core and webgl addons --- .eslintrc.json | 4 ++-- .github/workflows/ci.yml | 8 +++---- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 10 ++++----- .../package.json | 8 +++---- .../src/GlyphRenderer.ts | 0 .../src/RectangleRenderer.ts | 0 .../src/RenderModel.ts | 0 .../src/TypedArray.test.ts | 0 .../src/TypedArray.ts | 0 .../src/Types.d.ts | 0 .../src/WebglAddon.ts | 0 .../src/WebglRenderer.ts | 0 .../src/WebglUtils.ts | 0 .../src/renderLayer/BaseRenderLayer.ts | 0 .../src/renderLayer/LinkRenderLayer.ts | 0 .../src/renderLayer/Types.ts | 0 .../src/tsconfig.json | 0 .../test/WebglRenderer.test.ts | 0 .../test/playwright.config.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-webgl.d.ts} | 2 +- .../webpack.config.js | 2 +- bin/publish.js | 22 +++++++++---------- bin/test_playwright.js | 2 +- demo/client.ts | 4 ++-- demo/tsconfig.json | 2 +- package.json | 2 +- tsconfig.all.json | 2 +- 32 files changed, 34 insertions(+), 34 deletions(-) rename addons/{xterm-addon-webgl => addon-webgl}/.gitignore (100%) rename addons/{xterm-addon-webgl => addon-webgl}/.npmignore (100%) rename addons/{xterm-addon-webgl => addon-webgl}/LICENSE (100%) rename addons/{xterm-addon-webgl => addon-webgl}/README.md (83%) rename addons/{xterm-addon-webgl => addon-webgl}/package.json (80%) rename addons/{xterm-addon-webgl => addon-webgl}/src/GlyphRenderer.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/RectangleRenderer.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/RenderModel.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/TypedArray.test.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/TypedArray.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/Types.d.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/WebglAddon.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/WebglRenderer.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/WebglUtils.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/renderLayer/BaseRenderLayer.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/renderLayer/LinkRenderLayer.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/renderLayer/Types.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/src/tsconfig.json (100%) rename addons/{xterm-addon-webgl => addon-webgl}/test/WebglRenderer.test.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/test/playwright.config.ts (100%) rename addons/{xterm-addon-webgl => addon-webgl}/test/tsconfig.json (100%) rename addons/{xterm-addon-webgl => addon-webgl}/tsconfig.json (100%) rename addons/{xterm-addon-webgl/typings/xterm-addon-webgl.d.ts => addon-webgl/typings/addon-webgl.d.ts} (96%) rename addons/{xterm-addon-webgl => addon-webgl}/webpack.config.js (94%) diff --git a/.eslintrc.json b/.eslintrc.json index 0ccafafbf..8ca2eccc0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,8 +35,8 @@ "addons/xterm-addon-unicode-graphemes/benchmark/tsconfig.json", "addons/xterm-addon-web-links/src/tsconfig.json", "addons/xterm-addon-web-links/test/tsconfig.json", - "addons/xterm-addon-webgl/src/tsconfig.json", - "addons/xterm-addon-webgl/test/tsconfig.json" + "addons/addon-webgl/src/tsconfig.json", + "addons/addon-webgl/test/tsconfig.json" ], "sourceType": "module" }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eea525d06..cd3fa512b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,8 +46,8 @@ jobs: ./addons/xterm-addon-unicode-graphemes/out-test/* \ ./addons/xterm-addon-web-links/out/* \ ./addons/xterm-addon-web-links/out-test/* \ - ./addons/xterm-addon-webgl/out/* \ - ./addons/xterm-addon-webgl/out-test/* + ./addons/addon-webgl/out/* \ + ./addons/addon-webgl/out-test/* - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -267,8 +267,8 @@ jobs: run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=core - name: Integration tests (xterm-addon-canvas) run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=xterm-addon-canvas - - name: Integration tests (xterm-addon-webgl) - run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=xterm-addon-webgl + - name: Integration tests (addon-webgl) + run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-webgl test-api: needs: build diff --git a/addons/xterm-addon-webgl/.gitignore b/addons/addon-webgl/.gitignore similarity index 100% rename from addons/xterm-addon-webgl/.gitignore rename to addons/addon-webgl/.gitignore diff --git a/addons/xterm-addon-webgl/.npmignore b/addons/addon-webgl/.npmignore similarity index 100% rename from addons/xterm-addon-webgl/.npmignore rename to addons/addon-webgl/.npmignore diff --git a/addons/xterm-addon-webgl/LICENSE b/addons/addon-webgl/LICENSE similarity index 100% rename from addons/xterm-addon-webgl/LICENSE rename to addons/addon-webgl/LICENSE diff --git a/addons/xterm-addon-webgl/README.md b/addons/addon-webgl/README.md similarity index 83% rename from addons/xterm-addon-webgl/README.md rename to addons/addon-webgl/README.md index 5dee6b622..f944a17eb 100644 --- a/addons/xterm-addon-webgl/README.md +++ b/addons/addon-webgl/README.md @@ -1,25 +1,25 @@ -## xterm-addon-webgl +## @xterm/addon-webgl An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+. ### Install ```bash -npm install --save xterm-addon-webgl +npm install --save @xterm/addon-webgl ``` ### Usage ```ts -import { Terminal } from 'xterm'; -import { WebglAddon } from 'xterm-addon-webgl'; +import { Terminal } from '@xterm/xterm'; +import { WebglAddon } from '@xterm/addon-webgl'; const terminal = new Terminal(); terminal.open(element); terminal.loadAddon(new WebglAddon()); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-webgl/typings/xterm-addon-webgl.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-webgl/typings/addon-webgl.d.ts) for more advanced usage. ### Handling Context Loss diff --git a/addons/xterm-addon-webgl/package.json b/addons/addon-webgl/package.json similarity index 80% rename from addons/xterm-addon-webgl/package.json rename to addons/addon-webgl/package.json index 1458effc5..f52f8b59b 100644 --- a/addons/xterm-addon-webgl/package.json +++ b/addons/addon-webgl/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-webgl", + "name": "@xterm/addon-webgl", "version": "0.16.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-webgl.js", - "types": "typings/xterm-addon-webgl.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-webgl", + "main": "lib/addon-webgl.js", + "types": "typings/addon-webgl.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-webgl", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-webgl/src/GlyphRenderer.ts b/addons/addon-webgl/src/GlyphRenderer.ts similarity index 100% rename from addons/xterm-addon-webgl/src/GlyphRenderer.ts rename to addons/addon-webgl/src/GlyphRenderer.ts diff --git a/addons/xterm-addon-webgl/src/RectangleRenderer.ts b/addons/addon-webgl/src/RectangleRenderer.ts similarity index 100% rename from addons/xterm-addon-webgl/src/RectangleRenderer.ts rename to addons/addon-webgl/src/RectangleRenderer.ts diff --git a/addons/xterm-addon-webgl/src/RenderModel.ts b/addons/addon-webgl/src/RenderModel.ts similarity index 100% rename from addons/xterm-addon-webgl/src/RenderModel.ts rename to addons/addon-webgl/src/RenderModel.ts diff --git a/addons/xterm-addon-webgl/src/TypedArray.test.ts b/addons/addon-webgl/src/TypedArray.test.ts similarity index 100% rename from addons/xterm-addon-webgl/src/TypedArray.test.ts rename to addons/addon-webgl/src/TypedArray.test.ts diff --git a/addons/xterm-addon-webgl/src/TypedArray.ts b/addons/addon-webgl/src/TypedArray.ts similarity index 100% rename from addons/xterm-addon-webgl/src/TypedArray.ts rename to addons/addon-webgl/src/TypedArray.ts diff --git a/addons/xterm-addon-webgl/src/Types.d.ts b/addons/addon-webgl/src/Types.d.ts similarity index 100% rename from addons/xterm-addon-webgl/src/Types.d.ts rename to addons/addon-webgl/src/Types.d.ts diff --git a/addons/xterm-addon-webgl/src/WebglAddon.ts b/addons/addon-webgl/src/WebglAddon.ts similarity index 100% rename from addons/xterm-addon-webgl/src/WebglAddon.ts rename to addons/addon-webgl/src/WebglAddon.ts diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.ts b/addons/addon-webgl/src/WebglRenderer.ts similarity index 100% rename from addons/xterm-addon-webgl/src/WebglRenderer.ts rename to addons/addon-webgl/src/WebglRenderer.ts diff --git a/addons/xterm-addon-webgl/src/WebglUtils.ts b/addons/addon-webgl/src/WebglUtils.ts similarity index 100% rename from addons/xterm-addon-webgl/src/WebglUtils.ts rename to addons/addon-webgl/src/WebglUtils.ts diff --git a/addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts b/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts similarity index 100% rename from addons/xterm-addon-webgl/src/renderLayer/BaseRenderLayer.ts rename to addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts diff --git a/addons/xterm-addon-webgl/src/renderLayer/LinkRenderLayer.ts b/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts similarity index 100% rename from addons/xterm-addon-webgl/src/renderLayer/LinkRenderLayer.ts rename to addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts diff --git a/addons/xterm-addon-webgl/src/renderLayer/Types.ts b/addons/addon-webgl/src/renderLayer/Types.ts similarity index 100% rename from addons/xterm-addon-webgl/src/renderLayer/Types.ts rename to addons/addon-webgl/src/renderLayer/Types.ts diff --git a/addons/xterm-addon-webgl/src/tsconfig.json b/addons/addon-webgl/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-webgl/src/tsconfig.json rename to addons/addon-webgl/src/tsconfig.json diff --git a/addons/xterm-addon-webgl/test/WebglRenderer.test.ts b/addons/addon-webgl/test/WebglRenderer.test.ts similarity index 100% rename from addons/xterm-addon-webgl/test/WebglRenderer.test.ts rename to addons/addon-webgl/test/WebglRenderer.test.ts diff --git a/addons/xterm-addon-webgl/test/playwright.config.ts b/addons/addon-webgl/test/playwright.config.ts similarity index 100% rename from addons/xterm-addon-webgl/test/playwright.config.ts rename to addons/addon-webgl/test/playwright.config.ts diff --git a/addons/xterm-addon-webgl/test/tsconfig.json b/addons/addon-webgl/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-webgl/test/tsconfig.json rename to addons/addon-webgl/test/tsconfig.json diff --git a/addons/xterm-addon-webgl/tsconfig.json b/addons/addon-webgl/tsconfig.json similarity index 100% rename from addons/xterm-addon-webgl/tsconfig.json rename to addons/addon-webgl/tsconfig.json diff --git a/addons/xterm-addon-webgl/typings/xterm-addon-webgl.d.ts b/addons/addon-webgl/typings/addon-webgl.d.ts similarity index 96% rename from addons/xterm-addon-webgl/typings/xterm-addon-webgl.d.ts rename to addons/addon-webgl/typings/addon-webgl.d.ts index 79108e0de..e9f459cfa 100644 --- a/addons/xterm-addon-webgl/typings/xterm-addon-webgl.d.ts +++ b/addons/addon-webgl/typings/addon-webgl.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon, IEvent } from 'xterm'; -declare module 'xterm-addon-webgl' { +declare module '@xterm/addon-webgl' { /** * An xterm.js addon that provides search functionality. */ diff --git a/addons/xterm-addon-webgl/webpack.config.js b/addons/addon-webgl/webpack.config.js similarity index 94% rename from addons/xterm-addon-webgl/webpack.config.js rename to addons/addon-webgl/webpack.config.js index 578b11026..f31ffd513 100644 --- a/addons/xterm-addon-webgl/webpack.config.js +++ b/addons/addon-webgl/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'WebglAddon'; -const mainFile = 'xterm-addon-webgl.js'; +const mainFile = 'addon-webgl.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/bin/publish.js b/bin/publish.js index e9c7c3e81..c9ce5e512 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -27,16 +27,16 @@ if (changedFiles.some(e => e.search(/^addons\//) === -1)) { // Publish addons if any files were changed inside of the addon const addonPackageDirs = [ - path.resolve(__dirname, '../addons/xterm-addon-attach'), - path.resolve(__dirname, '../addons/xterm-addon-canvas'), - path.resolve(__dirname, '../addons/xterm-addon-fit'), - // path.resolve(__dirname, '../addons/xterm-addon-image'), - path.resolve(__dirname, '../addons/xterm-addon-ligatures'), - path.resolve(__dirname, '../addons/xterm-addon-search'), - path.resolve(__dirname, '../addons/xterm-addon-serialize'), - path.resolve(__dirname, '../addons/xterm-addon-unicode11'), - path.resolve(__dirname, '../addons/xterm-addon-web-links'), - path.resolve(__dirname, '../addons/xterm-addon-webgl') + // path.resolve(__dirname, '../addons/xterm-addon-attach'), + // path.resolve(__dirname, '../addons/xterm-addon-canvas'), + // path.resolve(__dirname, '../addons/xterm-addon-fit'), + // // path.resolve(__dirname, '../addons/xterm-addon-image'), + // path.resolve(__dirname, '../addons/xterm-addon-ligatures'), + // path.resolve(__dirname, '../addons/xterm-addon-search'), + // path.resolve(__dirname, '../addons/xterm-addon-serialize'), + // path.resolve(__dirname, '../addons/xterm-addon-unicode11'), + // path.resolve(__dirname, '../addons/xterm-addon-web-links'), + path.resolve(__dirname, '../addons/addon-webgl') ]; console.log(`Checking if addons need to be published`); for (const p of addonPackageDirs) { @@ -70,7 +70,7 @@ function checkAndPublishPackage(packageDir) { fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2)); // Publish - const args = ['publish']; + const args = ['publish', '--access', 'public']; if (!isStableRelease) { args.push('--tag', 'beta'); } diff --git a/bin/test_playwright.js b/bin/test_playwright.js index 02c2a7632..12aa0cf03 100644 --- a/bin/test_playwright.js +++ b/bin/test_playwright.js @@ -20,7 +20,7 @@ while (argv.some(e => e.startsWith('--suite='))) { let configs = [ { name: 'core', path: 'out-test/playwright/playwright.config.js' }, { name: 'xterm-addon-canvas', path: 'addons/xterm-addon-canvas/out-test/playwright.config.js' }, - { name: 'xterm-addon-webgl', path: 'addons/xterm-addon-webgl/out-test/playwright.config.js' } + { name: 'addon-webgl', path: 'addons/addon-webgl/out-test/playwright.config.js' } ]; if (suiteFilter) { diff --git a/demo/client.ts b/demo/client.ts index a1145ab9a..a8f549b62 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -16,7 +16,7 @@ import { FitAddon } from '../addons/xterm-addon-fit/out/FitAddon'; import { SearchAddon, ISearchOptions } from '../addons/xterm-addon-search/out/SearchAddon'; import { SerializeAddon } from '../addons/xterm-addon-serialize/out/SerializeAddon'; import { WebLinksAddon } from '../addons/xterm-addon-web-links/out/WebLinksAddon'; -import { WebglAddon } from '../addons/xterm-addon-webgl/out/WebglAddon'; +import { WebglAddon } from '../addons/addon-webgl/out/WebglAddon'; import { Unicode11Addon } from '../addons/xterm-addon-unicode11/out/Unicode11Addon'; import { UnicodeGraphemesAddon } from '../addons/xterm-addon-unicode-graphemes/out/UnicodeGraphemesAddon'; import { LigaturesAddon } from '../addons/xterm-addon-ligatures/out/LigaturesAddon'; @@ -37,7 +37,7 @@ if ('WebAssembly' in window) { // import { SearchAddon, ISearchOptions } from 'xterm-addon-search'; // import { SerializeAddon } from 'xterm-addon-serialize'; // import { WebLinksAddon } from 'xterm-addon-web-links'; -// import { WebglAddon } from 'xterm-addon-webgl'; +// import { WebglAddon } from '@xterm/addon-webgl'; // import { Unicode11Addon } from 'xterm-addon-unicode11'; // import { UnicodeGraphemesAddon } from 'xterm-addon-unicode-graphemes'; // import { LigaturesAddon } from 'xterm-addon-ligatures'; diff --git a/demo/tsconfig.json b/demo/tsconfig.json index f728f20e9..cd15a36d4 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -12,7 +12,7 @@ "xterm-addon-search": ["../addons/xterm-addon-search"], "xterm-addon-serialize": ["../addons/xterm-addon-serialize"], "xterm-addon-web-links": ["../addons/xterm-addon-web-links"], - "xterm-addon-webgl": ["../addons/xterm-addon-webgl"] + "addon-webgl": ["../addons/addon-webgl"] } }, "include": [ diff --git a/package.json b/package.json index 70e0f4a96..d0510e5d1 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "xterm", + "name": "@xterm/xterm", "description": "Full xterm terminal, in your browser", "version": "5.3.0", "main": "lib/xterm.js", diff --git a/tsconfig.all.json b/tsconfig.all.json index 5d8af629c..e3fc22cf2 100644 --- a/tsconfig.all.json +++ b/tsconfig.all.json @@ -17,6 +17,6 @@ { "path": "./addons/xterm-addon-unicode11" }, { "path": "./addons/xterm-addon-unicode-graphemes" }, { "path": "./addons/xterm-addon-web-links" }, - { "path": "./addons/xterm-addon-webgl" } + { "path": "./addons/addon-webgl" } ] } From 905285efda573e70b82cf6d3405a30aadc3db192 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:48:33 -0700 Subject: [PATCH 18/46] Temporarily enable publishing in PRs --- .github/workflows/release.yml | 2 ++ typings/xterm-headless.d.ts | 2 +- typings/xterm.d.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e26e438f..21526c2c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,8 @@ on: # If a commit reaches master, assume it has passed CI via PR and publish # without running tests to save time to publish branches: [ "master" ] + pull_request: + branches: [ "master" ] jobs: release: diff --git a/typings/xterm-headless.d.ts b/typings/xterm-headless.d.ts index 99aa8237f..f8cef382f 100644 --- a/typings/xterm-headless.d.ts +++ b/typings/xterm-headless.d.ts @@ -7,7 +7,7 @@ * to be stable and consumed by external programs. */ -declare module 'xterm-headless' { +declare module '@xterm/headless' { /** * A string representing log level. */ diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index b8c114554..70b0c6d71 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -9,7 +9,7 @@ /// -declare module 'xterm' { +declare module '@xterm/xterm' { /** * A string or number representing text font weight. */ From bb9728ccd1685665b6ef60468ac4c6b81012e15c Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:50:08 -0700 Subject: [PATCH 19/46] from xterm -> from scoped --- README.md | 4 ++-- addons/addon-webgl/src/GlyphRenderer.ts | 2 +- addons/addon-webgl/src/RectangleRenderer.ts | 2 +- addons/addon-webgl/src/WebglAddon.ts | 2 +- addons/addon-webgl/src/WebglRenderer.ts | 2 +- addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts | 2 +- addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts | 2 +- addons/addon-webgl/src/renderLayer/Types.ts | 2 +- addons/addon-webgl/typings/addon-webgl.d.ts | 2 +- addons/xterm-addon-attach/README.md | 2 +- addons/xterm-addon-attach/src/AttachAddon.ts | 2 +- addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts | 2 +- addons/xterm-addon-canvas/README.md | 2 +- addons/xterm-addon-canvas/src/BaseRenderLayer.ts | 2 +- addons/xterm-addon-canvas/src/CanvasAddon.ts | 2 +- addons/xterm-addon-canvas/src/CanvasRenderer.ts | 2 +- addons/xterm-addon-canvas/src/CursorRenderLayer.ts | 2 +- addons/xterm-addon-canvas/src/LinkRenderLayer.ts | 2 +- addons/xterm-addon-canvas/src/SelectionRenderLayer.ts | 2 +- addons/xterm-addon-canvas/src/TextRenderLayer.ts | 2 +- addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts | 2 +- addons/xterm-addon-fit/README.md | 2 +- addons/xterm-addon-fit/src/FitAddon.ts | 2 +- addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts | 2 +- addons/xterm-addon-image/README.md | 2 +- addons/xterm-addon-image/src/ImageAddon.ts | 2 +- addons/xterm-addon-image/src/ImageRenderer.ts | 2 +- addons/xterm-addon-image/src/ImageStorage.ts | 2 +- addons/xterm-addon-image/src/Types.d.ts | 2 +- addons/xterm-addon-image/typings/xterm-addon-image.d.ts | 4 ++-- addons/xterm-addon-ligatures/README.md | 2 +- addons/xterm-addon-ligatures/src/LigaturesAddon.ts | 2 +- addons/xterm-addon-ligatures/src/index.ts | 2 +- .../xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts | 2 +- addons/xterm-addon-search/README.md | 2 +- addons/xterm-addon-search/src/SearchAddon.ts | 2 +- addons/xterm-addon-search/typings/xterm-addon-search.d.ts | 2 +- addons/xterm-addon-serialize/src/SerializeAddon.ts | 2 +- .../xterm-addon-serialize/typings/xterm-addon-serialize.d.ts | 2 +- addons/xterm-addon-unicode-graphemes/README.md | 2 +- .../src/UnicodeGraphemeProvider.ts | 2 +- .../src/UnicodeGraphemesAddon.ts | 2 +- .../typings/xterm-addon-unicode-graphemes.d.ts | 2 +- addons/xterm-addon-unicode11/README.md | 2 +- addons/xterm-addon-unicode11/src/Unicode11Addon.ts | 2 +- addons/xterm-addon-unicode11/src/UnicodeV11.ts | 2 +- .../xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts | 2 +- addons/xterm-addon-web-links/README.md | 2 +- addons/xterm-addon-web-links/src/WebLinkProvider.ts | 2 +- addons/xterm-addon-web-links/src/WebLinksAddon.ts | 2 +- .../xterm-addon-web-links/typings/xterm-addon-web-links.d.ts | 2 +- demo/client.ts | 2 +- src/browser/Terminal.ts | 2 +- src/browser/Terminal2.test.ts | 2 +- src/browser/TestUtils.test.ts | 2 +- src/browser/Types.d.ts | 2 +- src/browser/public/Terminal.ts | 2 +- src/browser/renderer/shared/CellColorResolver.ts | 2 +- src/browser/renderer/shared/CharAtlasCache.ts | 2 +- src/browser/renderer/shared/CharAtlasUtils.ts | 2 +- src/browser/renderer/shared/SelectionRenderModel.ts | 2 +- src/browser/renderer/shared/Types.d.ts | 2 +- src/common/TestUtils.test.ts | 2 +- src/common/Types.d.ts | 2 +- src/common/buffer/BufferRange.test.ts | 2 +- src/common/buffer/BufferRange.ts | 2 +- src/common/public/AddonManager.test.ts | 2 +- src/common/public/AddonManager.ts | 2 +- src/common/public/BufferApiView.ts | 2 +- src/common/public/BufferLineApiView.ts | 2 +- src/common/public/BufferNamespaceApi.ts | 2 +- src/common/public/ParserApi.ts | 2 +- src/common/public/UnicodeApi.ts | 2 +- src/common/services/DecorationService.ts | 2 +- src/common/services/Services.ts | 2 +- src/headless/tsconfig.json | 2 +- test/api/TestUtils.ts | 2 +- test/playwright/MouseTracking.test.ts | 2 +- test/playwright/Parser.test.ts | 2 +- test/playwright/SharedRendererTests.ts | 2 +- test/playwright/TestUtils.ts | 2 +- 81 files changed, 83 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 0abcd32cf..64dde4c1d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to t The recommended way to load xterm.js is via the ES6 module syntax: ```javascript -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; ``` ### Addons @@ -65,7 +65,7 @@ npm i -S xterm-addon-web-links Then import the addon, instantiate it and call `Terminal.loadAddon`: ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { WebLinksAddon } from 'xterm-addon-web-links'; const terminal = new Terminal(); diff --git a/addons/addon-webgl/src/GlyphRenderer.ts b/addons/addon-webgl/src/GlyphRenderer.ts index e0669102d..1fb0e18c5 100644 --- a/addons/addon-webgl/src/GlyphRenderer.ts +++ b/addons/addon-webgl/src/GlyphRenderer.ts @@ -8,7 +8,7 @@ import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas'; import { IRasterizedGlyph, IRenderDimensions, ITextureAtlas } from 'browser/renderer/shared/Types'; import { NULL_CELL_CODE } from 'common/buffer/Constants'; import { Disposable, toDisposable } from 'common/Lifecycle'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types'; import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils'; diff --git a/addons/addon-webgl/src/RectangleRenderer.ts b/addons/addon-webgl/src/RectangleRenderer.ts index 5e9c364eb..2a1f53928 100644 --- a/addons/addon-webgl/src/RectangleRenderer.ts +++ b/addons/addon-webgl/src/RectangleRenderer.ts @@ -10,7 +10,7 @@ import { ReadonlyColorSet } from 'browser/Types'; import { Attributes, FgFlags } from 'common/buffer/Constants'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { IColor } from 'common/Types'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { RENDER_MODEL_BG_OFFSET, RENDER_MODEL_FG_OFFSET, RENDER_MODEL_INDICIES_PER_CELL } from './RenderModel'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types'; import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils'; diff --git a/addons/addon-webgl/src/WebglAddon.ts b/addons/addon-webgl/src/WebglAddon.ts index 3e091f0b8..3e2925c56 100644 --- a/addons/addon-webgl/src/WebglAddon.ts +++ b/addons/addon-webgl/src/WebglAddon.ts @@ -9,7 +9,7 @@ import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { getSafariVersion, isSafari } from 'common/Platform'; import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services'; -import { ITerminalAddon, Terminal } from 'xterm'; +import { ITerminalAddon, Terminal } from '@xterm/xterm'; import { WebglRenderer } from './WebglRenderer'; import { setTraceLogger } from 'common/services/LogService'; diff --git a/addons/addon-webgl/src/WebglRenderer.ts b/addons/addon-webgl/src/WebglRenderer.ts index 517499845..9b7d56df5 100644 --- a/addons/addon-webgl/src/WebglRenderer.ts +++ b/addons/addon-webgl/src/WebglRenderer.ts @@ -19,7 +19,7 @@ import { AttributeData } from 'common/buffer/AttributeData'; import { CellData } from 'common/buffer/CellData'; import { Attributes, Content, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants'; import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { GlyphRenderer } from './GlyphRenderer'; import { RectangleRenderer } from './RectangleRenderer'; import { COMBINED_CHAR_BIT_MASK, RENDER_MODEL_BG_OFFSET, RENDER_MODEL_EXT_OFFSET, RENDER_MODEL_FG_OFFSET, RENDER_MODEL_INDICIES_PER_CELL, RenderModel } from './RenderModel'; diff --git a/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts b/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts index 11f96ed8c..93e0fcb1a 100644 --- a/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts +++ b/addons/addon-webgl/src/renderLayer/BaseRenderLayer.ts @@ -12,7 +12,7 @@ import { ICoreBrowserService, IThemeService } from 'browser/services/Services'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { CellData } from 'common/buffer/CellData'; import { IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { IRenderLayer } from './Types'; export abstract class BaseRenderLayer extends Disposable implements IRenderLayer { diff --git a/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts b/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts index aefc9f6ed..0aaf5e70e 100644 --- a/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts +++ b/addons/addon-webgl/src/renderLayer/LinkRenderLayer.ts @@ -9,7 +9,7 @@ import { IRenderDimensions } from 'browser/renderer/shared/Types'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services'; import { ILinkifier2, ILinkifierEvent } from 'browser/Types'; import { IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { BaseRenderLayer } from './BaseRenderLayer'; export class LinkRenderLayer extends BaseRenderLayer { diff --git a/addons/addon-webgl/src/renderLayer/Types.ts b/addons/addon-webgl/src/renderLayer/Types.ts index 3dbdfd9c5..feeceb145 100644 --- a/addons/addon-webgl/src/renderLayer/Types.ts +++ b/addons/addon-webgl/src/renderLayer/Types.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable, Terminal } from 'xterm'; +import { IDisposable, Terminal } from '@xterm/xterm'; import { IRenderDimensions } from 'browser/renderer/shared/Types'; export interface IRenderLayer extends IDisposable { diff --git a/addons/addon-webgl/typings/addon-webgl.d.ts b/addons/addon-webgl/typings/addon-webgl.d.ts index e9f459cfa..8c5604210 100644 --- a/addons/addon-webgl/typings/addon-webgl.d.ts +++ b/addons/addon-webgl/typings/addon-webgl.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon, IEvent } from 'xterm'; +import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm'; declare module '@xterm/addon-webgl' { /** diff --git a/addons/xterm-addon-attach/README.md b/addons/xterm-addon-attach/README.md index 67ebf17b0..a12c3c675 100644 --- a/addons/xterm-addon-attach/README.md +++ b/addons/xterm-addon-attach/README.md @@ -11,7 +11,7 @@ npm install --save xterm-addon-attach ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { AttachAddon } from 'xterm-addon-attach'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-attach/src/AttachAddon.ts b/addons/xterm-addon-attach/src/AttachAddon.ts index 7fd8df29a..756e03d9d 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.ts @@ -5,7 +5,7 @@ * Implements the attach method, that attaches the terminal to a WebSocket stream. */ -import { Terminal, IDisposable, ITerminalAddon } from 'xterm'; +import { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm'; interface IAttachOptions { bidirectional?: boolean; diff --git a/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts b/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts index 2956b9d90..862968256 100644 --- a/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts +++ b/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-attach' { export interface IAttachOptions { diff --git a/addons/xterm-addon-canvas/README.md b/addons/xterm-addon-canvas/README.md index bffac96ed..6d24c592d 100644 --- a/addons/xterm-addon-canvas/README.md +++ b/addons/xterm-addon-canvas/README.md @@ -13,7 +13,7 @@ npm install --save xterm-addon-canvas ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { CanvasAddon } from 'xterm-addon-canvas'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-canvas/src/BaseRenderLayer.ts b/addons/xterm-addon-canvas/src/BaseRenderLayer.ts index 62fe71a74..0e85901a5 100644 --- a/addons/xterm-addon-canvas/src/BaseRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/BaseRenderLayer.ts @@ -19,7 +19,7 @@ import { ICellData } from 'common/Types'; import { CellData } from 'common/buffer/CellData'; import { WHITESPACE_CELL_CODE } from 'common/buffer/Constants'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { IRenderLayer } from './Types'; export abstract class BaseRenderLayer extends Disposable implements IRenderLayer { diff --git a/addons/xterm-addon-canvas/src/CanvasAddon.ts b/addons/xterm-addon-canvas/src/CanvasAddon.ts index 91438a4c8..6cfa2d46d 100644 --- a/addons/xterm-addon-canvas/src/CanvasAddon.ts +++ b/addons/xterm-addon-canvas/src/CanvasAddon.ts @@ -9,7 +9,7 @@ import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { setTraceLogger } from 'common/services/LogService'; import { IBufferService, IDecorationService, ILogService } from 'common/services/Services'; -import { ITerminalAddon, Terminal } from 'xterm'; +import { ITerminalAddon, Terminal } from '@xterm/xterm'; import { CanvasRenderer } from './CanvasRenderer'; export class CanvasAddon extends Disposable implements ITerminalAddon { diff --git a/addons/xterm-addon-canvas/src/CanvasRenderer.ts b/addons/xterm-addon-canvas/src/CanvasRenderer.ts index cd05f9216..40b89546f 100644 --- a/addons/xterm-addon-canvas/src/CanvasRenderer.ts +++ b/addons/xterm-addon-canvas/src/CanvasRenderer.ts @@ -12,7 +12,7 @@ import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeS import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { CursorRenderLayer } from './CursorRenderLayer'; import { LinkRenderLayer } from './LinkRenderLayer'; import { SelectionRenderLayer } from './SelectionRenderLayer'; diff --git a/addons/xterm-addon-canvas/src/CursorRenderLayer.ts b/addons/xterm-addon-canvas/src/CursorRenderLayer.ts index c5174f865..adc1db189 100644 --- a/addons/xterm-addon-canvas/src/CursorRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/CursorRenderLayer.ts @@ -12,7 +12,7 @@ import { isFirefox } from 'common/Platform'; import { ICellData } from 'common/Types'; import { CellData } from 'common/buffer/CellData'; import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { BaseRenderLayer } from './BaseRenderLayer'; interface ICursorState { diff --git a/addons/xterm-addon-canvas/src/LinkRenderLayer.ts b/addons/xterm-addon-canvas/src/LinkRenderLayer.ts index 882f7d8c2..1cdf71c2f 100644 --- a/addons/xterm-addon-canvas/src/LinkRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/LinkRenderLayer.ts @@ -9,7 +9,7 @@ import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants'; import { IRenderDimensions } from 'browser/renderer/shared/Types'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { BaseRenderLayer } from './BaseRenderLayer'; export class LinkRenderLayer extends BaseRenderLayer { diff --git a/addons/xterm-addon-canvas/src/SelectionRenderLayer.ts b/addons/xterm-addon-canvas/src/SelectionRenderLayer.ts index 10950868f..01612a1d2 100644 --- a/addons/xterm-addon-canvas/src/SelectionRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/SelectionRenderLayer.ts @@ -7,7 +7,7 @@ import { IRenderDimensions } from 'browser/renderer/shared/Types'; import { BaseRenderLayer } from './BaseRenderLayer'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; interface ISelectionState { start?: [number, number]; diff --git a/addons/xterm-addon-canvas/src/TextRenderLayer.ts b/addons/xterm-addon-canvas/src/TextRenderLayer.ts index 46d052f30..43c33d64a 100644 --- a/addons/xterm-addon-canvas/src/TextRenderLayer.ts +++ b/addons/xterm-addon-canvas/src/TextRenderLayer.ts @@ -11,7 +11,7 @@ import { AttributeData } from 'common/buffer/AttributeData'; import { CellData } from 'common/buffer/CellData'; import { Content, NULL_CELL_CODE } from 'common/buffer/Constants'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { BaseRenderLayer } from './BaseRenderLayer'; import { GridCache } from './GridCache'; diff --git a/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts b/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts index c983825c2..9a444d27e 100644 --- a/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts +++ b/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon, IEvent } from 'xterm'; +import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm'; declare module 'xterm-addon-canvas' { /** diff --git a/addons/xterm-addon-fit/README.md b/addons/xterm-addon-fit/README.md index 321b2cf70..0b858fb4b 100644 --- a/addons/xterm-addon-fit/README.md +++ b/addons/xterm-addon-fit/README.md @@ -11,7 +11,7 @@ npm install --save xterm-addon-fit ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { FitAddon } from 'xterm-addon-fit'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-fit/src/FitAddon.ts b/addons/xterm-addon-fit/src/FitAddon.ts index f72454621..c634ea8f1 100644 --- a/addons/xterm-addon-fit/src/FitAddon.ts +++ b/addons/xterm-addon-fit/src/FitAddon.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; import { IRenderDimensions } from 'browser/renderer/shared/Types'; interface ITerminalDimensions { diff --git a/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts b/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts index 2d1b8f1df..605a7b1de 100644 --- a/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts +++ b/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-fit' { /** diff --git a/addons/xterm-addon-image/README.md b/addons/xterm-addon-image/README.md index 686df9b48..f9ccd637e 100644 --- a/addons/xterm-addon-image/README.md +++ b/addons/xterm-addon-image/README.md @@ -16,7 +16,7 @@ npm install --save xterm-addon-image ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { ImageAddon, IImageAddonOptions } from 'xterm-addon-image'; // customize as needed (showing addon defaults) diff --git a/addons/xterm-addon-image/src/ImageAddon.ts b/addons/xterm-addon-image/src/ImageAddon.ts index bb633e6b2..f02ec3117 100644 --- a/addons/xterm-addon-image/src/ImageAddon.ts +++ b/addons/xterm-addon-image/src/ImageAddon.ts @@ -4,7 +4,7 @@ */ import { IIPHandler } from './IIPHandler'; -import { ITerminalAddon, IDisposable } from 'xterm'; +import { ITerminalAddon, IDisposable } from '@xterm/xterm'; import { ImageRenderer } from './ImageRenderer'; import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage'; import { SixelHandler } from './SixelHandler'; diff --git a/addons/xterm-addon-image/src/ImageRenderer.ts b/addons/xterm-addon-image/src/ImageRenderer.ts index 9b528efed..214a2e6bd 100644 --- a/addons/xterm-addon-image/src/ImageRenderer.ts +++ b/addons/xterm-addon-image/src/ImageRenderer.ts @@ -4,7 +4,7 @@ */ import { toRGBA8888 } from 'sixel/lib/Colors'; -import { IDisposable } from 'xterm'; +import { IDisposable } from '@xterm/xterm'; import { ICellSize, ITerminalExt, IImageSpec, IRenderDimensions, IRenderService } from './Types'; import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; diff --git a/addons/xterm-addon-image/src/ImageStorage.ts b/addons/xterm-addon-image/src/ImageStorage.ts index 97eef8521..8b3891ee0 100644 --- a/addons/xterm-addon-image/src/ImageStorage.ts +++ b/addons/xterm-addon-image/src/ImageStorage.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable } from 'xterm'; +import { IDisposable } from '@xterm/xterm'; import { ImageRenderer } from './ImageRenderer'; import { ITerminalExt, IExtendedAttrsImage, IImageAddonOptions, IImageSpec, IBufferLineExt, BgFlags, Cell, Content, ICellSize, ExtFlags, Attributes, UnderlineStyle } from './Types'; diff --git a/addons/xterm-addon-image/src/Types.d.ts b/addons/xterm-addon-image/src/Types.d.ts index 62f4481ae..60de0f3d2 100644 --- a/addons/xterm-addon-image/src/Types.d.ts +++ b/addons/xterm-addon-image/src/Types.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable, IMarker, Terminal } from 'xterm'; +import { IDisposable, IMarker, Terminal } from '@xterm/xterm'; // private imports from base repo we build against import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants'; diff --git a/addons/xterm-addon-image/typings/xterm-addon-image.d.ts b/addons/xterm-addon-image/typings/xterm-addon-image.d.ts index 94dc6f658..608eb9fdb 100644 --- a/addons/xterm-addon-image/typings/xterm-addon-image.d.ts +++ b/addons/xterm-addon-image/typings/xterm-addon-image.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-image' { export interface IImageAddonOptions { @@ -37,7 +37,7 @@ declare module 'xterm-addon-image' { * * Note: `storageLimit` bytes are calculated from images by multiplying the pixels with 4 * (4 channels with one byte, images are stored as RGBA8888). - * + * * Default is 2^16 (4096 x 4096 pixels). */ pixelLimit?: number; diff --git a/addons/xterm-addon-ligatures/README.md b/addons/xterm-addon-ligatures/README.md index fad2a7efa..1c14976b0 100644 --- a/addons/xterm-addon-ligatures/README.md +++ b/addons/xterm-addon-ligatures/README.md @@ -16,7 +16,7 @@ npm install --save xterm-addon-ligatures ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { LigaturesAddon } from 'xterm-addon-ligatures'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-ligatures/src/LigaturesAddon.ts b/addons/xterm-addon-ligatures/src/LigaturesAddon.ts index c4586b389..27e8fcf36 100644 --- a/addons/xterm-addon-ligatures/src/LigaturesAddon.ts +++ b/addons/xterm-addon-ligatures/src/LigaturesAddon.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { enableLigatures } from '.'; import { ILigatureOptions } from './Types'; diff --git a/addons/xterm-addon-ligatures/src/index.ts b/addons/xterm-addon-ligatures/src/index.ts index 826756265..bd8ff215f 100644 --- a/addons/xterm-addon-ligatures/src/index.ts +++ b/addons/xterm-addon-ligatures/src/index.ts @@ -3,7 +3,7 @@ * @license MIT */ -import type { Terminal } from 'xterm'; +import type { Terminal } from '@xterm/xterm'; import { Font } from 'font-ligatures'; import load from './font'; diff --git a/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts b/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts index 4d8fbdf0e..2b967a331 100644 --- a/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts +++ b/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts @@ -8,7 +8,7 @@ * which is intended to be stable and consumed by external programs. */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-ligatures' { /** diff --git a/addons/xterm-addon-search/README.md b/addons/xterm-addon-search/README.md index 91bcc34b6..51ce20b4b 100644 --- a/addons/xterm-addon-search/README.md +++ b/addons/xterm-addon-search/README.md @@ -11,7 +11,7 @@ npm install --save xterm-addon-search ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { SearchAddon } from 'xterm-addon-search'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index c176a6f25..2e83b0ad9 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, IDisposable, ITerminalAddon, IDecoration } from 'xterm'; +import { Terminal, IDisposable, ITerminalAddon, IDecoration } from '@xterm/xterm'; import { EventEmitter } from 'common/EventEmitter'; import { Disposable, toDisposable, disposeArray, MutableDisposable } from 'common/Lifecycle'; diff --git a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts index 3a3b7c89b..c3774bf51 100644 --- a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts +++ b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon, IEvent } from 'xterm'; +import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm'; declare module 'xterm-addon-search' { /** diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.ts b/addons/xterm-addon-serialize/src/SerializeAddon.ts index 7a2db0893..bb62779bb 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.ts @@ -7,7 +7,7 @@ import { DEFAULT_ANSI_COLORS } from 'browser/services/ThemeService'; import { IAttributeData, IColor } from 'common/Types'; -import { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from 'xterm'; +import { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm'; function constrain(value: number, low: number, high: number): number { return Math.max(low, Math.min(value, high)); diff --git a/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts b/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts index 4cb6283db..a675cd14b 100644 --- a/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts +++ b/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-serialize' { /** diff --git a/addons/xterm-addon-unicode-graphemes/README.md b/addons/xterm-addon-unicode-graphemes/README.md index 5b8679f8e..1f03e4e9b 100644 --- a/addons/xterm-addon-unicode-graphemes/README.md +++ b/addons/xterm-addon-unicode-graphemes/README.md @@ -13,7 +13,7 @@ This addon is not yet published to npm ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { UnicodeGraphemesAddon } from 'xterm-addon-unicode-graphemes'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts index 39fbec840..3d5717a0f 100644 --- a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts +++ b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IUnicodeVersionProvider } from 'xterm'; +import { IUnicodeVersionProvider } from '@xterm/xterm'; import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services'; import { UnicodeService } from 'common/services/UnicodeService'; import * as UC from './third-party/UnicodeProperties'; diff --git a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts index 80290edfd..714f223b2 100644 --- a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts +++ b/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts @@ -5,7 +5,7 @@ * UnicodeVersionProvider for V15 with grapeme cluster handleing. */ -import { Terminal, ITerminalAddon, IUnicodeHandling } from 'xterm'; +import { Terminal, ITerminalAddon, IUnicodeHandling } from '@xterm/xterm'; import { UnicodeGraphemeProvider } from './UnicodeGraphemeProvider'; diff --git a/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts b/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts index 3ab25aa00..3a6a95905 100644 --- a/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts +++ b/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-unicode-graphemes' { export class UnicodeGraphemesAddon implements ITerminalAddon { diff --git a/addons/xterm-addon-unicode11/README.md b/addons/xterm-addon-unicode11/README.md index ec01203e9..52c2e0d91 100644 --- a/addons/xterm-addon-unicode11/README.md +++ b/addons/xterm-addon-unicode11/README.md @@ -11,7 +11,7 @@ npm install --save xterm-addon-unicode11 ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { Unicode11Addon } from 'xterm-addon-unicode11'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.ts index d4ddf77ee..03672fbff 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.ts @@ -5,7 +5,7 @@ * UnicodeVersionProvider for V11. */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; import { UnicodeV11 } from './UnicodeV11'; diff --git a/addons/xterm-addon-unicode11/src/UnicodeV11.ts b/addons/xterm-addon-unicode11/src/UnicodeV11.ts index c1ef08c16..79568960a 100644 --- a/addons/xterm-addon-unicode11/src/UnicodeV11.ts +++ b/addons/xterm-addon-unicode11/src/UnicodeV11.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IUnicodeVersionProvider } from 'xterm'; +import { IUnicodeVersionProvider } from '@xterm/xterm'; import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services'; import { UnicodeService } from 'common/services/UnicodeService'; diff --git a/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts b/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts index 1d0dce1b1..2525dc23b 100644 --- a/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts +++ b/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon } from 'xterm'; +import { Terminal, ITerminalAddon } from '@xterm/xterm'; declare module 'xterm-addon-unicode11' { export class Unicode11Addon implements ITerminalAddon { diff --git a/addons/xterm-addon-web-links/README.md b/addons/xterm-addon-web-links/README.md index e53f4edf7..323c1f01d 100644 --- a/addons/xterm-addon-web-links/README.md +++ b/addons/xterm-addon-web-links/README.md @@ -11,7 +11,7 @@ npm install --save xterm-addon-web-links ### Usage ```ts -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; import { WebLinksAddon } from 'xterm-addon-web-links'; const terminal = new Terminal(); diff --git a/addons/xterm-addon-web-links/src/WebLinkProvider.ts b/addons/xterm-addon-web-links/src/WebLinkProvider.ts index 1c9486f5b..25dd983c9 100644 --- a/addons/xterm-addon-web-links/src/WebLinkProvider.ts +++ b/addons/xterm-addon-web-links/src/WebLinkProvider.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { ILinkProvider, ILink, Terminal, IViewportRange, IBufferLine } from 'xterm'; +import { ILinkProvider, ILink, Terminal, IViewportRange, IBufferLine } from '@xterm/xterm'; export interface ILinkProviderOptions { hover?(event: MouseEvent, text: string, location: IViewportRange): void; diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.ts index 5c956cec3..701a658e9 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, ITerminalAddon, IDisposable } from 'xterm'; +import { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm'; import { ILinkProviderOptions, WebLinkProvider } from './WebLinkProvider'; // consider everthing starting with http:// or https:// diff --git a/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts b/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts index dc69d7324..11e6ffb28 100644 --- a/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts +++ b/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts @@ -4,7 +4,7 @@ */ -import { Terminal, ITerminalAddon, IViewportRange } from 'xterm'; +import { Terminal, ITerminalAddon, IViewportRange } from '@xterm/xterm'; declare module 'xterm-addon-web-links' { /** diff --git a/demo/client.ts b/demo/client.ts index a8f549b62..df169ffe9 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -44,7 +44,7 @@ if ('WebAssembly' in window) { // Pulling in the module's types relies on the above, it's looks a // little weird here as we're importing "this" module -import { Terminal as TerminalType, ITerminalOptions } from 'xterm'; +import { Terminal as TerminalType, ITerminalOptions } from '@xterm/xterm'; export interface IWindowWithTerminal extends Window { term: TerminalType; diff --git a/src/browser/Terminal.ts b/src/browser/Terminal.ts index b64c3b1d9..0413b9062 100644 --- a/src/browser/Terminal.ts +++ b/src/browser/Terminal.ts @@ -54,7 +54,7 @@ import { evaluateKeyboardEvent } from 'common/input/Keyboard'; import { toRgbString } from 'common/input/XParseColor'; import { DecorationService } from 'common/services/DecorationService'; import { IDecorationService } from 'common/services/Services'; -import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from 'xterm'; +import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from '@xterm/xterm'; import { WindowsOptionsReportType } from '../common/InputHandler'; import { AccessibilityManager } from './AccessibilityManager'; diff --git a/src/browser/Terminal2.test.ts b/src/browser/Terminal2.test.ts index 4965e8f36..abbb42d3c 100644 --- a/src/browser/Terminal2.test.ts +++ b/src/browser/Terminal2.test.ts @@ -9,7 +9,7 @@ import * as os from 'os'; import * as fs from 'fs'; import * as pty from 'node-pty'; import { Terminal } from 'browser/Terminal'; -import { IDisposable } from 'xterm'; +import { IDisposable } from '@xterm/xterm'; // all test files expect terminal in 80x25 const COLS = 80; diff --git a/src/browser/TestUtils.test.ts b/src/browser/TestUtils.test.ts index d557cd989..7e43017a0 100644 --- a/src/browser/TestUtils.test.ts +++ b/src/browser/TestUtils.test.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration } from 'xterm'; +import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration } from '@xterm/xterm'; import { IEvent, EventEmitter } from 'common/EventEmitter'; import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services'; import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types'; diff --git a/src/browser/Types.d.ts b/src/browser/Types.d.ts index f2b5e220f..b1f31b205 100644 --- a/src/browser/Types.d.ts +++ b/src/browser/Types.d.ts @@ -6,7 +6,7 @@ import { IEvent } from 'common/EventEmitter'; import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types'; import { IBuffer } from 'common/buffer/Types'; -import { IDisposable, Terminal as ITerminalApi } from 'xterm'; +import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm'; import { IMouseService, IRenderService } from './services/Services'; /** diff --git a/src/browser/public/Terminal.ts b/src/browser/public/Terminal.ts index 2c75d7b80..6f009f74f 100644 --- a/src/browser/public/Terminal.ts +++ b/src/browser/public/Terminal.ts @@ -13,7 +13,7 @@ import { AddonManager } from 'common/public/AddonManager'; import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi'; import { ParserApi } from 'common/public/ParserApi'; import { UnicodeApi } from 'common/public/UnicodeApi'; -import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from 'xterm'; +import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm'; /** * The set of options that only have an effect when set in the Terminal constructor. diff --git a/src/browser/renderer/shared/CellColorResolver.ts b/src/browser/renderer/shared/CellColorResolver.ts index 66e6a344e..72a9fa303 100644 --- a/src/browser/renderer/shared/CellColorResolver.ts +++ b/src/browser/renderer/shared/CellColorResolver.ts @@ -4,7 +4,7 @@ import { ReadonlyColorSet } from 'browser/Types'; import { Attributes, BgFlags, FgFlags } from 'common/buffer/Constants'; import { IDecorationService } from 'common/services/Services'; import { ICellData } from 'common/Types'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; // Work variables to avoid garbage collection let $fg = 0; diff --git a/src/browser/renderer/shared/CharAtlasCache.ts b/src/browser/renderer/shared/CharAtlasCache.ts index 673439129..0a8714832 100644 --- a/src/browser/renderer/shared/CharAtlasCache.ts +++ b/src/browser/renderer/shared/CharAtlasCache.ts @@ -4,7 +4,7 @@ */ import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas'; -import { ITerminalOptions, Terminal } from 'xterm'; +import { ITerminalOptions, Terminal } from '@xterm/xterm'; import { ITerminal, ReadonlyColorSet } from 'browser/Types'; import { ICharAtlasConfig, ITextureAtlas } from 'browser/renderer/shared/Types'; import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils'; diff --git a/src/browser/renderer/shared/CharAtlasUtils.ts b/src/browser/renderer/shared/CharAtlasUtils.ts index 955bd4e6e..f8fe9104f 100644 --- a/src/browser/renderer/shared/CharAtlasUtils.ts +++ b/src/browser/renderer/shared/CharAtlasUtils.ts @@ -5,7 +5,7 @@ import { ICharAtlasConfig } from './Types'; import { Attributes } from 'common/buffer/Constants'; -import { ITerminalOptions } from 'xterm'; +import { ITerminalOptions } from '@xterm/xterm'; import { IColorSet, ReadonlyColorSet } from 'browser/Types'; import { NULL_COLOR } from 'common/Color'; diff --git a/src/browser/renderer/shared/SelectionRenderModel.ts b/src/browser/renderer/shared/SelectionRenderModel.ts index db3757788..1568ad8b9 100644 --- a/src/browser/renderer/shared/SelectionRenderModel.ts +++ b/src/browser/renderer/shared/SelectionRenderModel.ts @@ -4,7 +4,7 @@ */ import { ISelectionRenderModel } from 'browser/renderer/shared/Types'; -import { Terminal } from 'xterm'; +import { Terminal } from '@xterm/xterm'; class SelectionRenderModel implements ISelectionRenderModel { public hasSelection!: boolean; diff --git a/src/browser/renderer/shared/Types.d.ts b/src/browser/renderer/shared/Types.d.ts index a7e55e72c..029ac88aa 100644 --- a/src/browser/renderer/shared/Types.d.ts +++ b/src/browser/renderer/shared/Types.d.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { FontWeight, Terminal } from 'xterm'; +import { FontWeight, Terminal } from '@xterm/xterm'; import { IColorSet } from 'browser/Types'; import { IDisposable } from 'common/Types'; import { IEvent } from 'common/EventEmitter'; diff --git a/src/common/TestUtils.test.ts b/src/common/TestUtils.test.ts index 8e57664e9..39e13fbac 100644 --- a/src/common/TestUtils.test.ts +++ b/src/common/TestUtils.test.ts @@ -12,7 +12,7 @@ import { IBufferSet, IBuffer } from 'common/buffer/Types'; import { BufferSet } from 'common/buffer/BufferSet'; import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable } from 'common/Types'; import { UnicodeV6 } from 'common/input/UnicodeV6'; -import { IDecorationOptions, IDecoration } from 'xterm'; +import { IDecorationOptions, IDecoration } from '@xterm/xterm'; export class MockBufferService implements IBufferService { public serviceBrand: any; diff --git a/src/common/Types.d.ts b/src/common/Types.d.ts index fc8fdf4e6..14dee9721 100644 --- a/src/common/Types.d.ts +++ b/src/common/Types.d.ts @@ -9,7 +9,7 @@ import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint- import { IBufferSet } from 'common/buffer/Types'; import { IParams } from 'common/parser/Types'; import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services'; -import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from 'xterm'; +import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm'; export interface ICoreTerminal { coreMouseService: ICoreMouseService; diff --git a/src/common/buffer/BufferRange.test.ts b/src/common/buffer/BufferRange.test.ts index 69aacd994..15d1b8317 100644 --- a/src/common/buffer/BufferRange.test.ts +++ b/src/common/buffer/BufferRange.test.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { getRangeLength } from 'common/buffer/BufferRange'; -import { IBufferRange } from 'xterm'; +import { IBufferRange } from '@xterm/xterm'; describe('BufferRange', () => { describe('getRangeLength', () => { diff --git a/src/common/buffer/BufferRange.ts b/src/common/buffer/BufferRange.ts index a49cf4811..aa7ee4050 100644 --- a/src/common/buffer/BufferRange.ts +++ b/src/common/buffer/BufferRange.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IBufferRange } from 'xterm'; +import { IBufferRange } from '@xterm/xterm'; export function getRangeLength(range: IBufferRange, bufferCols: number): number { if (range.start.y > range.end.y) { diff --git a/src/common/public/AddonManager.test.ts b/src/common/public/AddonManager.test.ts index e947976ac..239952eec 100644 --- a/src/common/public/AddonManager.test.ts +++ b/src/common/public/AddonManager.test.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { AddonManager, ILoadedAddon } from './AddonManager'; -import { ITerminalAddon } from 'xterm'; +import { ITerminalAddon } from '@xterm/xterm'; class TestAddonManager extends AddonManager { public get addons(): ILoadedAddon[] { diff --git a/src/common/public/AddonManager.ts b/src/common/public/AddonManager.ts index af04a2696..9a36e2a0e 100644 --- a/src/common/public/AddonManager.ts +++ b/src/common/public/AddonManager.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { ITerminalAddon, IDisposable, Terminal } from 'xterm'; +import { ITerminalAddon, IDisposable, Terminal } from '@xterm/xterm'; export interface ILoadedAddon { instance: ITerminalAddon; diff --git a/src/common/public/BufferApiView.ts b/src/common/public/BufferApiView.ts index ca9ef2d8f..834cedbee 100644 --- a/src/common/public/BufferApiView.ts +++ b/src/common/public/BufferApiView.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from 'xterm'; +import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm'; import { IBuffer } from 'common/buffer/Types'; import { BufferLineApiView } from 'common/public/BufferLineApiView'; import { CellData } from 'common/buffer/CellData'; diff --git a/src/common/public/BufferLineApiView.ts b/src/common/public/BufferLineApiView.ts index 60375015d..560dd0bfd 100644 --- a/src/common/public/BufferLineApiView.ts +++ b/src/common/public/BufferLineApiView.ts @@ -5,7 +5,7 @@ import { CellData } from 'common/buffer/CellData'; import { IBufferLine, ICellData } from 'common/Types'; -import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from 'xterm'; +import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm'; export class BufferLineApiView implements IBufferLineApi { constructor(private _line: IBufferLine) { } diff --git a/src/common/public/BufferNamespaceApi.ts b/src/common/public/BufferNamespaceApi.ts index aeaa4ac84..cef0ed164 100644 --- a/src/common/public/BufferNamespaceApi.ts +++ b/src/common/public/BufferNamespaceApi.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from 'xterm'; +import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm'; import { BufferApiView } from 'common/public/BufferApiView'; import { EventEmitter } from 'common/EventEmitter'; import { ICoreTerminal } from 'common/Types'; diff --git a/src/common/public/ParserApi.ts b/src/common/public/ParserApi.ts index 67df4be53..afcc01beb 100644 --- a/src/common/public/ParserApi.ts +++ b/src/common/public/ParserApi.ts @@ -4,7 +4,7 @@ */ import { IParams } from 'common/parser/Types'; -import { IDisposable, IFunctionIdentifier, IParser } from 'xterm'; +import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm'; import { ICoreTerminal } from 'common/Types'; export class ParserApi implements IParser { diff --git a/src/common/public/UnicodeApi.ts b/src/common/public/UnicodeApi.ts index 8a669a052..ec9bd1f77 100644 --- a/src/common/public/UnicodeApi.ts +++ b/src/common/public/UnicodeApi.ts @@ -4,7 +4,7 @@ */ import { ICoreTerminal } from 'common/Types'; -import { IUnicodeHandling, IUnicodeVersionProvider } from 'xterm'; +import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm'; export class UnicodeApi implements IUnicodeHandling { constructor(private _core: ICoreTerminal) { } diff --git a/src/common/services/DecorationService.ts b/src/common/services/DecorationService.ts index 36faa5094..da7591527 100644 --- a/src/common/services/DecorationService.ts +++ b/src/common/services/DecorationService.ts @@ -9,7 +9,7 @@ import { Disposable, toDisposable } from 'common/Lifecycle'; import { IDecorationService, IInternalDecoration } from 'common/services/Services'; import { SortedList } from 'common/SortedList'; import { IColor } from 'common/Types'; -import { IDecoration, IDecorationOptions, IMarker } from 'xterm'; +import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm'; // Work variables to avoid garbage collection let $xmin = 0; diff --git a/src/common/services/Services.ts b/src/common/services/Services.ts index 6ac73e37a..304e8cbb4 100644 --- a/src/common/services/Services.ts +++ b/src/common/services/Services.ts @@ -7,7 +7,7 @@ import { IEvent, IEventEmitter } from 'common/EventEmitter'; import { IBuffer, IBufferSet } from 'common/buffer/Types'; import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColor, CursorStyle, CursorInactiveStyle, IOscLinkData } from 'common/Types'; import { createDecorator } from 'common/services/ServiceRegistry'; -import { IDecorationOptions, IDecoration, ILinkHandler, IWindowsPty, ILogger } from 'xterm'; +import { IDecorationOptions, IDecoration, ILinkHandler, IWindowsPty, ILogger } from '@xterm/xterm'; export const IBufferService = createDecorator('BufferService'); export interface IBufferService { diff --git a/src/headless/tsconfig.json b/src/headless/tsconfig.json index b579af97c..e48c4fd5b 100644 --- a/src/headless/tsconfig.json +++ b/src/headless/tsconfig.json @@ -17,7 +17,7 @@ }, "include": [ "./**/*", - "../../typings/xterm.d.ts", // common/Types.d.ts imports from 'xterm' + "../../typings/xterm.d.ts", // common/Types.d.ts imports from '@xterm/xterm' "../../typings/xterm-headless.d.ts" ], "references": [ diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 288a3c071..9ebf67b6a 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -5,7 +5,7 @@ import * as playwright from '@playwright/test'; import deepEqual = require('deep-equal'); -import { ITerminalInitOnlyOptions, ITerminalOptions } from 'xterm'; +import { ITerminalInitOnlyOptions, ITerminalOptions } from '@xterm/xterm'; import { deepStrictEqual } from 'assert'; export async function pollFor(page: playwright.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise, maxDuration?: number): Promise { diff --git a/test/playwright/MouseTracking.test.ts b/test/playwright/MouseTracking.test.ts index dbce55cde..1cefd7cd1 100644 --- a/test/playwright/MouseTracking.test.ts +++ b/test/playwright/MouseTracking.test.ts @@ -4,7 +4,7 @@ */ import { test } from '@playwright/test'; import { deepStrictEqual, ok, strictEqual } from 'assert'; -import type { IDisposable } from 'xterm'; +import type { IDisposable } from '@xterm/xterm'; import { createTestContext, ITestContext, openTerminal, pollFor } from './TestUtils'; let ctx: ITestContext; diff --git a/test/playwright/Parser.test.ts b/test/playwright/Parser.test.ts index 42406270b..b793b00ee 100644 --- a/test/playwright/Parser.test.ts +++ b/test/playwright/Parser.test.ts @@ -4,7 +4,7 @@ */ import { test } from '@playwright/test'; import { deepStrictEqual, ok, strictEqual } from 'assert'; -import type { IDisposable } from 'xterm'; +import type { IDisposable } from '@xterm/xterm'; import { createTestContext, ITestContext, openTerminal, pollFor } from './TestUtils'; let ctx: ITestContext; diff --git a/test/playwright/SharedRendererTests.ts b/test/playwright/SharedRendererTests.ts index eaa54d129..377be1631 100644 --- a/test/playwright/SharedRendererTests.ts +++ b/test/playwright/SharedRendererTests.ts @@ -5,7 +5,7 @@ import { IImage32, decodePng } from '@lunapaint/png-codec'; import { LocatorScreenshotOptions, test } from '@playwright/test'; -import { ITheme } from 'xterm'; +import { ITheme } from '@xterm/xterm'; import { ITestContext, MaybeAsync, openTerminal, pollFor, pollForApproximate } from './TestUtils'; export interface ISharedRendererTestContext { diff --git a/test/playwright/TestUtils.ts b/test/playwright/TestUtils.ts index 0a51757fa..3e925f79c 100644 --- a/test/playwright/TestUtils.ts +++ b/test/playwright/TestUtils.ts @@ -10,7 +10,7 @@ import type { IRenderService } from 'browser/services/Services'; import type { ICoreTerminal, IMarker } from 'common/Types'; import * as playwright from '@playwright/test'; import { PageFunction } from 'playwright-core/types/structs'; -import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from 'xterm'; +import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from '@xterm/xterm'; import { EventEmitter } from '../../out/common/EventEmitter'; export interface ITestContext { From efbcd41fab983c4a19c44d913288d00c68d75d9c Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:50:48 -0700 Subject: [PATCH 20/46] from xterm-headless -> from scoped --- headless/README.md | 2 +- src/headless/public/Terminal.test.ts | 2 +- src/headless/public/Terminal.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/headless/README.md b/headless/README.md index 1d2d61568..205fd79c5 100644 --- a/headless/README.md +++ b/headless/README.md @@ -15,7 +15,7 @@ npm install xterm-headless Then import as you would a regular node package. The recommended way to load `xterm-headless` is with TypeScript and the ES6 module syntax: ```javascript -import { Terminal } from 'xterm-headless'; +import { Terminal } from '@xterm/headless'; ``` ## API diff --git a/src/headless/public/Terminal.test.ts b/src/headless/public/Terminal.test.ts index f869a991d..2175c6684 100644 --- a/src/headless/public/Terminal.test.ts +++ b/src/headless/public/Terminal.test.ts @@ -5,7 +5,7 @@ import { deepStrictEqual, strictEqual, throws } from 'assert'; import { Terminal } from 'headless/public/Terminal'; -import { ITerminalOptions } from 'xterm-headless'; +import { ITerminalOptions } from '@xterm/headless'; let term: Terminal; diff --git a/src/headless/public/Terminal.ts b/src/headless/public/Terminal.ts index b018d37ca..df202660f 100644 --- a/src/headless/public/Terminal.ts +++ b/src/headless/public/Terminal.ts @@ -7,7 +7,7 @@ import { IEvent } from 'common/EventEmitter'; import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi'; import { ParserApi } from 'common/public/ParserApi'; import { UnicodeApi } from 'common/public/UnicodeApi'; -import { IBufferNamespace as IBufferNamespaceApi, IMarker, IModes, IParser, ITerminalAddon, ITerminalInitOnlyOptions, IUnicodeHandling, Terminal as ITerminalApi } from 'xterm-headless'; +import { IBufferNamespace as IBufferNamespaceApi, IMarker, IModes, IParser, ITerminalAddon, ITerminalInitOnlyOptions, IUnicodeHandling, Terminal as ITerminalApi } from '@xterm/headless'; import { Terminal as TerminalCore } from 'headless/Terminal'; import { AddonManager } from 'common/public/AddonManager'; import { ITerminalOptions } from 'common/Types'; From cef869a206e9c0c45e053d2614d0fda0d153a209 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:55:21 -0700 Subject: [PATCH 21/46] Force beta build for now --- bin/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index c9ce5e512..810ae02ad 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -57,7 +57,7 @@ function checkAndPublishPackage(packageDir) { // Determine if this is a stable or beta release const publishedVersions = getPublishedVersions(packageJson); - const isStableRelease = !publishedVersions.includes(packageJson.version); + const isStableRelease = false; // !publishedVersions.includes(packageJson.version); // Get the next version let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson); From 8c6d16486da335e06f491d389b084f3c9342207b Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 06:57:44 -0700 Subject: [PATCH 22/46] Don't fetch beta versions --- bin/publish.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 810ae02ad..0ad738e20 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -56,7 +56,7 @@ function checkAndPublishPackage(packageDir) { const packageJson = require(path.join(packageDir, 'package.json')); // Determine if this is a stable or beta release - const publishedVersions = getPublishedVersions(packageJson); + // const publishedVersions = getPublishedVersions(packageJson); const isStableRelease = false; // !publishedVersions.includes(packageJson.version); // Get the next version @@ -119,7 +119,7 @@ function getPublishedVersions(packageJson, version, tag) { if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } - return versionsJson; + return versionsJson ?? []; } function getChangedFilesInCommit(commit) { From 9db2178d0577118f371862047d3b949640532b09 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:00:23 -0700 Subject: [PATCH 23/46] Return [] when no versions are published --- bin/publish.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index 0ad738e20..660d66ce4 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -116,10 +116,13 @@ function getNextBetaVersion(packageJson) { function getPublishedVersions(packageJson, version, tag) { const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']); const versionsJson = JSON.parse(versionsProcess.stdout); + if (!versions || versions.length === 0) { + return []; + } if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } - return versionsJson ?? []; + return versionsJson; } function getChangedFilesInCommit(commit) { From 5196ac5c8ff2ee3cc6c388f6736538c7fa1094df Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:02:14 -0700 Subject: [PATCH 24/46] Fix variable name --- bin/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index 660d66ce4..74986b95b 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -116,7 +116,7 @@ function getNextBetaVersion(packageJson) { function getPublishedVersions(packageJson, version, tag) { const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']); const versionsJson = JSON.parse(versionsProcess.stdout); - if (!versions || versions.length === 0) { + if (!versionsJson || versionsJson.length === 0) { return []; } if (tag) { From 2fb9702a3a51fe45270310b04b358a786c94ed13 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:14:19 -0700 Subject: [PATCH 25/46] Force dry run temporarily --- .github/workflows/release.yml | 2 +- bin/publish.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21526c2c7..e6077a4e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,4 +29,4 @@ jobs: - name: Publish to npm env: NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: node ./bin/publish.js + run: node ./bin/publish.js --dry diff --git a/bin/publish.js b/bin/publish.js index 74986b95b..1b520b0f7 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -41,10 +41,10 @@ const addonPackageDirs = [ console.log(`Checking if addons need to be published`); for (const p of addonPackageDirs) { const addon = path.basename(p); - if (changedFiles.some(e => e.includes(addon))) { + // if (changedFiles.some(e => e.includes(addon))) { console.log(`Try publish ${addon}`); checkAndPublishPackage(p); - } + // } } // Publish website if it's a stable release @@ -94,8 +94,7 @@ function checkAndPublishPackage(packageDir) { function getNextBetaVersion(packageJson) { if (!/^\d+\.\d+\.\d+$/.exec(packageJson.version)) { - console.error('The package.json version must be of the form x.y.z'); - process.exit(1); + throw new Error('The package.json version must be of the form x.y.z'); } const tag = 'beta'; const stableVersion = packageJson.version.split('.'); From a1f87809b28d09ccd6add1e82655c7dd62f5d6c5 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:19:23 -0700 Subject: [PATCH 26/46] Log versionsJson --- bin/publish.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/publish.js b/bin/publish.js index 1b520b0f7..eac330a06 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -118,6 +118,7 @@ function getPublishedVersions(packageJson, version, tag) { if (!versionsJson || versionsJson.length === 0) { return []; } + console.log('versionsJson', versionsJson); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From 059acb2da6fe7d32c67dbc9089ebc1770dca15e0 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:22:28 -0700 Subject: [PATCH 27/46] Handle versionsJson error --- bin/publish.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index eac330a06..1103797f6 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -115,10 +115,9 @@ function getNextBetaVersion(packageJson) { function getPublishedVersions(packageJson, version, tag) { const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']); const versionsJson = JSON.parse(versionsProcess.stdout); - if (!versionsJson || versionsJson.length === 0) { + if (!versionsJson || !Array.isArray(versionsJson) || versionsJson.length === 0) { return []; } - console.log('versionsJson', versionsJson); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From dcc940c32ebf313a1a8166c6de1f456ad350500f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:24:49 -0700 Subject: [PATCH 28/46] headless -> scoped --- bin/package_headless.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/package_headless.js b/bin/package_headless.js index d002a95ec..6f891f05c 100644 --- a/bin/package_headless.js +++ b/bin/package_headless.js @@ -14,7 +14,7 @@ console.log('> headless/package.json'); const xtermPackageJson = require('../package.json'); const xtermHeadlessPackageJson = { ...xtermPackageJson, - name: 'xterm-headless', + name: '@xterm/headless', description: 'A headless terminal component that runs in Node.js', main: 'lib-headless/xterm-headless.js', types: 'typings/xterm-headless.d.ts', From 765a8b21a3a897f1dd06b2a28b45dd8f025c3a21 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:25:58 -0700 Subject: [PATCH 29/46] real run --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6077a4e5..21526c2c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,4 +29,4 @@ jobs: - name: Publish to npm env: NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: node ./bin/publish.js --dry + run: node ./bin/publish.js From 485fb455d6282126d8d612a556b23a6affbf9f69 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:29:42 -0700 Subject: [PATCH 30/46] Add release dry run job to CI --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ .github/workflows/release.yml | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd3fa512b..114123b45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -306,3 +306,23 @@ jobs: ls -R - name: Integration tests (${{ matrix.browser }}) run: yarn test-api-${{ matrix.browser }} --headless --forbid-only + + release-dry-run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'yarn' + - name: Install dependencies + run: yarn --frozen-lockfile + - name: Build + run: yarn setup + - name: Package headless + run: | + yarn package-headless + node ./bin/package_headless.js + - name: Publish to npm (dry run) + run: node ./bin/publish.js --dry diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21526c2c7..1e26e438f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,6 @@ on: # If a commit reaches master, assume it has passed CI via PR and publish # without running tests to save time to publish branches: [ "master" ] - pull_request: - branches: [ "master" ] jobs: release: From 4abb4c674f29f4884410852c1862fe512d3d6cbf Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:31:39 -0700 Subject: [PATCH 31/46] Use build artifacts in dry run --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 114123b45..a4c76a976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,18 +308,36 @@ jobs: run: yarn test-api-${{ matrix.browser }} --headless --forbid-only release-dry-run: + needs: build runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] steps: - uses: actions/checkout@v3 - - name: Use Node.js 18.x + - name: Use Node.js ${{ matrix.node-version }}.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile - - name: Build - run: yarn setup + run: | + yarn --frozen-lockfile + yarn install-addons + - name: Install playwright + run: npx playwright install + - uses: actions/download-artifact@v3 + with: + name: build-artifacts + - name: Unzip artifacts + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}" + else + unzip -o compressed-build.zip + fi + ls -R - name: Package headless run: | yarn package-headless From 0fd04aa76dededc952a37a622a50d88ae1559181 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:35:10 -0700 Subject: [PATCH 32/46] Replace all instances of xterm-addon --- .eslintrc.json | 42 ++++++++--------- .github/workflows/ci.yml | 44 +++++++++--------- README.md | 12 ++--- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 8 ++-- .../package.json | 8 ++-- .../src/AttachAddon.ts | 0 .../src/tsconfig.json | 0 .../test/AttachAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-attach.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 addons/addon-canvas/README.md | 28 +++++++++++ .../package.json | 8 ++-- .../src/BaseRenderLayer.ts | 0 .../src/CanvasAddon.ts | 0 .../src/CanvasRenderer.ts | 0 .../src/CursorRenderLayer.ts | 0 .../src/GridCache.test.ts | 0 .../src/GridCache.ts | 0 .../src/LinkRenderLayer.ts | 0 .../src/SelectionRenderLayer.ts | 0 .../src/TextRenderLayer.ts | 0 .../src/Types.d.ts | 0 .../src/tsconfig.json | 0 .../test/CanvasRenderer.test.ts | 0 .../test/playwright.config.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-canvas.d.ts} | 2 +- .../webpack.config.js | 2 +- .../{xterm-addon-fit => addon-fit}/.gitignore | 0 .../{xterm-addon-fit => addon-fit}/.npmignore | 0 addons/{xterm-addon-fit => addon-fit}/LICENSE | 0 .../{xterm-addon-fit => addon-fit}/README.md | 8 ++-- .../package.json | 8 ++-- .../src/FitAddon.ts | 0 .../src/tsconfig.json | 0 .../test/FitAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-fit.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 8 ++-- .../fixture/endless.sh | 0 .../fixture/example.png | Bin .../fixture/gcrglf.sh | 0 .../fixture/growing_rect.js | 0 .../fixture/iip/palette.iip | 0 .../fixture/iip/spinfox.iip | 0 .../fixture/iip/w3c_gif.iip | 0 .../fixture/iip/w3c_jpg.iip | 0 .../fixture/iip/w3c_png.iip | 0 .../fixture/inspect_palette.sh | 0 .../fixture/overdraw.sh | 0 .../fixture/palette.blob | Bin .../fixture/palette.png | Bin .../fixture/palette.sixel | 0 .../fixture/testimages/agfa-makernotes.jpg | Bin .../fixture/testimages/iphone_hdr_YES.jpg | Bin .../fixture/testimages/nikon-e950.jpg | Bin .../fixture/testimages/sony-alpha-6000.jpg | Bin .../fixture/testimages/spinfox.png | Bin .../fixture/testimages/w3c_home.gif | Bin .../fixture/testimages/w3c_home.jpg | Bin .../fixture/testimages/w3c_home.png | Bin .../fixture/testimages/w3c_home_2.gif | Bin .../fixture/testimages/w3c_home_2.jpg | Bin .../fixture/testimages/w3c_home_2.png | Bin .../fixture/testimages/w3c_home_256.gif | Bin .../fixture/testimages/w3c_home_256.jpg | Bin .../fixture/testimages/w3c_home_256.png | Bin .../fixture/testimages/w3c_home_animation.gif | Bin .../fixture/testimages/w3c_home_gray.gif | Bin .../fixture/testimages/w3c_home_gray.jpg | Bin .../fixture/testimages/w3c_home_gray.png | Bin .../fixture/textcursor.sh | 0 .../package.json | 8 ++-- .../src/IIPHandler.ts | 0 .../src/IIPHeaderParser.test.ts | 0 .../src/IIPHeaderParser.ts | 0 .../src/IIPMetrics.test.ts | 2 +- .../src/IIPMetrics.ts | 0 .../src/ImageAddon.ts | 0 .../src/ImageRenderer.ts | 0 .../src/ImageStorage.ts | 0 .../src/SixelHandler.ts | 0 .../src/Types.d.ts | 0 .../src/tsconfig.json | 0 .../test/ImageAddon.api.ts | 12 ++--- .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-image.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 6 +-- .../bin/download-fonts.js | 0 .../package.json | 8 ++-- .../src/LigaturesAddon.ts | 0 .../src/Types.d.ts | 0 .../src/font.ts | 0 .../src/index.test.ts | 2 +- .../src/index.ts | 0 .../src/parse.test.ts | 0 .../src/parse.ts | 0 .../src/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-ligatures.d.ts} | 4 +- .../webpack.config.js | 2 +- .../yarn.lock | 0 .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 8 ++-- .../fixtures/issue-2444 | 0 .../package.json | 8 ++-- .../src/SearchAddon.ts | 0 .../src/tsconfig.json | 0 .../test/SearchAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-search.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../README.md | 12 ++--- .../benchmark/SerializeAddon.benchmark.ts | 0 .../benchmark/benchmark.json | 0 .../benchmark/tsconfig.json | 0 .../package.json | 8 ++-- .../src/SerializeAddon.test.ts | 2 +- .../src/SerializeAddon.ts | 0 .../src/tsconfig.json | 0 .../test/SerializeAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-serialize.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 4 +- .../UnicodeGraphemeAddon.benchmark.ts | 0 .../benchmark/benchmark.json | 0 .../benchmark/tsconfig.json | 0 .../package.json | 8 ++-- .../src/UnicodeGraphemeProvider.ts | 0 .../src/UnicodeGraphemesAddon.ts | 0 .../src/third-party/UnicodeProperties.ts | 0 .../src/third-party/tiny-inflate.ts | 0 .../src/third-party/unicode-trie.ts | 0 .../src/tsconfig.json | 0 .../test/UnicodeGraphemesAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-unicode-graphemes.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 6 +-- .../package.json | 8 ++-- .../src/Unicode11Addon.ts | 0 .../src/UnicodeV11.ts | 0 .../src/tsconfig.json | 0 .../test/Unicode11Addon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-unicode11.d.ts} | 2 +- .../webpack.config.js | 2 +- .../.gitignore | 0 .../.npmignore | 0 .../LICENSE | 0 .../README.md | 8 ++-- .../package.json | 8 ++-- .../src/WebLinkProvider.ts | 0 .../src/WebLinksAddon.ts | 0 .../src/tsconfig.json | 0 .../test/WebLinksAddon.api.ts | 0 .../test/tsconfig.json | 0 .../tsconfig.json | 0 .../typings/addon-web-links.d.ts} | 2 +- .../webpack.config.js | 2 +- addons/addon-webgl/README.md | 2 +- addons/xterm-addon-canvas/README.md | 28 ----------- bin/publish.js | 19 ++++---- bin/test_playwright.js | 2 +- demo/client.ts | 42 ++++++++--------- demo/tsconfig.json | 12 ++--- src/common/InputHandler.ts | 2 +- tsconfig.all.json | 20 ++++---- 202 files changed, 231 insertions(+), 230 deletions(-) rename addons/{xterm-addon-attach => addon-attach}/.gitignore (100%) rename addons/{xterm-addon-attach => addon-attach}/.npmignore (100%) rename addons/{xterm-addon-attach => addon-attach}/LICENSE (100%) rename addons/{xterm-addon-attach => addon-attach}/README.md (67%) rename addons/{xterm-addon-attach => addon-attach}/package.json (77%) rename addons/{xterm-addon-attach => addon-attach}/src/AttachAddon.ts (100%) rename addons/{xterm-addon-attach => addon-attach}/src/tsconfig.json (100%) rename addons/{xterm-addon-attach => addon-attach}/test/AttachAddon.api.ts (100%) rename addons/{xterm-addon-attach => addon-attach}/test/tsconfig.json (100%) rename addons/{xterm-addon-attach => addon-attach}/tsconfig.json (100%) rename addons/{xterm-addon-attach/typings/xterm-addon-attach.d.ts => addon-attach/typings/addon-attach.d.ts} (92%) rename addons/{xterm-addon-attach => addon-attach}/webpack.config.js (92%) rename addons/{xterm-addon-canvas => addon-canvas}/.gitignore (100%) rename addons/{xterm-addon-canvas => addon-canvas}/.npmignore (100%) rename addons/{xterm-addon-canvas => addon-canvas}/LICENSE (100%) create mode 100644 addons/addon-canvas/README.md rename addons/{xterm-addon-canvas => addon-canvas}/package.json (80%) rename addons/{xterm-addon-canvas => addon-canvas}/src/BaseRenderLayer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/CanvasAddon.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/CanvasRenderer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/CursorRenderLayer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/GridCache.test.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/GridCache.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/LinkRenderLayer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/SelectionRenderLayer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/TextRenderLayer.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/Types.d.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/src/tsconfig.json (100%) rename addons/{xterm-addon-canvas => addon-canvas}/test/CanvasRenderer.test.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/test/playwright.config.ts (100%) rename addons/{xterm-addon-canvas => addon-canvas}/test/tsconfig.json (100%) rename addons/{xterm-addon-canvas => addon-canvas}/tsconfig.json (100%) rename addons/{xterm-addon-canvas/typings/xterm-addon-canvas.d.ts => addon-canvas/typings/addon-canvas.d.ts} (96%) rename addons/{xterm-addon-canvas => addon-canvas}/webpack.config.js (94%) rename addons/{xterm-addon-fit => addon-fit}/.gitignore (100%) rename addons/{xterm-addon-fit => addon-fit}/.npmignore (100%) rename addons/{xterm-addon-fit => addon-fit}/LICENSE (100%) rename addons/{xterm-addon-fit => addon-fit}/README.md (72%) rename addons/{xterm-addon-fit => addon-fit}/package.json (79%) rename addons/{xterm-addon-fit => addon-fit}/src/FitAddon.ts (100%) rename addons/{xterm-addon-fit => addon-fit}/src/tsconfig.json (100%) rename addons/{xterm-addon-fit => addon-fit}/test/FitAddon.api.ts (100%) rename addons/{xterm-addon-fit => addon-fit}/test/tsconfig.json (100%) rename addons/{xterm-addon-fit => addon-fit}/tsconfig.json (100%) rename addons/{xterm-addon-fit/typings/xterm-addon-fit.d.ts => addon-fit/typings/addon-fit.d.ts} (96%) rename addons/{xterm-addon-fit => addon-fit}/webpack.config.js (93%) rename addons/{xterm-addon-image => addon-image}/.gitignore (100%) rename addons/{xterm-addon-image => addon-image}/.npmignore (100%) rename addons/{xterm-addon-image => addon-image}/LICENSE (100%) rename addons/{xterm-addon-image => addon-image}/README.md (98%) rename addons/{xterm-addon-image => addon-image}/fixture/endless.sh (100%) mode change 100755 => 100644 rename addons/{xterm-addon-image => addon-image}/fixture/example.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/gcrglf.sh (100%) mode change 100755 => 100644 rename addons/{xterm-addon-image => addon-image}/fixture/growing_rect.js (100%) rename addons/{xterm-addon-image => addon-image}/fixture/iip/palette.iip (100%) rename addons/{xterm-addon-image => addon-image}/fixture/iip/spinfox.iip (100%) rename addons/{xterm-addon-image => addon-image}/fixture/iip/w3c_gif.iip (100%) rename addons/{xterm-addon-image => addon-image}/fixture/iip/w3c_jpg.iip (100%) rename addons/{xterm-addon-image => addon-image}/fixture/iip/w3c_png.iip (100%) rename addons/{xterm-addon-image => addon-image}/fixture/inspect_palette.sh (100%) mode change 100755 => 100644 rename addons/{xterm-addon-image => addon-image}/fixture/overdraw.sh (100%) mode change 100755 => 100644 rename addons/{xterm-addon-image => addon-image}/fixture/palette.blob (100%) rename addons/{xterm-addon-image => addon-image}/fixture/palette.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/palette.sixel (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/agfa-makernotes.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/iphone_hdr_YES.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/nikon-e950.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/sony-alpha-6000.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/spinfox.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home.gif (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_2.gif (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_2.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_2.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_256.gif (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_256.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_256.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_animation.gif (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_gray.gif (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_gray.jpg (100%) rename addons/{xterm-addon-image => addon-image}/fixture/testimages/w3c_home_gray.png (100%) rename addons/{xterm-addon-image => addon-image}/fixture/textcursor.sh (100%) mode change 100755 => 100644 rename addons/{xterm-addon-image => addon-image}/package.json (80%) rename addons/{xterm-addon-image => addon-image}/src/IIPHandler.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/IIPHeaderParser.test.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/IIPHeaderParser.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/IIPMetrics.test.ts (94%) rename addons/{xterm-addon-image => addon-image}/src/IIPMetrics.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/ImageAddon.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/ImageRenderer.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/ImageStorage.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/SixelHandler.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/Types.d.ts (100%) rename addons/{xterm-addon-image => addon-image}/src/tsconfig.json (100%) rename addons/{xterm-addon-image => addon-image}/test/ImageAddon.api.ts (95%) rename addons/{xterm-addon-image => addon-image}/test/tsconfig.json (100%) rename addons/{xterm-addon-image => addon-image}/tsconfig.json (100%) rename addons/{xterm-addon-image/typings/xterm-addon-image.d.ts => addon-image/typings/addon-image.d.ts} (99%) rename addons/{xterm-addon-image => addon-image}/webpack.config.js (93%) rename addons/{xterm-addon-ligatures => addon-ligatures}/.gitignore (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/.npmignore (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/LICENSE (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/README.md (95%) rename addons/{xterm-addon-ligatures => addon-ligatures}/bin/download-fonts.js (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/package.json (86%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/LigaturesAddon.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/Types.d.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/font.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/index.test.ts (99%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/index.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/parse.test.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/parse.ts (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/src/tsconfig.json (100%) rename addons/{xterm-addon-ligatures => addon-ligatures}/tsconfig.json (100%) rename addons/{xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts => addon-ligatures/typings/addon-ligatures.d.ts} (92%) rename addons/{xterm-addon-ligatures => addon-ligatures}/webpack.config.js (95%) rename addons/{xterm-addon-ligatures => addon-ligatures}/yarn.lock (100%) rename addons/{xterm-addon-search => addon-search}/.gitignore (100%) rename addons/{xterm-addon-search => addon-search}/.npmignore (100%) rename addons/{xterm-addon-search => addon-search}/LICENSE (100%) rename addons/{xterm-addon-search => addon-search}/README.md (68%) rename addons/{xterm-addon-search => addon-search}/fixtures/issue-2444 (100%) rename addons/{xterm-addon-search => addon-search}/package.json (77%) rename addons/{xterm-addon-search => addon-search}/src/SearchAddon.ts (100%) rename addons/{xterm-addon-search => addon-search}/src/tsconfig.json (100%) rename addons/{xterm-addon-search => addon-search}/test/SearchAddon.api.ts (100%) rename addons/{xterm-addon-search => addon-search}/test/tsconfig.json (100%) rename addons/{xterm-addon-search => addon-search}/tsconfig.json (100%) rename addons/{xterm-addon-search/typings/xterm-addon-search.d.ts => addon-search/typings/addon-search.d.ts} (98%) rename addons/{xterm-addon-search => addon-search}/webpack.config.js (94%) rename addons/{xterm-addon-serialize => addon-serialize}/.gitignore (100%) rename addons/{xterm-addon-serialize => addon-serialize}/.npmignore (100%) rename addons/{xterm-addon-serialize => addon-serialize}/README.md (74%) rename addons/{xterm-addon-serialize => addon-serialize}/benchmark/SerializeAddon.benchmark.ts (100%) rename addons/{xterm-addon-serialize => addon-serialize}/benchmark/benchmark.json (100%) rename addons/{xterm-addon-serialize => addon-serialize}/benchmark/tsconfig.json (100%) rename addons/{xterm-addon-serialize => addon-serialize}/package.json (86%) rename addons/{xterm-addon-serialize => addon-serialize}/src/SerializeAddon.test.ts (99%) rename addons/{xterm-addon-serialize => addon-serialize}/src/SerializeAddon.ts (100%) rename addons/{xterm-addon-serialize => addon-serialize}/src/tsconfig.json (100%) rename addons/{xterm-addon-serialize => addon-serialize}/test/SerializeAddon.api.ts (100%) rename addons/{xterm-addon-serialize => addon-serialize}/test/tsconfig.json (100%) rename addons/{xterm-addon-serialize => addon-serialize}/tsconfig.json (100%) rename addons/{xterm-addon-serialize/typings/xterm-addon-serialize.d.ts => addon-serialize/typings/addon-serialize.d.ts} (98%) rename addons/{xterm-addon-serialize => addon-serialize}/webpack.config.js (94%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/.gitignore (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/.npmignore (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/LICENSE (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/README.md (86%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/benchmark/UnicodeGraphemeAddon.benchmark.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/benchmark/benchmark.json (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/benchmark/tsconfig.json (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/package.json (84%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/UnicodeGraphemeProvider.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/UnicodeGraphemesAddon.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/third-party/UnicodeProperties.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/third-party/tiny-inflate.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/third-party/unicode-trie.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/src/tsconfig.json (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/test/UnicodeGraphemesAddon.api.ts (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/test/tsconfig.json (100%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/tsconfig.json (100%) rename addons/{xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts => addon-unicode-graphemes/typings/addon-unicode-graphemes.d.ts} (86%) rename addons/{xterm-addon-unicode-graphemes => addon-unicode-graphemes}/webpack.config.js (92%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/.gitignore (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/.npmignore (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/LICENSE (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/README.md (72%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/package.json (76%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/src/Unicode11Addon.ts (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/src/UnicodeV11.ts (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/src/tsconfig.json (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/test/Unicode11Addon.api.ts (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/test/tsconfig.json (100%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/tsconfig.json (100%) rename addons/{xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts => addon-unicode11/typings/addon-unicode11.d.ts} (87%) rename addons/{xterm-addon-unicode11 => addon-unicode11}/webpack.config.js (94%) rename addons/{xterm-addon-web-links => addon-web-links}/.gitignore (100%) rename addons/{xterm-addon-web-links => addon-web-links}/.npmignore (100%) rename addons/{xterm-addon-web-links => addon-web-links}/LICENSE (100%) rename addons/{xterm-addon-web-links => addon-web-links}/README.md (61%) rename addons/{xterm-addon-web-links => addon-web-links}/package.json (76%) rename addons/{xterm-addon-web-links => addon-web-links}/src/WebLinkProvider.ts (100%) rename addons/{xterm-addon-web-links => addon-web-links}/src/WebLinksAddon.ts (100%) rename addons/{xterm-addon-web-links => addon-web-links}/src/tsconfig.json (100%) rename addons/{xterm-addon-web-links => addon-web-links}/test/WebLinksAddon.api.ts (100%) rename addons/{xterm-addon-web-links => addon-web-links}/test/tsconfig.json (100%) rename addons/{xterm-addon-web-links => addon-web-links}/tsconfig.json (100%) rename addons/{xterm-addon-web-links/typings/xterm-addon-web-links.d.ts => addon-web-links/typings/addon-web-links.d.ts} (97%) rename addons/{xterm-addon-web-links => addon-web-links}/webpack.config.js (92%) delete mode 100644 addons/xterm-addon-canvas/README.md diff --git a/.eslintrc.json b/.eslintrc.json index 8ca2eccc0..9ba501208 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,27 +14,27 @@ "test/api/tsconfig.json", "test/benchmark/tsconfig.json", "test/playwright/tsconfig.json", - "addons/xterm-addon-attach/src/tsconfig.json", - "addons/xterm-addon-attach/test/tsconfig.json", - "addons/xterm-addon-canvas/src/tsconfig.json", - "addons/xterm-addon-canvas/test/tsconfig.json", - "addons/xterm-addon-fit/src/tsconfig.json", - "addons/xterm-addon-fit/test/tsconfig.json", - "addons/xterm-addon-image/src/tsconfig.json", - "addons/xterm-addon-image/test/tsconfig.json", - "addons/xterm-addon-ligatures/src/tsconfig.json", - "addons/xterm-addon-search/src/tsconfig.json", - "addons/xterm-addon-search/test/tsconfig.json", - "addons/xterm-addon-serialize/src/tsconfig.json", - "addons/xterm-addon-serialize/test/tsconfig.json", - "addons/xterm-addon-serialize/benchmark/tsconfig.json", - "addons/xterm-addon-unicode11/src/tsconfig.json", - "addons/xterm-addon-unicode11/test/tsconfig.json", - "addons/xterm-addon-unicode-graphemes/src/tsconfig.json", - "addons/xterm-addon-unicode-graphemes/test/tsconfig.json", - "addons/xterm-addon-unicode-graphemes/benchmark/tsconfig.json", - "addons/xterm-addon-web-links/src/tsconfig.json", - "addons/xterm-addon-web-links/test/tsconfig.json", + "addons/addon-attach/src/tsconfig.json", + "addons/addon-attach/test/tsconfig.json", + "addons/addon-canvas/src/tsconfig.json", + "addons/addon-canvas/test/tsconfig.json", + "addons/addon-fit/src/tsconfig.json", + "addons/addon-fit/test/tsconfig.json", + "addons/addon-image/src/tsconfig.json", + "addons/addon-image/test/tsconfig.json", + "addons/addon-ligatures/src/tsconfig.json", + "addons/addon-search/src/tsconfig.json", + "addons/addon-search/test/tsconfig.json", + "addons/addon-serialize/src/tsconfig.json", + "addons/addon-serialize/test/tsconfig.json", + "addons/addon-serialize/benchmark/tsconfig.json", + "addons/addon-unicode11/src/tsconfig.json", + "addons/addon-unicode11/test/tsconfig.json", + "addons/addon-unicode-graphemes/src/tsconfig.json", + "addons/addon-unicode-graphemes/test/tsconfig.json", + "addons/addon-unicode-graphemes/benchmark/tsconfig.json", + "addons/addon-web-links/src/tsconfig.json", + "addons/addon-web-links/test/tsconfig.json", "addons/addon-webgl/src/tsconfig.json", "addons/addon-webgl/test/tsconfig.json" ], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4c76a976..0a64b6a7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,26 +26,26 @@ jobs: zip -r compressed-build \ ./out/* \ ./out-test/* \ - ./addons/xterm-addon-attach/out/* \ - ./addons/xterm-addon-attach/out-test/* \ - ./addons/xterm-addon-canvas/out/* \ - ./addons/xterm-addon-canvas/out-test/* \ - ./addons/xterm-addon-fit/out/* \ - ./addons/xterm-addon-fit/out-test/* \ - ./addons/xterm-addon-image/out/* \ - ./addons/xterm-addon-image/out-test/* \ - ./addons/xterm-addon-ligatures/out/* \ - ./addons/xterm-addon-ligatures/out-test/* \ - ./addons/xterm-addon-search/out/* \ - ./addons/xterm-addon-search/out-test/* \ - ./addons/xterm-addon-serialize/out/* \ - ./addons/xterm-addon-serialize/out-test/* \ - ./addons/xterm-addon-unicode11/out/* \ - ./addons/xterm-addon-unicode11/out-test/* \ - ./addons/xterm-addon-unicode-graphemes/out/* \ - ./addons/xterm-addon-unicode-graphemes/out-test/* \ - ./addons/xterm-addon-web-links/out/* \ - ./addons/xterm-addon-web-links/out-test/* \ + ./addons/addon-attach/out/* \ + ./addons/addon-attach/out-test/* \ + ./addons/addon-canvas/out/* \ + ./addons/addon-canvas/out-test/* \ + ./addons/addon-fit/out/* \ + ./addons/addon-fit/out-test/* \ + ./addons/addon-image/out/* \ + ./addons/addon-image/out-test/* \ + ./addons/addon-ligatures/out/* \ + ./addons/addon-ligatures/out-test/* \ + ./addons/addon-search/out/* \ + ./addons/addon-search/out-test/* \ + ./addons/addon-serialize/out/* \ + ./addons/addon-serialize/out-test/* \ + ./addons/addon-unicode11/out/* \ + ./addons/addon-unicode11/out-test/* \ + ./addons/addon-unicode-graphemes/out/* \ + ./addons/addon-unicode-graphemes/out-test/* \ + ./addons/addon-web-links/out/* \ + ./addons/addon-web-links/out-test/* \ ./addons/addon-webgl/out/* \ ./addons/addon-webgl/out-test/* - name: Upload artifacts @@ -265,8 +265,8 @@ jobs: run: yarn build-demo - name: Integration tests (core) # Tests use 50% workers to reduce flakiness run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=core - - name: Integration tests (xterm-addon-canvas) - run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=xterm-addon-canvas + - name: Integration tests (addon-canvas) + run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-canvas - name: Integration tests (addon-webgl) run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-webgl diff --git a/README.md b/README.md index 64dde4c1d..47ede986a 100644 --- a/README.md +++ b/README.md @@ -59,14 +59,14 @@ import { Terminal } from '@xterm/xterm'; Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon, you first need to install it in your project: ```bash -npm i -S xterm-addon-web-links +npm i -S @xterm/addon-web-links ``` Then import the addon, instantiate it and call `Terminal.loadAddon`: ```ts import { Terminal } from '@xterm/xterm'; -import { WebLinksAddon } from 'xterm-addon-web-links'; +import { WebLinksAddon } from '@xterm/addon-web-links'; const terminal = new Terminal(); // Load WebLinksAddon on terminal, this is all that's needed to get web links @@ -76,10 +76,10 @@ terminal.loadAddon(new WebLinksAddon()); The xterm.js team maintains the following addons, but anyone can build them: -- [`xterm-addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-attach): Attaches to a server running a process via a websocket -- [`xterm-addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-fit): Fits the terminal to the containing element -- [`xterm-addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-search): Adds search functionality -- [`xterm-addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-web-links): Adds web link detection and interaction +- [`@xterm/addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-attach): Attaches to a server running a process via a websocket +- [`@xterm/addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit): Fits the terminal to the containing element +- [`@xterm/addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-search): Adds search functionality +- [`@xterm/addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-web-links): Adds web link detection and interaction ## Browser Support diff --git a/addons/xterm-addon-attach/.gitignore b/addons/addon-attach/.gitignore similarity index 100% rename from addons/xterm-addon-attach/.gitignore rename to addons/addon-attach/.gitignore diff --git a/addons/xterm-addon-attach/.npmignore b/addons/addon-attach/.npmignore similarity index 100% rename from addons/xterm-addon-attach/.npmignore rename to addons/addon-attach/.npmignore diff --git a/addons/xterm-addon-attach/LICENSE b/addons/addon-attach/LICENSE similarity index 100% rename from addons/xterm-addon-attach/LICENSE rename to addons/addon-attach/LICENSE diff --git a/addons/xterm-addon-attach/README.md b/addons/addon-attach/README.md similarity index 67% rename from addons/xterm-addon-attach/README.md rename to addons/addon-attach/README.md index a12c3c675..fa123fe28 100644 --- a/addons/xterm-addon-attach/README.md +++ b/addons/addon-attach/README.md @@ -1,22 +1,22 @@ -## xterm-addon-attach +## @xterm/addon-attach An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables attaching to a web socket. This addon requires xterm.js v4+. ### Install ```bash -npm install --save xterm-addon-attach +npm install --save @xterm/addon-attach ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { AttachAddon } from 'xterm-addon-attach'; +import { AttachAddon } from '@xterm/addon-attach'; const terminal = new Terminal(); const attachAddon = new AttachAddon(webSocket); terminal.loadAddon(attachAddon); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-attach/typings/addon-attach.d.ts) for more advanced usage. diff --git a/addons/xterm-addon-attach/package.json b/addons/addon-attach/package.json similarity index 77% rename from addons/xterm-addon-attach/package.json rename to addons/addon-attach/package.json index be92fc66e..8e5a413e5 100644 --- a/addons/xterm-addon-attach/package.json +++ b/addons/addon-attach/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-attach", + "name": "@xterm/addon-attach", "version": "0.9.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-attach.js", - "types": "typings/xterm-addon-attach.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-attach", + "main": "lib/addon-attach.js", + "types": "typings/addon-attach.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-attach", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-attach/src/AttachAddon.ts b/addons/addon-attach/src/AttachAddon.ts similarity index 100% rename from addons/xterm-addon-attach/src/AttachAddon.ts rename to addons/addon-attach/src/AttachAddon.ts diff --git a/addons/xterm-addon-attach/src/tsconfig.json b/addons/addon-attach/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-attach/src/tsconfig.json rename to addons/addon-attach/src/tsconfig.json diff --git a/addons/xterm-addon-attach/test/AttachAddon.api.ts b/addons/addon-attach/test/AttachAddon.api.ts similarity index 100% rename from addons/xterm-addon-attach/test/AttachAddon.api.ts rename to addons/addon-attach/test/AttachAddon.api.ts diff --git a/addons/xterm-addon-attach/test/tsconfig.json b/addons/addon-attach/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-attach/test/tsconfig.json rename to addons/addon-attach/test/tsconfig.json diff --git a/addons/xterm-addon-attach/tsconfig.json b/addons/addon-attach/tsconfig.json similarity index 100% rename from addons/xterm-addon-attach/tsconfig.json rename to addons/addon-attach/tsconfig.json diff --git a/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts b/addons/addon-attach/typings/addon-attach.d.ts similarity index 92% rename from addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts rename to addons/addon-attach/typings/addon-attach.d.ts index 862968256..4e1b2fc3b 100644 --- a/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts +++ b/addons/addon-attach/typings/addon-attach.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-attach' { +declare module '@xterm/addon-attach' { export interface IAttachOptions { /** * Whether input should be written to the backend. Defaults to `true`. diff --git a/addons/xterm-addon-attach/webpack.config.js b/addons/addon-attach/webpack.config.js similarity index 92% rename from addons/xterm-addon-attach/webpack.config.js rename to addons/addon-attach/webpack.config.js index 65996f19c..599bb1420 100644 --- a/addons/xterm-addon-attach/webpack.config.js +++ b/addons/addon-attach/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'AttachAddon'; -const mainFile = 'xterm-addon-attach.js'; +const mainFile = 'addon-attach.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-canvas/.gitignore b/addons/addon-canvas/.gitignore similarity index 100% rename from addons/xterm-addon-canvas/.gitignore rename to addons/addon-canvas/.gitignore diff --git a/addons/xterm-addon-canvas/.npmignore b/addons/addon-canvas/.npmignore similarity index 100% rename from addons/xterm-addon-canvas/.npmignore rename to addons/addon-canvas/.npmignore diff --git a/addons/xterm-addon-canvas/LICENSE b/addons/addon-canvas/LICENSE similarity index 100% rename from addons/xterm-addon-canvas/LICENSE rename to addons/addon-canvas/LICENSE diff --git a/addons/addon-canvas/README.md b/addons/addon-canvas/README.md new file mode 100644 index 000000000..502ade258 --- /dev/null +++ b/addons/addon-canvas/README.md @@ -0,0 +1,28 @@ +## @xterm/addon-canvas + +An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a canvas-based renderer using a 2d context to draw. This addon requires xterm.js v5+. + +The purpose of this addon is to be used as a fallback for the [webgl addon](https://www.npmjs.com/package/@xterm/addon-webgl) when better performance is desired over the default DOM renderer, but WebGL2 isn't supported or performant for some reason. + +### Install + +```bash +npm install --save @xterm/addon-canvas +``` + +### Usage + +```ts +import { Terminal } from '@xterm/xterm'; +import { CanvasAddon } from '@xterm/addon-canvas'; + +const terminal = new Terminal(); +terminal.open(element); +terminal.loadAddon(new CanvasAddon()); +``` + +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-canvas/typings/addon-canvas.d.ts) for more advanced usage. + +### See also + +- [@xterm/addon-webgl](https://www.npmjs.com/package/@xterm/addon-webgl) A renderer for xterm.js that uses WebGL diff --git a/addons/xterm-addon-canvas/package.json b/addons/addon-canvas/package.json similarity index 80% rename from addons/xterm-addon-canvas/package.json rename to addons/addon-canvas/package.json index eefdf3751..a614c2811 100644 --- a/addons/xterm-addon-canvas/package.json +++ b/addons/addon-canvas/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-canvas", + "name": "@xterm/addon-canvas", "version": "0.5.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-canvas.js", - "types": "typings/xterm-addon-canvas.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-canvas", + "main": "lib/addon-canvas.js", + "types": "typings/addon-canvas.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-canvas/src/BaseRenderLayer.ts b/addons/addon-canvas/src/BaseRenderLayer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/BaseRenderLayer.ts rename to addons/addon-canvas/src/BaseRenderLayer.ts diff --git a/addons/xterm-addon-canvas/src/CanvasAddon.ts b/addons/addon-canvas/src/CanvasAddon.ts similarity index 100% rename from addons/xterm-addon-canvas/src/CanvasAddon.ts rename to addons/addon-canvas/src/CanvasAddon.ts diff --git a/addons/xterm-addon-canvas/src/CanvasRenderer.ts b/addons/addon-canvas/src/CanvasRenderer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/CanvasRenderer.ts rename to addons/addon-canvas/src/CanvasRenderer.ts diff --git a/addons/xterm-addon-canvas/src/CursorRenderLayer.ts b/addons/addon-canvas/src/CursorRenderLayer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/CursorRenderLayer.ts rename to addons/addon-canvas/src/CursorRenderLayer.ts diff --git a/addons/xterm-addon-canvas/src/GridCache.test.ts b/addons/addon-canvas/src/GridCache.test.ts similarity index 100% rename from addons/xterm-addon-canvas/src/GridCache.test.ts rename to addons/addon-canvas/src/GridCache.test.ts diff --git a/addons/xterm-addon-canvas/src/GridCache.ts b/addons/addon-canvas/src/GridCache.ts similarity index 100% rename from addons/xterm-addon-canvas/src/GridCache.ts rename to addons/addon-canvas/src/GridCache.ts diff --git a/addons/xterm-addon-canvas/src/LinkRenderLayer.ts b/addons/addon-canvas/src/LinkRenderLayer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/LinkRenderLayer.ts rename to addons/addon-canvas/src/LinkRenderLayer.ts diff --git a/addons/xterm-addon-canvas/src/SelectionRenderLayer.ts b/addons/addon-canvas/src/SelectionRenderLayer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/SelectionRenderLayer.ts rename to addons/addon-canvas/src/SelectionRenderLayer.ts diff --git a/addons/xterm-addon-canvas/src/TextRenderLayer.ts b/addons/addon-canvas/src/TextRenderLayer.ts similarity index 100% rename from addons/xterm-addon-canvas/src/TextRenderLayer.ts rename to addons/addon-canvas/src/TextRenderLayer.ts diff --git a/addons/xterm-addon-canvas/src/Types.d.ts b/addons/addon-canvas/src/Types.d.ts similarity index 100% rename from addons/xterm-addon-canvas/src/Types.d.ts rename to addons/addon-canvas/src/Types.d.ts diff --git a/addons/xterm-addon-canvas/src/tsconfig.json b/addons/addon-canvas/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-canvas/src/tsconfig.json rename to addons/addon-canvas/src/tsconfig.json diff --git a/addons/xterm-addon-canvas/test/CanvasRenderer.test.ts b/addons/addon-canvas/test/CanvasRenderer.test.ts similarity index 100% rename from addons/xterm-addon-canvas/test/CanvasRenderer.test.ts rename to addons/addon-canvas/test/CanvasRenderer.test.ts diff --git a/addons/xterm-addon-canvas/test/playwright.config.ts b/addons/addon-canvas/test/playwright.config.ts similarity index 100% rename from addons/xterm-addon-canvas/test/playwright.config.ts rename to addons/addon-canvas/test/playwright.config.ts diff --git a/addons/xterm-addon-canvas/test/tsconfig.json b/addons/addon-canvas/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-canvas/test/tsconfig.json rename to addons/addon-canvas/test/tsconfig.json diff --git a/addons/xterm-addon-canvas/tsconfig.json b/addons/addon-canvas/tsconfig.json similarity index 100% rename from addons/xterm-addon-canvas/tsconfig.json rename to addons/addon-canvas/tsconfig.json diff --git a/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts b/addons/addon-canvas/typings/addon-canvas.d.ts similarity index 96% rename from addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts rename to addons/addon-canvas/typings/addon-canvas.d.ts index 9a444d27e..a679f0a5c 100644 --- a/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts +++ b/addons/addon-canvas/typings/addon-canvas.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm'; -declare module 'xterm-addon-canvas' { +declare module '@xterm/addon-canvas' { /** * An xterm.js addon that provides search functionality. */ diff --git a/addons/xterm-addon-canvas/webpack.config.js b/addons/addon-canvas/webpack.config.js similarity index 94% rename from addons/xterm-addon-canvas/webpack.config.js rename to addons/addon-canvas/webpack.config.js index 9c98760a1..9daa08f9b 100644 --- a/addons/xterm-addon-canvas/webpack.config.js +++ b/addons/addon-canvas/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'CanvasAddon'; -const mainFile = 'xterm-addon-canvas.js'; +const mainFile = 'addon-canvas.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-fit/.gitignore b/addons/addon-fit/.gitignore similarity index 100% rename from addons/xterm-addon-fit/.gitignore rename to addons/addon-fit/.gitignore diff --git a/addons/xterm-addon-fit/.npmignore b/addons/addon-fit/.npmignore similarity index 100% rename from addons/xterm-addon-fit/.npmignore rename to addons/addon-fit/.npmignore diff --git a/addons/xterm-addon-fit/LICENSE b/addons/addon-fit/LICENSE similarity index 100% rename from addons/xterm-addon-fit/LICENSE rename to addons/addon-fit/LICENSE diff --git a/addons/xterm-addon-fit/README.md b/addons/addon-fit/README.md similarity index 72% rename from addons/xterm-addon-fit/README.md rename to addons/addon-fit/README.md index 0b858fb4b..076e51271 100644 --- a/addons/xterm-addon-fit/README.md +++ b/addons/addon-fit/README.md @@ -1,18 +1,18 @@ -## xterm-addon-fit +## @xterm/addon-fit An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables fitting the terminal's dimensions to a containing element. This addon requires xterm.js v4+. ### Install ```bash -npm install --save xterm-addon-fit +npm install --save @xterm/addon-fit ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { FitAddon } from 'xterm-addon-fit'; +import { FitAddon } from '@xterm/addon-fit'; const terminal = new Terminal(); const fitAddon = new FitAddon(); @@ -21,4 +21,4 @@ terminal.open(containerElement); fitAddon.fit(); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-fit/typings/addon-fit.d.ts) for more advanced usage. diff --git a/addons/xterm-addon-fit/package.json b/addons/addon-fit/package.json similarity index 79% rename from addons/xterm-addon-fit/package.json rename to addons/addon-fit/package.json index b2652aaea..046ef4d87 100644 --- a/addons/xterm-addon-fit/package.json +++ b/addons/addon-fit/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-fit", + "name": "@xterm/addon-fit", "version": "0.8.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-fit.js", - "types": "typings/xterm-addon-fit.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-fit", + "main": "lib/addon-fit.js", + "types": "typings/addon-fit.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-fit/src/FitAddon.ts b/addons/addon-fit/src/FitAddon.ts similarity index 100% rename from addons/xterm-addon-fit/src/FitAddon.ts rename to addons/addon-fit/src/FitAddon.ts diff --git a/addons/xterm-addon-fit/src/tsconfig.json b/addons/addon-fit/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-fit/src/tsconfig.json rename to addons/addon-fit/src/tsconfig.json diff --git a/addons/xterm-addon-fit/test/FitAddon.api.ts b/addons/addon-fit/test/FitAddon.api.ts similarity index 100% rename from addons/xterm-addon-fit/test/FitAddon.api.ts rename to addons/addon-fit/test/FitAddon.api.ts diff --git a/addons/xterm-addon-fit/test/tsconfig.json b/addons/addon-fit/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-fit/test/tsconfig.json rename to addons/addon-fit/test/tsconfig.json diff --git a/addons/xterm-addon-fit/tsconfig.json b/addons/addon-fit/tsconfig.json similarity index 100% rename from addons/xterm-addon-fit/tsconfig.json rename to addons/addon-fit/tsconfig.json diff --git a/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts b/addons/addon-fit/typings/addon-fit.d.ts similarity index 96% rename from addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts rename to addons/addon-fit/typings/addon-fit.d.ts index 605a7b1de..e3d20e29f 100644 --- a/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts +++ b/addons/addon-fit/typings/addon-fit.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-fit' { +declare module '@xterm/addon-fit' { /** * An xterm.js addon that enables resizing the terminal to the dimensions of * its containing element. diff --git a/addons/xterm-addon-fit/webpack.config.js b/addons/addon-fit/webpack.config.js similarity index 93% rename from addons/xterm-addon-fit/webpack.config.js rename to addons/addon-fit/webpack.config.js index 4b5421504..e220668c7 100644 --- a/addons/xterm-addon-fit/webpack.config.js +++ b/addons/addon-fit/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'FitAddon'; -const mainFile = 'xterm-addon-fit.js'; +const mainFile = 'addon-fit.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-image/.gitignore b/addons/addon-image/.gitignore similarity index 100% rename from addons/xterm-addon-image/.gitignore rename to addons/addon-image/.gitignore diff --git a/addons/xterm-addon-image/.npmignore b/addons/addon-image/.npmignore similarity index 100% rename from addons/xterm-addon-image/.npmignore rename to addons/addon-image/.npmignore diff --git a/addons/xterm-addon-image/LICENSE b/addons/addon-image/LICENSE similarity index 100% rename from addons/xterm-addon-image/LICENSE rename to addons/addon-image/LICENSE diff --git a/addons/xterm-addon-image/README.md b/addons/addon-image/README.md similarity index 98% rename from addons/xterm-addon-image/README.md rename to addons/addon-image/README.md index f9ccd637e..9fd327e38 100644 --- a/addons/xterm-addon-image/README.md +++ b/addons/addon-image/README.md @@ -1,4 +1,4 @@ -## xterm-addon-image +## @xterm/addon-image Inline image output in xterm.js. Supports SIXEL and iTerm's inline image protocol (IIP). @@ -9,7 +9,7 @@ Inline image output in xterm.js. Supports SIXEL and iTerm's inline image protoco ### Install from npm ```bash -npm install --save xterm-addon-image +npm install --save @xterm/addon-image ``` @@ -17,7 +17,7 @@ npm install --save xterm-addon-image ```ts import { Terminal } from '@xterm/xterm'; -import { ImageAddon, IImageAddonOptions } from 'xterm-addon-image'; +import { ImageAddon, IImageAddonOptions } from '@xterm/addon-image'; // customize as needed (showing addon defaults) const customSettings: IImageAddonOptions = { @@ -227,5 +227,5 @@ _How can I adjust the memory usage?_ - 0.1.2 bugfix: reset clear flag - 0.1.1 bugfixes: - clear sticky image tiles on render - - create xterm-addon-image folder from bootstrap.sh + - create folder from bootstrap.sh - fix peer dependency in package.json diff --git a/addons/xterm-addon-image/fixture/endless.sh b/addons/addon-image/fixture/endless.sh old mode 100755 new mode 100644 similarity index 100% rename from addons/xterm-addon-image/fixture/endless.sh rename to addons/addon-image/fixture/endless.sh diff --git a/addons/xterm-addon-image/fixture/example.png b/addons/addon-image/fixture/example.png similarity index 100% rename from addons/xterm-addon-image/fixture/example.png rename to addons/addon-image/fixture/example.png diff --git a/addons/xterm-addon-image/fixture/gcrglf.sh b/addons/addon-image/fixture/gcrglf.sh old mode 100755 new mode 100644 similarity index 100% rename from addons/xterm-addon-image/fixture/gcrglf.sh rename to addons/addon-image/fixture/gcrglf.sh diff --git a/addons/xterm-addon-image/fixture/growing_rect.js b/addons/addon-image/fixture/growing_rect.js similarity index 100% rename from addons/xterm-addon-image/fixture/growing_rect.js rename to addons/addon-image/fixture/growing_rect.js diff --git a/addons/xterm-addon-image/fixture/iip/palette.iip b/addons/addon-image/fixture/iip/palette.iip similarity index 100% rename from addons/xterm-addon-image/fixture/iip/palette.iip rename to addons/addon-image/fixture/iip/palette.iip diff --git a/addons/xterm-addon-image/fixture/iip/spinfox.iip b/addons/addon-image/fixture/iip/spinfox.iip similarity index 100% rename from addons/xterm-addon-image/fixture/iip/spinfox.iip rename to addons/addon-image/fixture/iip/spinfox.iip diff --git a/addons/xterm-addon-image/fixture/iip/w3c_gif.iip b/addons/addon-image/fixture/iip/w3c_gif.iip similarity index 100% rename from addons/xterm-addon-image/fixture/iip/w3c_gif.iip rename to addons/addon-image/fixture/iip/w3c_gif.iip diff --git a/addons/xterm-addon-image/fixture/iip/w3c_jpg.iip b/addons/addon-image/fixture/iip/w3c_jpg.iip similarity index 100% rename from addons/xterm-addon-image/fixture/iip/w3c_jpg.iip rename to addons/addon-image/fixture/iip/w3c_jpg.iip diff --git a/addons/xterm-addon-image/fixture/iip/w3c_png.iip b/addons/addon-image/fixture/iip/w3c_png.iip similarity index 100% rename from addons/xterm-addon-image/fixture/iip/w3c_png.iip rename to addons/addon-image/fixture/iip/w3c_png.iip diff --git a/addons/xterm-addon-image/fixture/inspect_palette.sh b/addons/addon-image/fixture/inspect_palette.sh old mode 100755 new mode 100644 similarity index 100% rename from addons/xterm-addon-image/fixture/inspect_palette.sh rename to addons/addon-image/fixture/inspect_palette.sh diff --git a/addons/xterm-addon-image/fixture/overdraw.sh b/addons/addon-image/fixture/overdraw.sh old mode 100755 new mode 100644 similarity index 100% rename from addons/xterm-addon-image/fixture/overdraw.sh rename to addons/addon-image/fixture/overdraw.sh diff --git a/addons/xterm-addon-image/fixture/palette.blob b/addons/addon-image/fixture/palette.blob similarity index 100% rename from addons/xterm-addon-image/fixture/palette.blob rename to addons/addon-image/fixture/palette.blob diff --git a/addons/xterm-addon-image/fixture/palette.png b/addons/addon-image/fixture/palette.png similarity index 100% rename from addons/xterm-addon-image/fixture/palette.png rename to addons/addon-image/fixture/palette.png diff --git a/addons/xterm-addon-image/fixture/palette.sixel b/addons/addon-image/fixture/palette.sixel similarity index 100% rename from addons/xterm-addon-image/fixture/palette.sixel rename to addons/addon-image/fixture/palette.sixel diff --git a/addons/xterm-addon-image/fixture/testimages/agfa-makernotes.jpg b/addons/addon-image/fixture/testimages/agfa-makernotes.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/agfa-makernotes.jpg rename to addons/addon-image/fixture/testimages/agfa-makernotes.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/iphone_hdr_YES.jpg b/addons/addon-image/fixture/testimages/iphone_hdr_YES.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/iphone_hdr_YES.jpg rename to addons/addon-image/fixture/testimages/iphone_hdr_YES.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/nikon-e950.jpg b/addons/addon-image/fixture/testimages/nikon-e950.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/nikon-e950.jpg rename to addons/addon-image/fixture/testimages/nikon-e950.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/sony-alpha-6000.jpg b/addons/addon-image/fixture/testimages/sony-alpha-6000.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/sony-alpha-6000.jpg rename to addons/addon-image/fixture/testimages/sony-alpha-6000.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/spinfox.png b/addons/addon-image/fixture/testimages/spinfox.png similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/spinfox.png rename to addons/addon-image/fixture/testimages/spinfox.png diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home.gif b/addons/addon-image/fixture/testimages/w3c_home.gif similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home.gif rename to addons/addon-image/fixture/testimages/w3c_home.gif diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home.jpg b/addons/addon-image/fixture/testimages/w3c_home.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home.jpg rename to addons/addon-image/fixture/testimages/w3c_home.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home.png b/addons/addon-image/fixture/testimages/w3c_home.png similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home.png rename to addons/addon-image/fixture/testimages/w3c_home.png diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_2.gif b/addons/addon-image/fixture/testimages/w3c_home_2.gif similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_2.gif rename to addons/addon-image/fixture/testimages/w3c_home_2.gif diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_2.jpg b/addons/addon-image/fixture/testimages/w3c_home_2.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_2.jpg rename to addons/addon-image/fixture/testimages/w3c_home_2.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_2.png b/addons/addon-image/fixture/testimages/w3c_home_2.png similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_2.png rename to addons/addon-image/fixture/testimages/w3c_home_2.png diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_256.gif b/addons/addon-image/fixture/testimages/w3c_home_256.gif similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_256.gif rename to addons/addon-image/fixture/testimages/w3c_home_256.gif diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_256.jpg b/addons/addon-image/fixture/testimages/w3c_home_256.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_256.jpg rename to addons/addon-image/fixture/testimages/w3c_home_256.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_256.png b/addons/addon-image/fixture/testimages/w3c_home_256.png similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_256.png rename to addons/addon-image/fixture/testimages/w3c_home_256.png diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_animation.gif b/addons/addon-image/fixture/testimages/w3c_home_animation.gif similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_animation.gif rename to addons/addon-image/fixture/testimages/w3c_home_animation.gif diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_gray.gif b/addons/addon-image/fixture/testimages/w3c_home_gray.gif similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_gray.gif rename to addons/addon-image/fixture/testimages/w3c_home_gray.gif diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_gray.jpg b/addons/addon-image/fixture/testimages/w3c_home_gray.jpg similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_gray.jpg rename to addons/addon-image/fixture/testimages/w3c_home_gray.jpg diff --git a/addons/xterm-addon-image/fixture/testimages/w3c_home_gray.png b/addons/addon-image/fixture/testimages/w3c_home_gray.png similarity index 100% rename from addons/xterm-addon-image/fixture/testimages/w3c_home_gray.png rename to addons/addon-image/fixture/testimages/w3c_home_gray.png diff --git a/addons/xterm-addon-image/fixture/textcursor.sh b/addons/addon-image/fixture/textcursor.sh old mode 100755 new mode 100644 similarity index 100% rename from addons/xterm-addon-image/fixture/textcursor.sh rename to addons/addon-image/fixture/textcursor.sh diff --git a/addons/xterm-addon-image/package.json b/addons/addon-image/package.json similarity index 80% rename from addons/xterm-addon-image/package.json rename to addons/addon-image/package.json index b07b5b6bd..4b0f8cdc4 100644 --- a/addons/xterm-addon-image/package.json +++ b/addons/addon-image/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-image", + "name": "@xterm/addon-image", "version": "0.6.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-image.js", - "types": "typings/xterm-addon-image.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-image", + "main": "lib/addon-image.js", + "types": "typings/addon-image.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-image", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-image/src/IIPHandler.ts b/addons/addon-image/src/IIPHandler.ts similarity index 100% rename from addons/xterm-addon-image/src/IIPHandler.ts rename to addons/addon-image/src/IIPHandler.ts diff --git a/addons/xterm-addon-image/src/IIPHeaderParser.test.ts b/addons/addon-image/src/IIPHeaderParser.test.ts similarity index 100% rename from addons/xterm-addon-image/src/IIPHeaderParser.test.ts rename to addons/addon-image/src/IIPHeaderParser.test.ts diff --git a/addons/xterm-addon-image/src/IIPHeaderParser.ts b/addons/addon-image/src/IIPHeaderParser.ts similarity index 100% rename from addons/xterm-addon-image/src/IIPHeaderParser.ts rename to addons/addon-image/src/IIPHeaderParser.ts diff --git a/addons/xterm-addon-image/src/IIPMetrics.test.ts b/addons/addon-image/src/IIPMetrics.test.ts similarity index 94% rename from addons/xterm-addon-image/src/IIPMetrics.test.ts rename to addons/addon-image/src/IIPMetrics.test.ts index 688d8d392..8ad5f05c8 100644 --- a/addons/xterm-addon-image/src/IIPMetrics.test.ts +++ b/addons/addon-image/src/IIPMetrics.test.ts @@ -36,7 +36,7 @@ const TEST_IMAGES: [string, IMetrics][] = [ describe('IIPMetrics', () => { it('bunch of testimages', () => { for (let i = 0; i < TEST_IMAGES.length; ++i) { - const imageData = fs.readFileSync('./addons/xterm-addon-image/fixture/testimages/' + TEST_IMAGES[i][0]); + const imageData = fs.readFileSync('./addons/addon-image/fixture/testimages/' + TEST_IMAGES[i][0]); assert.deepStrictEqual(imageType(imageData), TEST_IMAGES[i][1]); } }); diff --git a/addons/xterm-addon-image/src/IIPMetrics.ts b/addons/addon-image/src/IIPMetrics.ts similarity index 100% rename from addons/xterm-addon-image/src/IIPMetrics.ts rename to addons/addon-image/src/IIPMetrics.ts diff --git a/addons/xterm-addon-image/src/ImageAddon.ts b/addons/addon-image/src/ImageAddon.ts similarity index 100% rename from addons/xterm-addon-image/src/ImageAddon.ts rename to addons/addon-image/src/ImageAddon.ts diff --git a/addons/xterm-addon-image/src/ImageRenderer.ts b/addons/addon-image/src/ImageRenderer.ts similarity index 100% rename from addons/xterm-addon-image/src/ImageRenderer.ts rename to addons/addon-image/src/ImageRenderer.ts diff --git a/addons/xterm-addon-image/src/ImageStorage.ts b/addons/addon-image/src/ImageStorage.ts similarity index 100% rename from addons/xterm-addon-image/src/ImageStorage.ts rename to addons/addon-image/src/ImageStorage.ts diff --git a/addons/xterm-addon-image/src/SixelHandler.ts b/addons/addon-image/src/SixelHandler.ts similarity index 100% rename from addons/xterm-addon-image/src/SixelHandler.ts rename to addons/addon-image/src/SixelHandler.ts diff --git a/addons/xterm-addon-image/src/Types.d.ts b/addons/addon-image/src/Types.d.ts similarity index 100% rename from addons/xterm-addon-image/src/Types.d.ts rename to addons/addon-image/src/Types.d.ts diff --git a/addons/xterm-addon-image/src/tsconfig.json b/addons/addon-image/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-image/src/tsconfig.json rename to addons/addon-image/src/tsconfig.json diff --git a/addons/xterm-addon-image/test/ImageAddon.api.ts b/addons/addon-image/test/ImageAddon.api.ts similarity index 95% rename from addons/xterm-addon-image/test/ImageAddon.api.ts rename to addons/addon-image/test/ImageAddon.api.ts index 43334bbb0..776e96bfd 100644 --- a/addons/xterm-addon-image/test/ImageAddon.api.ts +++ b/addons/addon-image/test/ImageAddon.api.ts @@ -39,7 +39,7 @@ interface IDimensions { // image: 640 x 80, 512 color const TESTDATA: ITestData = (() => { - const data8 = readFileSync('./addons/xterm-addon-image/fixture/palette.blob'); + const data8 = readFileSync('./addons/addon-image/fixture/palette.blob'); const data32 = new Uint32Array(data8.buffer); const palette = new Set(); for (let i = 0; i < data32.length; ++i) palette.add(data32[i]); @@ -58,11 +58,11 @@ const SIXEL_SEQ_0 = introducer(0) + TESTDATA.sixel + FINALIZER; // NOTE: the data is loaded as string for easier transport through playwright const TESTDATA_IIP: [string, [number, number]][] = [ - [readFileSync('./addons/xterm-addon-image/fixture/iip/palette.iip', { encoding: 'utf-8' }), [640, 80]], - [readFileSync('./addons/xterm-addon-image/fixture/iip/spinfox.iip', { encoding: 'utf-8' }), [148, 148]], - [readFileSync('./addons/xterm-addon-image/fixture/iip/w3c_gif.iip', { encoding: 'utf-8' }), [72, 48]], - [readFileSync('./addons/xterm-addon-image/fixture/iip/w3c_jpg.iip', { encoding: 'utf-8' }), [72, 48]], - [readFileSync('./addons/xterm-addon-image/fixture/iip/w3c_png.iip', { encoding: 'utf-8' }), [72, 48]] + [readFileSync('./addons/addon-image/fixture/iip/palette.iip', { encoding: 'utf-8' }), [640, 80]], + [readFileSync('./addons/addon-image/fixture/iip/spinfox.iip', { encoding: 'utf-8' }), [148, 148]], + [readFileSync('./addons/addon-image/fixture/iip/w3c_gif.iip', { encoding: 'utf-8' }), [72, 48]], + [readFileSync('./addons/addon-image/fixture/iip/w3c_jpg.iip', { encoding: 'utf-8' }), [72, 48]], + [readFileSync('./addons/addon-image/fixture/iip/w3c_png.iip', { encoding: 'utf-8' }), [72, 48]] ]; describe('ImageAddon', () => { diff --git a/addons/xterm-addon-image/test/tsconfig.json b/addons/addon-image/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-image/test/tsconfig.json rename to addons/addon-image/test/tsconfig.json diff --git a/addons/xterm-addon-image/tsconfig.json b/addons/addon-image/tsconfig.json similarity index 100% rename from addons/xterm-addon-image/tsconfig.json rename to addons/addon-image/tsconfig.json diff --git a/addons/xterm-addon-image/typings/xterm-addon-image.d.ts b/addons/addon-image/typings/addon-image.d.ts similarity index 99% rename from addons/xterm-addon-image/typings/xterm-addon-image.d.ts rename to addons/addon-image/typings/addon-image.d.ts index 608eb9fdb..48ba488cf 100644 --- a/addons/xterm-addon-image/typings/xterm-addon-image.d.ts +++ b/addons/addon-image/typings/addon-image.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-image' { +declare module '@xterm/addon-image' { export interface IImageAddonOptions { /** * Enable size reports in windowOptions: diff --git a/addons/xterm-addon-image/webpack.config.js b/addons/addon-image/webpack.config.js similarity index 93% rename from addons/xterm-addon-image/webpack.config.js rename to addons/addon-image/webpack.config.js index fff66bec5..bcd52db2d 100644 --- a/addons/xterm-addon-image/webpack.config.js +++ b/addons/addon-image/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'ImageAddon'; -const mainFile = 'xterm-addon-image.js'; +const mainFile = 'addon-image.js'; const addon = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-ligatures/.gitignore b/addons/addon-ligatures/.gitignore similarity index 100% rename from addons/xterm-addon-ligatures/.gitignore rename to addons/addon-ligatures/.gitignore diff --git a/addons/xterm-addon-ligatures/.npmignore b/addons/addon-ligatures/.npmignore similarity index 100% rename from addons/xterm-addon-ligatures/.npmignore rename to addons/addon-ligatures/.npmignore diff --git a/addons/xterm-addon-ligatures/LICENSE b/addons/addon-ligatures/LICENSE similarity index 100% rename from addons/xterm-addon-ligatures/LICENSE rename to addons/addon-ligatures/LICENSE diff --git a/addons/xterm-addon-ligatures/README.md b/addons/addon-ligatures/README.md similarity index 95% rename from addons/xterm-addon-ligatures/README.md rename to addons/addon-ligatures/README.md index 1c14976b0..3b5521e0d 100644 --- a/addons/xterm-addon-ligatures/README.md +++ b/addons/addon-ligatures/README.md @@ -1,4 +1,4 @@ -## xterm-addon-ligatures +## @xterm/addon-ligatures Add support for programming ligatures to [xterm.js] when running in environments with access to [Node.js] APIs (such as [Electron]). @@ -10,14 +10,14 @@ Add support for programming ligatures to [xterm.js] when running in environments ### Install ```bash -npm install --save xterm-addon-ligatures +npm install --save @xterm/addon-ligatures ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { LigaturesAddon } from 'xterm-addon-ligatures'; +import { LigaturesAddon } from '@xterm/addon-ligatures'; const terminal = new Terminal(); const ligaturesAddon = new LigaturesAddon(); diff --git a/addons/xterm-addon-ligatures/bin/download-fonts.js b/addons/addon-ligatures/bin/download-fonts.js similarity index 100% rename from addons/xterm-addon-ligatures/bin/download-fonts.js rename to addons/addon-ligatures/bin/download-fonts.js diff --git a/addons/xterm-addon-ligatures/package.json b/addons/addon-ligatures/package.json similarity index 86% rename from addons/xterm-addon-ligatures/package.json rename to addons/addon-ligatures/package.json index 57c0cd565..c62f9e08a 100644 --- a/addons/xterm-addon-ligatures/package.json +++ b/addons/addon-ligatures/package.json @@ -1,14 +1,14 @@ { - "name": "xterm-addon-ligatures", + "name": "@xterm/addon-ligatures", "version": "0.7.0", "description": "Add support for programming ligatures to xterm.js", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-ligatures.js", - "types": "typings/xterm-addon-ligatures.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-ligatures", + "main": "lib/addon-ligatures.js", + "types": "typings/addon-ligatures.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-ligatures", "engines": { "node": ">8.0.0" }, diff --git a/addons/xterm-addon-ligatures/src/LigaturesAddon.ts b/addons/addon-ligatures/src/LigaturesAddon.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/LigaturesAddon.ts rename to addons/addon-ligatures/src/LigaturesAddon.ts diff --git a/addons/xterm-addon-ligatures/src/Types.d.ts b/addons/addon-ligatures/src/Types.d.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/Types.d.ts rename to addons/addon-ligatures/src/Types.d.ts diff --git a/addons/xterm-addon-ligatures/src/font.ts b/addons/addon-ligatures/src/font.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/font.ts rename to addons/addon-ligatures/src/font.ts diff --git a/addons/xterm-addon-ligatures/src/index.test.ts b/addons/addon-ligatures/src/index.test.ts similarity index 99% rename from addons/xterm-addon-ligatures/src/index.test.ts rename to addons/addon-ligatures/src/index.test.ts index c7bf09cef..c6aead98a 100644 --- a/addons/xterm-addon-ligatures/src/index.test.ts +++ b/addons/addon-ligatures/src/index.test.ts @@ -11,7 +11,7 @@ import * as fontLigatures from 'font-ligatures'; import * as ligatureSupport from '.'; -describe('xterm-addon-ligatures', () => { +describe('LigaturesAddon', () => { let onRefresh: sinon.SinonStub; let term: MockTerminal; diff --git a/addons/xterm-addon-ligatures/src/index.ts b/addons/addon-ligatures/src/index.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/index.ts rename to addons/addon-ligatures/src/index.ts diff --git a/addons/xterm-addon-ligatures/src/parse.test.ts b/addons/addon-ligatures/src/parse.test.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/parse.test.ts rename to addons/addon-ligatures/src/parse.test.ts diff --git a/addons/xterm-addon-ligatures/src/parse.ts b/addons/addon-ligatures/src/parse.ts similarity index 100% rename from addons/xterm-addon-ligatures/src/parse.ts rename to addons/addon-ligatures/src/parse.ts diff --git a/addons/xterm-addon-ligatures/src/tsconfig.json b/addons/addon-ligatures/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-ligatures/src/tsconfig.json rename to addons/addon-ligatures/src/tsconfig.json diff --git a/addons/xterm-addon-ligatures/tsconfig.json b/addons/addon-ligatures/tsconfig.json similarity index 100% rename from addons/xterm-addon-ligatures/tsconfig.json rename to addons/addon-ligatures/tsconfig.json diff --git a/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts b/addons/addon-ligatures/typings/addon-ligatures.d.ts similarity index 92% rename from addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts rename to addons/addon-ligatures/typings/addon-ligatures.d.ts index 2b967a331..2fd4f3e74 100644 --- a/addons/xterm-addon-ligatures/typings/xterm-addon-ligatures.d.ts +++ b/addons/addon-ligatures/typings/addon-ligatures.d.ts @@ -2,7 +2,7 @@ * Copyright (c) 2018 The xterm.js authors. All rights reserved. * @license MIT * - * This contains the type declarations for the xterm-addon-ligatures library. + * This contains the type declarations for the @xterm/addon-ligatures library. * Note that some interfaces may differ between this file and the actual * implementation in src/, that's because this file declares the *public* API * which is intended to be stable and consumed by external programs. @@ -10,7 +10,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-ligatures' { +declare module '@xterm/addon-ligatures' { /** * An xterm.js addon that enables web links. */ diff --git a/addons/xterm-addon-ligatures/webpack.config.js b/addons/addon-ligatures/webpack.config.js similarity index 95% rename from addons/xterm-addon-ligatures/webpack.config.js rename to addons/addon-ligatures/webpack.config.js index 5aeebe2e9..6ec7f42d0 100644 --- a/addons/xterm-addon-ligatures/webpack.config.js +++ b/addons/addon-ligatures/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'LigaturesAddon'; -const mainFile = 'xterm-addon-ligatures.js'; +const mainFile = 'addon-ligatures.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-ligatures/yarn.lock b/addons/addon-ligatures/yarn.lock similarity index 100% rename from addons/xterm-addon-ligatures/yarn.lock rename to addons/addon-ligatures/yarn.lock diff --git a/addons/xterm-addon-search/.gitignore b/addons/addon-search/.gitignore similarity index 100% rename from addons/xterm-addon-search/.gitignore rename to addons/addon-search/.gitignore diff --git a/addons/xterm-addon-search/.npmignore b/addons/addon-search/.npmignore similarity index 100% rename from addons/xterm-addon-search/.npmignore rename to addons/addon-search/.npmignore diff --git a/addons/xterm-addon-search/LICENSE b/addons/addon-search/LICENSE similarity index 100% rename from addons/xterm-addon-search/LICENSE rename to addons/addon-search/LICENSE diff --git a/addons/xterm-addon-search/README.md b/addons/addon-search/README.md similarity index 68% rename from addons/xterm-addon-search/README.md rename to addons/addon-search/README.md index 51ce20b4b..fab0b03f5 100644 --- a/addons/xterm-addon-search/README.md +++ b/addons/addon-search/README.md @@ -1,18 +1,18 @@ -## xterm-addon-search +## @xterm/addon-search An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables searching the buffer. This addon requires xterm.js v4+. ### Install ```bash -npm install --save xterm-addon-search +npm install --save @xterm/addon-search ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { SearchAddon } from 'xterm-addon-search'; +import { SearchAddon } from '@xterm/addon-search'; const terminal = new Terminal(); const searchAddon = new SearchAddon(); @@ -20,4 +20,4 @@ terminal.loadAddon(searchAddon); searchAddon.findNext('foo'); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-search/typings/xterm-addon-search.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-search/typings/addon-search.d.ts) for more advanced usage. diff --git a/addons/xterm-addon-search/fixtures/issue-2444 b/addons/addon-search/fixtures/issue-2444 similarity index 100% rename from addons/xterm-addon-search/fixtures/issue-2444 rename to addons/addon-search/fixtures/issue-2444 diff --git a/addons/xterm-addon-search/package.json b/addons/addon-search/package.json similarity index 77% rename from addons/xterm-addon-search/package.json rename to addons/addon-search/package.json index f846874df..9fab82afb 100644 --- a/addons/xterm-addon-search/package.json +++ b/addons/addon-search/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-search", + "name": "@xterm/addon-search", "version": "0.13.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-search.js", - "types": "typings/xterm-addon-search.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-search", + "main": "lib/addon-search.js", + "types": "typings/addon-search.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-search", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/addon-search/src/SearchAddon.ts similarity index 100% rename from addons/xterm-addon-search/src/SearchAddon.ts rename to addons/addon-search/src/SearchAddon.ts diff --git a/addons/xterm-addon-search/src/tsconfig.json b/addons/addon-search/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-search/src/tsconfig.json rename to addons/addon-search/src/tsconfig.json diff --git a/addons/xterm-addon-search/test/SearchAddon.api.ts b/addons/addon-search/test/SearchAddon.api.ts similarity index 100% rename from addons/xterm-addon-search/test/SearchAddon.api.ts rename to addons/addon-search/test/SearchAddon.api.ts diff --git a/addons/xterm-addon-search/test/tsconfig.json b/addons/addon-search/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-search/test/tsconfig.json rename to addons/addon-search/test/tsconfig.json diff --git a/addons/xterm-addon-search/tsconfig.json b/addons/addon-search/tsconfig.json similarity index 100% rename from addons/xterm-addon-search/tsconfig.json rename to addons/addon-search/tsconfig.json diff --git a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts b/addons/addon-search/typings/addon-search.d.ts similarity index 98% rename from addons/xterm-addon-search/typings/xterm-addon-search.d.ts rename to addons/addon-search/typings/addon-search.d.ts index c3774bf51..282004a2a 100644 --- a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts +++ b/addons/addon-search/typings/addon-search.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm'; -declare module 'xterm-addon-search' { +declare module '@xterm/addon-search' { /** * Options for a search. */ diff --git a/addons/xterm-addon-search/webpack.config.js b/addons/addon-search/webpack.config.js similarity index 94% rename from addons/xterm-addon-search/webpack.config.js rename to addons/addon-search/webpack.config.js index 30526812e..a770f93f5 100644 --- a/addons/xterm-addon-search/webpack.config.js +++ b/addons/addon-search/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'SearchAddon'; -const mainFile = 'xterm-addon-search.js'; +const mainFile = 'addon-search.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-serialize/.gitignore b/addons/addon-serialize/.gitignore similarity index 100% rename from addons/xterm-addon-serialize/.gitignore rename to addons/addon-serialize/.gitignore diff --git a/addons/xterm-addon-serialize/.npmignore b/addons/addon-serialize/.npmignore similarity index 100% rename from addons/xterm-addon-serialize/.npmignore rename to addons/addon-serialize/.npmignore diff --git a/addons/xterm-addon-serialize/README.md b/addons/addon-serialize/README.md similarity index 74% rename from addons/xterm-addon-serialize/README.md rename to addons/addon-serialize/README.md index 12e0ac876..f01168935 100644 --- a/addons/xterm-addon-serialize/README.md +++ b/addons/addon-serialize/README.md @@ -1,4 +1,4 @@ -## xterm-addon-serialize +## @xterm/addon-serialize An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables xterm.js to serialize a terminal framebuffer into string or html. This addon requires xterm.js v4+. @@ -7,14 +7,14 @@ An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables xterm. ### Install ```bash -npm install --save xterm-addon-serialize +npm install --save @xterm/addon-serialize ``` ### Usage ```ts import { Terminal } from "xterm"; -import { SerializeAddon } from "xterm-addon-serialize"; +import { SerializeAddon } from "@xterm/addon-serialize"; const terminal = new Terminal(); const serializeAddon = new SerializeAddon(); @@ -25,7 +25,7 @@ terminal.write("something...", () => { }); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-serialize/typings/addon-serialize.d.ts) for more advanced usage. ### Benchmark @@ -35,8 +35,8 @@ See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm- $ git clone https://github.com/xtermjs/xterm.js.git $ cd xterm.js $ yarn -$ cd addons/xterm-addon-serialize +$ cd addons/addon-serialize $ yarn benchmark && yarn benchmark-baseline -$ # change some code in `xterm-addon-serialize` +$ # change some code in `@xterm/addon-serialize` $ yarn benchmark-eval ``` diff --git a/addons/xterm-addon-serialize/benchmark/SerializeAddon.benchmark.ts b/addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts similarity index 100% rename from addons/xterm-addon-serialize/benchmark/SerializeAddon.benchmark.ts rename to addons/addon-serialize/benchmark/SerializeAddon.benchmark.ts diff --git a/addons/xterm-addon-serialize/benchmark/benchmark.json b/addons/addon-serialize/benchmark/benchmark.json similarity index 100% rename from addons/xterm-addon-serialize/benchmark/benchmark.json rename to addons/addon-serialize/benchmark/benchmark.json diff --git a/addons/xterm-addon-serialize/benchmark/tsconfig.json b/addons/addon-serialize/benchmark/tsconfig.json similarity index 100% rename from addons/xterm-addon-serialize/benchmark/tsconfig.json rename to addons/addon-serialize/benchmark/tsconfig.json diff --git a/addons/xterm-addon-serialize/package.json b/addons/addon-serialize/package.json similarity index 86% rename from addons/xterm-addon-serialize/package.json rename to addons/addon-serialize/package.json index 8f9148659..c95bc5312 100644 --- a/addons/xterm-addon-serialize/package.json +++ b/addons/addon-serialize/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-serialize", + "name": "@xterm/addon-serialize", "version": "0.11.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-serialize.js", - "types": "typings/xterm-addon-serialize.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-serialize", + "main": "lib/addon-serialize.js", + "types": "typings/addon-serialize.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-serialize", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.test.ts b/addons/addon-serialize/src/SerializeAddon.test.ts similarity index 99% rename from addons/xterm-addon-serialize/src/SerializeAddon.test.ts rename to addons/addon-serialize/src/SerializeAddon.test.ts index 75148ab9c..d41cfa12e 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.test.ts +++ b/addons/addon-serialize/src/SerializeAddon.test.ts @@ -44,7 +44,7 @@ class TestSelectionService { } } -describe('xterm-addon-serialize', () => { +describe('SerializeAddon', () => { let dom: jsdom.JSDOM; let window: jsdom.DOMWindow; diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.ts b/addons/addon-serialize/src/SerializeAddon.ts similarity index 100% rename from addons/xterm-addon-serialize/src/SerializeAddon.ts rename to addons/addon-serialize/src/SerializeAddon.ts diff --git a/addons/xterm-addon-serialize/src/tsconfig.json b/addons/addon-serialize/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-serialize/src/tsconfig.json rename to addons/addon-serialize/src/tsconfig.json diff --git a/addons/xterm-addon-serialize/test/SerializeAddon.api.ts b/addons/addon-serialize/test/SerializeAddon.api.ts similarity index 100% rename from addons/xterm-addon-serialize/test/SerializeAddon.api.ts rename to addons/addon-serialize/test/SerializeAddon.api.ts diff --git a/addons/xterm-addon-serialize/test/tsconfig.json b/addons/addon-serialize/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-serialize/test/tsconfig.json rename to addons/addon-serialize/test/tsconfig.json diff --git a/addons/xterm-addon-serialize/tsconfig.json b/addons/addon-serialize/tsconfig.json similarity index 100% rename from addons/xterm-addon-serialize/tsconfig.json rename to addons/addon-serialize/tsconfig.json diff --git a/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts b/addons/addon-serialize/typings/addon-serialize.d.ts similarity index 98% rename from addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts rename to addons/addon-serialize/typings/addon-serialize.d.ts index a675cd14b..0b127b506 100644 --- a/addons/xterm-addon-serialize/typings/xterm-addon-serialize.d.ts +++ b/addons/addon-serialize/typings/addon-serialize.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-serialize' { +declare module '@xterm/addon-serialize' { /** * An xterm.js addon that enables serialization of terminal contents. */ diff --git a/addons/xterm-addon-serialize/webpack.config.js b/addons/addon-serialize/webpack.config.js similarity index 94% rename from addons/xterm-addon-serialize/webpack.config.js rename to addons/addon-serialize/webpack.config.js index fee297d85..bd08ca374 100644 --- a/addons/xterm-addon-serialize/webpack.config.js +++ b/addons/addon-serialize/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'SerializeAddon'; -const mainFile = 'xterm-addon-serialize.js'; +const mainFile = 'addon-serialize.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-unicode-graphemes/.gitignore b/addons/addon-unicode-graphemes/.gitignore similarity index 100% rename from addons/xterm-addon-unicode-graphemes/.gitignore rename to addons/addon-unicode-graphemes/.gitignore diff --git a/addons/xterm-addon-unicode-graphemes/.npmignore b/addons/addon-unicode-graphemes/.npmignore similarity index 100% rename from addons/xterm-addon-unicode-graphemes/.npmignore rename to addons/addon-unicode-graphemes/.npmignore diff --git a/addons/xterm-addon-unicode-graphemes/LICENSE b/addons/addon-unicode-graphemes/LICENSE similarity index 100% rename from addons/xterm-addon-unicode-graphemes/LICENSE rename to addons/addon-unicode-graphemes/LICENSE diff --git a/addons/xterm-addon-unicode-graphemes/README.md b/addons/addon-unicode-graphemes/README.md similarity index 86% rename from addons/xterm-addon-unicode-graphemes/README.md rename to addons/addon-unicode-graphemes/README.md index 1f03e4e9b..6e717c269 100644 --- a/addons/xterm-addon-unicode-graphemes/README.md +++ b/addons/addon-unicode-graphemes/README.md @@ -1,4 +1,4 @@ -## xterm-addon-unicode-graphemes +## @xterm/addon-unicode-graphemes ⚠️ **This addon is currently experimental and may introduce unexpected and non-standard behavior** @@ -14,7 +14,7 @@ This addon is not yet published to npm ```ts import { Terminal } from '@xterm/xterm'; -import { UnicodeGraphemesAddon } from 'xterm-addon-unicode-graphemes'; +import { UnicodeGraphemesAddon } from '@xterm/addon-unicode-graphemes'; const terminal = new Terminal(); const unicodeGraphemesAddon = new UnicodeGraphemesAddon(); diff --git a/addons/xterm-addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts b/addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts rename to addons/addon-unicode-graphemes/benchmark/UnicodeGraphemeAddon.benchmark.ts diff --git a/addons/xterm-addon-unicode-graphemes/benchmark/benchmark.json b/addons/addon-unicode-graphemes/benchmark/benchmark.json similarity index 100% rename from addons/xterm-addon-unicode-graphemes/benchmark/benchmark.json rename to addons/addon-unicode-graphemes/benchmark/benchmark.json diff --git a/addons/xterm-addon-unicode-graphemes/benchmark/tsconfig.json b/addons/addon-unicode-graphemes/benchmark/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode-graphemes/benchmark/tsconfig.json rename to addons/addon-unicode-graphemes/benchmark/tsconfig.json diff --git a/addons/xterm-addon-unicode-graphemes/package.json b/addons/addon-unicode-graphemes/package.json similarity index 84% rename from addons/xterm-addon-unicode-graphemes/package.json rename to addons/addon-unicode-graphemes/package.json index 38ea7271f..5e270025c 100644 --- a/addons/xterm-addon-unicode-graphemes/package.json +++ b/addons/addon-unicode-graphemes/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-unicode-graphemes", + "name": "@xterm/addon-unicode-graphemes", "version": "0.1.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-unicode-graphemes.js", - "types": "typings/xterm-addon-unicode-graphemes.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-unicode-graphemes", + "main": "lib/addon-unicode-graphemes.js", + "types": "typings/addon-unicode-graphemes.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-unicode-graphemes", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts b/addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts rename to addons/addon-unicode-graphemes/src/UnicodeGraphemeProvider.ts diff --git a/addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts b/addons/addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts rename to addons/addon-unicode-graphemes/src/UnicodeGraphemesAddon.ts diff --git a/addons/xterm-addon-unicode-graphemes/src/third-party/UnicodeProperties.ts b/addons/addon-unicode-graphemes/src/third-party/UnicodeProperties.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/third-party/UnicodeProperties.ts rename to addons/addon-unicode-graphemes/src/third-party/UnicodeProperties.ts diff --git a/addons/xterm-addon-unicode-graphemes/src/third-party/tiny-inflate.ts b/addons/addon-unicode-graphemes/src/third-party/tiny-inflate.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/third-party/tiny-inflate.ts rename to addons/addon-unicode-graphemes/src/third-party/tiny-inflate.ts diff --git a/addons/xterm-addon-unicode-graphemes/src/third-party/unicode-trie.ts b/addons/addon-unicode-graphemes/src/third-party/unicode-trie.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/third-party/unicode-trie.ts rename to addons/addon-unicode-graphemes/src/third-party/unicode-trie.ts diff --git a/addons/xterm-addon-unicode-graphemes/src/tsconfig.json b/addons/addon-unicode-graphemes/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode-graphemes/src/tsconfig.json rename to addons/addon-unicode-graphemes/src/tsconfig.json diff --git a/addons/xterm-addon-unicode-graphemes/test/UnicodeGraphemesAddon.api.ts b/addons/addon-unicode-graphemes/test/UnicodeGraphemesAddon.api.ts similarity index 100% rename from addons/xterm-addon-unicode-graphemes/test/UnicodeGraphemesAddon.api.ts rename to addons/addon-unicode-graphemes/test/UnicodeGraphemesAddon.api.ts diff --git a/addons/xterm-addon-unicode-graphemes/test/tsconfig.json b/addons/addon-unicode-graphemes/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode-graphemes/test/tsconfig.json rename to addons/addon-unicode-graphemes/test/tsconfig.json diff --git a/addons/xterm-addon-unicode-graphemes/tsconfig.json b/addons/addon-unicode-graphemes/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode-graphemes/tsconfig.json rename to addons/addon-unicode-graphemes/tsconfig.json diff --git a/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts b/addons/addon-unicode-graphemes/typings/addon-unicode-graphemes.d.ts similarity index 86% rename from addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts rename to addons/addon-unicode-graphemes/typings/addon-unicode-graphemes.d.ts index 3a6a95905..9443f1c88 100644 --- a/addons/xterm-addon-unicode-graphemes/typings/xterm-addon-unicode-graphemes.d.ts +++ b/addons/addon-unicode-graphemes/typings/addon-unicode-graphemes.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-unicode-graphemes' { +declare module '@xterm/addon-unicode-graphemes' { export class UnicodeGraphemesAddon implements ITerminalAddon { constructor(); public activate(terminal: Terminal): void; diff --git a/addons/xterm-addon-unicode-graphemes/webpack.config.js b/addons/addon-unicode-graphemes/webpack.config.js similarity index 92% rename from addons/xterm-addon-unicode-graphemes/webpack.config.js rename to addons/addon-unicode-graphemes/webpack.config.js index 89abf53aa..6a80bdea6 100644 --- a/addons/xterm-addon-unicode-graphemes/webpack.config.js +++ b/addons/addon-unicode-graphemes/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'UnicodeGraphemesAddon'; -const mainFile = 'xterm-addon-unicode-graphemes.js'; +const mainFile = 'addon-unicode-graphemes.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-unicode11/.gitignore b/addons/addon-unicode11/.gitignore similarity index 100% rename from addons/xterm-addon-unicode11/.gitignore rename to addons/addon-unicode11/.gitignore diff --git a/addons/xterm-addon-unicode11/.npmignore b/addons/addon-unicode11/.npmignore similarity index 100% rename from addons/xterm-addon-unicode11/.npmignore rename to addons/addon-unicode11/.npmignore diff --git a/addons/xterm-addon-unicode11/LICENSE b/addons/addon-unicode11/LICENSE similarity index 100% rename from addons/xterm-addon-unicode11/LICENSE rename to addons/addon-unicode11/LICENSE diff --git a/addons/xterm-addon-unicode11/README.md b/addons/addon-unicode11/README.md similarity index 72% rename from addons/xterm-addon-unicode11/README.md rename to addons/addon-unicode11/README.md index 52c2e0d91..ccfe77cf7 100644 --- a/addons/xterm-addon-unicode11/README.md +++ b/addons/addon-unicode11/README.md @@ -1,18 +1,18 @@ -## xterm-addon-unicode11 +## @xterm/addon-unicode11 An addon providing Unicode version 11 rules for xterm.js. ### Install ```bash -npm install --save xterm-addon-unicode11 +npm install --save @xterm/addon-unicode11 ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { Unicode11Addon } from 'xterm-addon-unicode11'; +import { Unicode11Addon } from '@xterm/addon-unicode11'; const terminal = new Terminal(); const unicode11Addon = new Unicode11Addon(); diff --git a/addons/xterm-addon-unicode11/package.json b/addons/addon-unicode11/package.json similarity index 76% rename from addons/xterm-addon-unicode11/package.json rename to addons/addon-unicode11/package.json index d187d8edc..b54f9ab4a 100644 --- a/addons/xterm-addon-unicode11/package.json +++ b/addons/addon-unicode11/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-unicode11", + "name": "@xterm/addon-unicode11", "version": "0.6.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-unicode11.js", - "types": "typings/xterm-addon-unicode11.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-unicode11", + "main": "lib/addon-unicode11.js", + "types": "typings/addon-unicode11.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-unicode11", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.ts b/addons/addon-unicode11/src/Unicode11Addon.ts similarity index 100% rename from addons/xterm-addon-unicode11/src/Unicode11Addon.ts rename to addons/addon-unicode11/src/Unicode11Addon.ts diff --git a/addons/xterm-addon-unicode11/src/UnicodeV11.ts b/addons/addon-unicode11/src/UnicodeV11.ts similarity index 100% rename from addons/xterm-addon-unicode11/src/UnicodeV11.ts rename to addons/addon-unicode11/src/UnicodeV11.ts diff --git a/addons/xterm-addon-unicode11/src/tsconfig.json b/addons/addon-unicode11/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode11/src/tsconfig.json rename to addons/addon-unicode11/src/tsconfig.json diff --git a/addons/xterm-addon-unicode11/test/Unicode11Addon.api.ts b/addons/addon-unicode11/test/Unicode11Addon.api.ts similarity index 100% rename from addons/xterm-addon-unicode11/test/Unicode11Addon.api.ts rename to addons/addon-unicode11/test/Unicode11Addon.api.ts diff --git a/addons/xterm-addon-unicode11/test/tsconfig.json b/addons/addon-unicode11/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode11/test/tsconfig.json rename to addons/addon-unicode11/test/tsconfig.json diff --git a/addons/xterm-addon-unicode11/tsconfig.json b/addons/addon-unicode11/tsconfig.json similarity index 100% rename from addons/xterm-addon-unicode11/tsconfig.json rename to addons/addon-unicode11/tsconfig.json diff --git a/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts b/addons/addon-unicode11/typings/addon-unicode11.d.ts similarity index 87% rename from addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts rename to addons/addon-unicode11/typings/addon-unicode11.d.ts index 2525dc23b..74bd288dd 100644 --- a/addons/xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts +++ b/addons/addon-unicode11/typings/addon-unicode11.d.ts @@ -5,7 +5,7 @@ import { Terminal, ITerminalAddon } from '@xterm/xterm'; -declare module 'xterm-addon-unicode11' { +declare module '@xterm/addon-unicode11' { export class Unicode11Addon implements ITerminalAddon { constructor(); public activate(terminal: Terminal): void; diff --git a/addons/xterm-addon-unicode11/webpack.config.js b/addons/addon-unicode11/webpack.config.js similarity index 94% rename from addons/xterm-addon-unicode11/webpack.config.js rename to addons/addon-unicode11/webpack.config.js index 10c0adc3c..1913481d2 100644 --- a/addons/xterm-addon-unicode11/webpack.config.js +++ b/addons/addon-unicode11/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'Unicode11Addon'; -const mainFile = 'xterm-addon-unicode11.js'; +const mainFile = 'addon-unicode11.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/xterm-addon-web-links/.gitignore b/addons/addon-web-links/.gitignore similarity index 100% rename from addons/xterm-addon-web-links/.gitignore rename to addons/addon-web-links/.gitignore diff --git a/addons/xterm-addon-web-links/.npmignore b/addons/addon-web-links/.npmignore similarity index 100% rename from addons/xterm-addon-web-links/.npmignore rename to addons/addon-web-links/.npmignore diff --git a/addons/xterm-addon-web-links/LICENSE b/addons/addon-web-links/LICENSE similarity index 100% rename from addons/xterm-addon-web-links/LICENSE rename to addons/addon-web-links/LICENSE diff --git a/addons/xterm-addon-web-links/README.md b/addons/addon-web-links/README.md similarity index 61% rename from addons/xterm-addon-web-links/README.md rename to addons/addon-web-links/README.md index 323c1f01d..16dfa5718 100644 --- a/addons/xterm-addon-web-links/README.md +++ b/addons/addon-web-links/README.md @@ -1,21 +1,21 @@ -## xterm-addon-web-links +## @xterm/addon-web-links An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables web links. This addon requires xterm.js v4+. ### Install ```bash -npm install --save xterm-addon-web-links +npm install --save @xterm/addon-web-links ``` ### Usage ```ts import { Terminal } from '@xterm/xterm'; -import { WebLinksAddon } from 'xterm-addon-web-links'; +import { WebLinksAddon } from '@xterm/addon-web-links'; const terminal = new Terminal(); terminal.loadAddon(new WebLinksAddon()); ``` -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts) for more advanced usage. +See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-web-links/typings/addon-web-links.d.ts) for more advanced usage. diff --git a/addons/xterm-addon-web-links/package.json b/addons/addon-web-links/package.json similarity index 76% rename from addons/xterm-addon-web-links/package.json rename to addons/addon-web-links/package.json index 783ee7e01..e1d60b022 100644 --- a/addons/xterm-addon-web-links/package.json +++ b/addons/addon-web-links/package.json @@ -1,13 +1,13 @@ { - "name": "xterm-addon-web-links", + "name": "@xterm/addon-web-links", "version": "0.9.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" }, - "main": "lib/xterm-addon-web-links.js", - "types": "typings/xterm-addon-web-links.d.ts", - "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-web-links", + "main": "lib/addon-web-links.js", + "types": "typings/addon-web-links.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-web-links", "license": "MIT", "keywords": [ "terminal", diff --git a/addons/xterm-addon-web-links/src/WebLinkProvider.ts b/addons/addon-web-links/src/WebLinkProvider.ts similarity index 100% rename from addons/xterm-addon-web-links/src/WebLinkProvider.ts rename to addons/addon-web-links/src/WebLinkProvider.ts diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.ts b/addons/addon-web-links/src/WebLinksAddon.ts similarity index 100% rename from addons/xterm-addon-web-links/src/WebLinksAddon.ts rename to addons/addon-web-links/src/WebLinksAddon.ts diff --git a/addons/xterm-addon-web-links/src/tsconfig.json b/addons/addon-web-links/src/tsconfig.json similarity index 100% rename from addons/xterm-addon-web-links/src/tsconfig.json rename to addons/addon-web-links/src/tsconfig.json diff --git a/addons/xterm-addon-web-links/test/WebLinksAddon.api.ts b/addons/addon-web-links/test/WebLinksAddon.api.ts similarity index 100% rename from addons/xterm-addon-web-links/test/WebLinksAddon.api.ts rename to addons/addon-web-links/test/WebLinksAddon.api.ts diff --git a/addons/xterm-addon-web-links/test/tsconfig.json b/addons/addon-web-links/test/tsconfig.json similarity index 100% rename from addons/xterm-addon-web-links/test/tsconfig.json rename to addons/addon-web-links/test/tsconfig.json diff --git a/addons/xterm-addon-web-links/tsconfig.json b/addons/addon-web-links/tsconfig.json similarity index 100% rename from addons/xterm-addon-web-links/tsconfig.json rename to addons/addon-web-links/tsconfig.json diff --git a/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts b/addons/addon-web-links/typings/addon-web-links.d.ts similarity index 97% rename from addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts rename to addons/addon-web-links/typings/addon-web-links.d.ts index 11e6ffb28..4ae4934ef 100644 --- a/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts +++ b/addons/addon-web-links/typings/addon-web-links.d.ts @@ -6,7 +6,7 @@ import { Terminal, ITerminalAddon, IViewportRange } from '@xterm/xterm'; -declare module 'xterm-addon-web-links' { +declare module '@xterm/addon-web-links' { /** * An xterm.js addon that enables web links. */ diff --git a/addons/xterm-addon-web-links/webpack.config.js b/addons/addon-web-links/webpack.config.js similarity index 92% rename from addons/xterm-addon-web-links/webpack.config.js rename to addons/addon-web-links/webpack.config.js index fd87d07e8..4484dbf60 100644 --- a/addons/xterm-addon-web-links/webpack.config.js +++ b/addons/addon-web-links/webpack.config.js @@ -6,7 +6,7 @@ const path = require('path'); const addonName = 'WebLinksAddon'; -const mainFile = 'xterm-addon-web-links.js'; +const mainFile = 'addon-web-links.js'; module.exports = { entry: `./out/${addonName}.js`, diff --git a/addons/addon-webgl/README.md b/addons/addon-webgl/README.md index f944a17eb..05d753e86 100644 --- a/addons/addon-webgl/README.md +++ b/addons/addon-webgl/README.md @@ -38,4 +38,4 @@ Read more about handling WebGL context losses on the [Khronos wiki](https://www. ### See also -- [xterm-addon-canvas](https://www.npmjs.com/package/xterm-addon-canvas) A renderer for xterm.js that uses a 2d canvas that can be used as a fallback when WebGL is not available +- [@xterm/addon-canvas](https://www.npmjs.com/package/@xterm/addon-canvas) A renderer for xterm.js that uses a 2d canvas that can be used as a fallback when WebGL is not available diff --git a/addons/xterm-addon-canvas/README.md b/addons/xterm-addon-canvas/README.md deleted file mode 100644 index 6d24c592d..000000000 --- a/addons/xterm-addon-canvas/README.md +++ /dev/null @@ -1,28 +0,0 @@ -## xterm-addon-canvas - -An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a canvas-based renderer using a 2d context to draw. This addon requires xterm.js v5+. - -The purpose of this addon is to be used as a fallback for the [webgl addon](https://www.npmjs.com/package/xterm-addon-webgl) when better performance is desired over the default DOM renderer, but WebGL2 isn't supported or performant for some reason. - -### Install - -```bash -npm install --save xterm-addon-canvas -``` - -### Usage - -```ts -import { Terminal } from '@xterm/xterm'; -import { CanvasAddon } from 'xterm-addon-canvas'; - -const terminal = new Terminal(); -terminal.open(element); -terminal.loadAddon(new CanvasAddon()); -``` - -See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-canvas/typings/xterm-addon-canvas.d.ts) for more advanced usage. - -### See also - -- [xterm-addon-webgl](https://www.npmjs.com/package/xterm-addon-webgl) A renderer for xterm.js that uses WebGL diff --git a/bin/publish.js b/bin/publish.js index 1103797f6..286e940db 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -27,15 +27,16 @@ if (changedFiles.some(e => e.search(/^addons\//) === -1)) { // Publish addons if any files were changed inside of the addon const addonPackageDirs = [ - // path.resolve(__dirname, '../addons/xterm-addon-attach'), - // path.resolve(__dirname, '../addons/xterm-addon-canvas'), - // path.resolve(__dirname, '../addons/xterm-addon-fit'), - // // path.resolve(__dirname, '../addons/xterm-addon-image'), - // path.resolve(__dirname, '../addons/xterm-addon-ligatures'), - // path.resolve(__dirname, '../addons/xterm-addon-search'), - // path.resolve(__dirname, '../addons/xterm-addon-serialize'), - // path.resolve(__dirname, '../addons/xterm-addon-unicode11'), - // path.resolve(__dirname, '../addons/xterm-addon-web-links'), + path.resolve(__dirname, '../addons/addon-attach'), + path.resolve(__dirname, '../addons/addon-canvas'), + path.resolve(__dirname, '../addons/addon-fit'), + // path.resolve(__dirname, '../addons/addon-image'), + path.resolve(__dirname, '../addons/addon-ligatures'), + path.resolve(__dirname, '../addons/addon-search'), + path.resolve(__dirname, '../addons/addon-serialize'), + path.resolve(__dirname, '../addons/addon-unicode11'), + // path.resolve(__dirname, '../addons/addon-unicode-graphemes'), + path.resolve(__dirname, '../addons/addon-web-links'), path.resolve(__dirname, '../addons/addon-webgl') ]; console.log(`Checking if addons need to be published`); diff --git a/bin/test_playwright.js b/bin/test_playwright.js index 12aa0cf03..0cd6f85cf 100644 --- a/bin/test_playwright.js +++ b/bin/test_playwright.js @@ -19,7 +19,7 @@ while (argv.some(e => e.startsWith('--suite='))) { let configs = [ { name: 'core', path: 'out-test/playwright/playwright.config.js' }, - { name: 'xterm-addon-canvas', path: 'addons/xterm-addon-canvas/out-test/playwright.config.js' }, + { name: 'addon-canvas', path: 'addons/addon-canvas/out-test/playwright.config.js' }, { name: 'addon-webgl', path: 'addons/addon-webgl/out-test/playwright.config.js' } ]; diff --git a/demo/client.ts b/demo/client.ts index df169ffe9..7e0830a58 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -10,37 +10,37 @@ // Use tsc version (yarn watch) import { Terminal } from '../out/browser/public/Terminal'; -import { AttachAddon } from '../addons/xterm-addon-attach/out/AttachAddon'; -import { CanvasAddon } from '../addons/xterm-addon-canvas/out/CanvasAddon'; -import { FitAddon } from '../addons/xterm-addon-fit/out/FitAddon'; -import { SearchAddon, ISearchOptions } from '../addons/xterm-addon-search/out/SearchAddon'; -import { SerializeAddon } from '../addons/xterm-addon-serialize/out/SerializeAddon'; -import { WebLinksAddon } from '../addons/xterm-addon-web-links/out/WebLinksAddon'; +import { AttachAddon } from '../addons/addon-attach/out/AttachAddon'; +import { CanvasAddon } from '../addons/addon-canvas/out/CanvasAddon'; +import { FitAddon } from '../addons/addon-fit/out/FitAddon'; +import { SearchAddon, ISearchOptions } from '../addons/addon-search/out/SearchAddon'; +import { SerializeAddon } from '../addons/addon-serialize/out/SerializeAddon'; +import { WebLinksAddon } from '../addons/addon-web-links/out/WebLinksAddon'; import { WebglAddon } from '../addons/addon-webgl/out/WebglAddon'; -import { Unicode11Addon } from '../addons/xterm-addon-unicode11/out/Unicode11Addon'; -import { UnicodeGraphemesAddon } from '../addons/xterm-addon-unicode-graphemes/out/UnicodeGraphemesAddon'; -import { LigaturesAddon } from '../addons/xterm-addon-ligatures/out/LigaturesAddon'; +import { Unicode11Addon } from '../addons/addon-unicode11/out/Unicode11Addon'; +import { UnicodeGraphemesAddon } from '../addons/addon-unicode-graphemes/out/UnicodeGraphemesAddon'; +import { LigaturesAddon } from '../addons/addon-ligatures/out/LigaturesAddon'; // Playwright/WebKit on Windows does not support WebAssembly https://stackoverflow.com/q/62311688/1156119 -import type { ImageAddonType, IImageAddonOptions } from '../addons/xterm-addon-image/out/ImageAddon'; +import type { ImageAddonType, IImageAddonOptions } from '../addons/addon-image/out/ImageAddon'; let ImageAddon: ImageAddonType | undefined; // eslint-disable-line @typescript-eslint/naming-convention if ('WebAssembly' in window) { - const imageAddon = require('../addons/xterm-addon-image/out/ImageAddon'); + const imageAddon = require('../addons/addon-image/out/ImageAddon'); ImageAddon = imageAddon.ImageAddon; } // Use webpacked version (yarn package) // import { Terminal } from '../lib/xterm'; -// import { AttachAddon } from 'xterm-addon-attach'; -// import { FitAddon } from 'xterm-addon-fit'; -// import { ImageAddon } from 'xterm-addon-image'; -// import { SearchAddon, ISearchOptions } from 'xterm-addon-search'; -// import { SerializeAddon } from 'xterm-addon-serialize'; -// import { WebLinksAddon } from 'xterm-addon-web-links'; -// import { WebglAddon } from '@xterm/addon-webgl'; -// import { Unicode11Addon } from 'xterm-addon-unicode11'; -// import { UnicodeGraphemesAddon } from 'xterm-addon-unicode-graphemes'; -// import { LigaturesAddon } from 'xterm-addon-ligatures'; +// import { AttachAddon } from '@xterm/addon-attach'; +// import { FitAddon } from '@xterm/addon-fit'; +// import { ImageAddon } from '@xterm/addon-image'; +// import { SearchAddon, ISearchOptions } from '@xterm/addon-search'; +// import { SerializeAddon } from '@xterm/addon-serialize'; +// import { WebLinksAddon } from '@xterm/addon-web-links'; +// import { WebglAddon } from '@@xterm/addon-webgl'; +// import { Unicode11Addon } from '@xterm/addon-unicode11'; +// import { UnicodeGraphemesAddon } from '@xterm/addon-unicode-graphemes'; +// import { LigaturesAddon } from '@xterm/addon-ligatures'; // Pulling in the module's types relies on the above, it's looks a // little weird here as we're importing "this" module diff --git a/demo/tsconfig.json b/demo/tsconfig.json index cd15a36d4..f0aebb1f3 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -6,12 +6,12 @@ "sourceMap": true, "baseUrl": ".", "paths": { - "xterm-addon-attach": ["../addons/xterm-addon-attach"], - "xterm-addon-fit": ["../addons/xterm-addon-fit"], - "xterm-addon-image": ["../addons/xterm-addon-image"], - "xterm-addon-search": ["../addons/xterm-addon-search"], - "xterm-addon-serialize": ["../addons/xterm-addon-serialize"], - "xterm-addon-web-links": ["../addons/xterm-addon-web-links"], + "addon-attach": ["../addons/addon-attach"], + "addon-fit": ["../addons/addon-fit"], + "addon-image": ["../addons/addon-image"], + "addon-search": ["../addons/addon-search"], + "addon-serialize": ["../addons/addon-serialize"], + "addon-web-links": ["../addons/addon-web-links"], "addon-webgl": ["../addons/addon-webgl"] } }, diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index b5c91bfba..a3b8fbecd 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -49,7 +49,7 @@ const GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': /** * Document xterm VT features here that are currently unsupported */ -// @vt: #E[Supported via xterm-addon-image.] DCS SIXEL "SIXEL Graphics" "DCS Ps ; Ps ; Ps ; q Pt ST" "Draw SIXEL image." +// @vt: #E[Supported via @xterm/addon-image.] DCS SIXEL "SIXEL Graphics" "DCS Ps ; Ps ; Ps ; q Pt ST" "Draw SIXEL image." // @vt: #N DCS DECUDK "User Defined Keys" "DCS Ps ; Ps \| Pt ST" "Definitions for user-defined keys." // @vt: #N DCS XTGETTCAP "Request Terminfo String" "DCS + q Pt ST" "Request Terminfo String." // @vt: #N DCS XTSETTCAP "Set Terminfo Data" "DCS + p Pt ST" "Set Terminfo Data." diff --git a/tsconfig.all.json b/tsconfig.all.json index e3fc22cf2..e2028479d 100644 --- a/tsconfig.all.json +++ b/tsconfig.all.json @@ -7,16 +7,16 @@ { "path": "./test/api" }, { "path": "./test/benchmark" }, { "path": "./test/playwright" }, - { "path": "./addons/xterm-addon-attach" }, - { "path": "./addons/xterm-addon-canvas" }, - { "path": "./addons/xterm-addon-fit" }, - { "path": "./addons/xterm-addon-image" }, - { "path": "./addons/xterm-addon-ligatures" }, - { "path": "./addons/xterm-addon-search" }, - { "path": "./addons/xterm-addon-serialize" }, - { "path": "./addons/xterm-addon-unicode11" }, - { "path": "./addons/xterm-addon-unicode-graphemes" }, - { "path": "./addons/xterm-addon-web-links" }, + { "path": "./addons/addon-attach" }, + { "path": "./addons/addon-canvas" }, + { "path": "./addons/addon-fit" }, + { "path": "./addons/addon-image" }, + { "path": "./addons/addon-ligatures" }, + { "path": "./addons/addon-search" }, + { "path": "./addons/addon-serialize" }, + { "path": "./addons/addon-unicode11" }, + { "path": "./addons/addon-unicode-graphemes" }, + { "path": "./addons/addon-web-links" }, { "path": "./addons/addon-webgl" } ] } From b4b128709f2e367a5250b5a14d3d77d1d07208e8 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:37:20 -0700 Subject: [PATCH 33/46] Add other addons to the readme addon section --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 47ede986a..7514e76c4 100644 --- a/README.md +++ b/README.md @@ -77,9 +77,14 @@ terminal.loadAddon(new WebLinksAddon()); The xterm.js team maintains the following addons, but anyone can build them: - [`@xterm/addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-attach): Attaches to a server running a process via a websocket +- [`@xterm/addon-canvas`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas): Renders xterm.js using a `canvas` element's 2d context - [`@xterm/addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit): Fits the terminal to the containing element +- [`@xterm/addon-image`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-image): Adds image support - [`@xterm/addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-search): Adds search functionality +- [`@xterm/addon-serialize`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-serialize): Serializes the terminal's buffer to a VT sequences or HTML +- [`@xterm/addon-unicode11`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-unicode11): Updates character widths to their unicode11 values - [`@xterm/addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-web-links): Adds web link detection and interaction +- [`@xterm/addon-webgl`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-webgl): Renders xterm.js using a `canvas` element's webgl2 context ## Browser Support From d95f0177c8207180922f2eb768e0344b998d56a7 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:49:21 -0700 Subject: [PATCH 34/46] Add todo comments for uncomment publish script --- bin/publish.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/publish.js b/bin/publish.js index 286e940db..4d60342d7 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -42,6 +42,7 @@ const addonPackageDirs = [ console.log(`Checking if addons need to be published`); for (const p of addonPackageDirs) { const addon = path.basename(p); + // TODO: Uncomment after first publish // if (changedFiles.some(e => e.includes(addon))) { console.log(`Try publish ${addon}`); checkAndPublishPackage(p); @@ -57,6 +58,7 @@ function checkAndPublishPackage(packageDir) { const packageJson = require(path.join(packageDir, 'package.json')); // Determine if this is a stable or beta release + // TODO: Uncomment after first publish // const publishedVersions = getPublishedVersions(packageJson); const isStableRelease = false; // !publishedVersions.includes(packageJson.version); From 71ec21616195c231049de83b3966d0a37d6ca4e6 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:06:30 -0700 Subject: [PATCH 35/46] Uncomment first publish special cases, add missing (at)xterm Part of #4859 --- addons/addon-canvas/package.json | 2 +- addons/addon-fit/package.json | 2 +- addons/addon-image/package.json | 2 +- addons/addon-ligatures/package.json | 2 +- addons/addon-search/package.json | 2 +- addons/addon-serialize/README.md | 2 +- addons/addon-serialize/package.json | 2 +- addons/addon-unicode-graphemes/package.json | 2 +- addons/addon-unicode11/package.json | 2 +- addons/addon-web-links/package.json | 2 +- addons/addon-webgl/package.json | 3 +-- bin/publish.js | 10 ++++------ 12 files changed, 15 insertions(+), 18 deletions(-) diff --git a/addons/addon-canvas/package.json b/addons/addon-canvas/package.json index a614c2811..9aabb001f 100644 --- a/addons/addon-canvas/package.json +++ b/addons/addon-canvas/package.json @@ -23,6 +23,6 @@ "start-server-only": "node ../../demo/start-server-only" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-fit/package.json b/addons/addon-fit/package.json index 046ef4d87..585f3621c 100644 --- a/addons/addon-fit/package.json +++ b/addons/addon-fit/package.json @@ -21,6 +21,6 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-image/package.json b/addons/addon-image/package.json index 4b0f8cdc4..8572e3300 100644 --- a/addons/addon-image/package.json +++ b/addons/addon-image/package.json @@ -22,7 +22,7 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.2.0" + "@xterm/xterm": "^5.2.0" }, "devDependencies": { "sixel": "^0.16.0", diff --git a/addons/addon-ligatures/package.json b/addons/addon-ligatures/package.json index c62f9e08a..302518882 100644 --- a/addons/addon-ligatures/package.json +++ b/addons/addon-ligatures/package.json @@ -42,6 +42,6 @@ "yauzl": "^2.10.0" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-search/package.json b/addons/addon-search/package.json index 9fab82afb..ae4fb5d9a 100644 --- a/addons/addon-search/package.json +++ b/addons/addon-search/package.json @@ -21,6 +21,6 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-serialize/README.md b/addons/addon-serialize/README.md index f01168935..862ebac3e 100644 --- a/addons/addon-serialize/README.md +++ b/addons/addon-serialize/README.md @@ -13,7 +13,7 @@ npm install --save @xterm/addon-serialize ### Usage ```ts -import { Terminal } from "xterm"; +import { Terminal } from "@xterm/xterm"; import { SerializeAddon } from "@xterm/addon-serialize"; const terminal = new Terminal(); diff --git a/addons/addon-serialize/package.json b/addons/addon-serialize/package.json index c95bc5312..763c52ca9 100644 --- a/addons/addon-serialize/package.json +++ b/addons/addon-serialize/package.json @@ -24,6 +24,6 @@ "benchmark-eval": "NODE_PATH=../../out:./out:./out-benchmark/ ../../node_modules/.bin/xterm-benchmark -r 5 -c benchmark/benchmark.json --eval out-benchmark/benchmark/*benchmark.js" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-unicode-graphemes/package.json b/addons/addon-unicode-graphemes/package.json index 5e270025c..d49eda873 100644 --- a/addons/addon-unicode-graphemes/package.json +++ b/addons/addon-unicode-graphemes/package.json @@ -24,6 +24,6 @@ "benchmark-eval": "NODE_PATH=../../out:./out:./out-benchmark/ ../../node_modules/.bin/xterm-benchmark -r 5 -c benchmark/benchmark.json --eval out-benchmark/benchmark/*benchmark.js" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-unicode11/package.json b/addons/addon-unicode11/package.json index b54f9ab4a..ad6a48924 100644 --- a/addons/addon-unicode11/package.json +++ b/addons/addon-unicode11/package.json @@ -21,6 +21,6 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-web-links/package.json b/addons/addon-web-links/package.json index e1d60b022..6367907aa 100644 --- a/addons/addon-web-links/package.json +++ b/addons/addon-web-links/package.json @@ -21,7 +21,7 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } diff --git a/addons/addon-webgl/package.json b/addons/addon-webgl/package.json index f52f8b59b..9a31c306c 100644 --- a/addons/addon-webgl/package.json +++ b/addons/addon-webgl/package.json @@ -23,7 +23,6 @@ "start-server-only": "node ../../demo/start-server-only" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } - } diff --git a/bin/publish.js b/bin/publish.js index 4d60342d7..8394362a5 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -42,11 +42,10 @@ const addonPackageDirs = [ console.log(`Checking if addons need to be published`); for (const p of addonPackageDirs) { const addon = path.basename(p); - // TODO: Uncomment after first publish - // if (changedFiles.some(e => e.includes(addon))) { + if (changedFiles.some(e => e.includes(addon))) { console.log(`Try publish ${addon}`); checkAndPublishPackage(p); - // } + } } // Publish website if it's a stable release @@ -58,9 +57,8 @@ function checkAndPublishPackage(packageDir) { const packageJson = require(path.join(packageDir, 'package.json')); // Determine if this is a stable or beta release - // TODO: Uncomment after first publish - // const publishedVersions = getPublishedVersions(packageJson); - const isStableRelease = false; // !publishedVersions.includes(packageJson.version); + const publishedVersions = getPublishedVersions(packageJson); + const isStableRelease = !publishedVersions.includes(packageJson.version); // Get the next version let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson); From 64534e1b7a151d666b24d14acc42be19e18cd763 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:07:41 -0700 Subject: [PATCH 36/46] Fix missing peer dep --- addons/addon-attach/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/addon-attach/package.json b/addons/addon-attach/package.json index 8e5a413e5..94b483dd8 100644 --- a/addons/addon-attach/package.json +++ b/addons/addon-attach/package.json @@ -21,6 +21,6 @@ "prepublishOnly": "npm run package" }, "peerDependencies": { - "xterm": "^5.0.0" + "@xterm/xterm": "^5.0.0" } } From eac8124320f38edd6295d86044c41d2ab9eda74f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:27:04 -0700 Subject: [PATCH 37/46] Fix stable release check --- bin/publish.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 8394362a5..a934ffe22 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -57,8 +57,9 @@ function checkAndPublishPackage(packageDir) { const packageJson = require(path.join(packageDir, 'package.json')); // Determine if this is a stable or beta release - const publishedVersions = getPublishedVersions(packageJson); - const isStableRelease = !publishedVersions.includes(packageJson.version); + // TODO: Uncomment when publishing 5.4 + // const publishedVersions = getPublishedVersions(packageJson); + const isStableRelease = false; //!publishedVersions.includes(packageJson.version); // Get the next version let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson); From bbbde9261f2939ec05dc5c1c0d59b494016f3630 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:59:42 -0700 Subject: [PATCH 38/46] Fix parsing of low version count --- bin/publish.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index a934ffe22..7253dffba 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -114,12 +114,20 @@ function getNextBetaVersion(packageJson) { return `${nextStableVersion}-${tag}.${latestTagVersion + 1}`; } +function asArray(value) { + return Array.isArray(value) ? value : [value]; +} + function getPublishedVersions(packageJson, version, tag) { - const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']); - const versionsJson = JSON.parse(versionsProcess.stdout); - if (!versionsJson || !Array.isArray(versionsJson) || versionsJson.length === 0) { - return []; + const versionsProcess = cp.spawnSync(os.platform === 'win32' ? 'npm.cmd' : 'npm', ['view', packageJson.name, 'versions', '--json']); + if (versionsProcess.stdout.length === 0 && versionsProcess.stderr) { + const err = versionsProcess.stderr.toString(); + if (err.indexOf('404 Not Found - GET https://registry.npmjs.org/@xterm') > 0) { + return []; + } + throw new Error('Could not get published versions\n' + err); } + const versionsJson = asArray(JSON.parse(versionsProcess.stdout)); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From 1c522e16a4bbe047d6bd70a577498ec33a3ef368 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:13:19 -0700 Subject: [PATCH 39/46] Fix image addon build Fixes #4761 Fixes #4802 --- addons/addon-image/webpack.config.js | 8 ++++++++ bin/publish.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/addon-image/webpack.config.js b/addons/addon-image/webpack.config.js index bcd52db2d..b4283b66e 100644 --- a/addons/addon-image/webpack.config.js +++ b/addons/addon-image/webpack.config.js @@ -21,6 +21,14 @@ const addon = { } ] }, + resolve: { + modules: ['./node_modules'], + extensions: [ '.js' ], + alias: { + common: path.resolve('../../out/common'), + browser: path.resolve('../../out/browser') + } + }, output: { filename: mainFile, path: path.resolve('./lib'), diff --git a/bin/publish.js b/bin/publish.js index 7253dffba..d6eab003e 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -30,7 +30,7 @@ const addonPackageDirs = [ path.resolve(__dirname, '../addons/addon-attach'), path.resolve(__dirname, '../addons/addon-canvas'), path.resolve(__dirname, '../addons/addon-fit'), - // path.resolve(__dirname, '../addons/addon-image'), + path.resolve(__dirname, '../addons/addon-image'), path.resolve(__dirname, '../addons/addon-ligatures'), path.resolve(__dirname, '../addons/addon-search'), path.resolve(__dirname, '../addons/addon-serialize'), From 2744549c0fe1253970ae8b22173909620ba89517 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:35:25 -0700 Subject: [PATCH 40/46] Return [] if versionsJson is falsy --- bin/publish.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/publish.js b/bin/publish.js index d6eab003e..75edd6357 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -128,6 +128,9 @@ function getPublishedVersions(packageJson, version, tag) { throw new Error('Could not get published versions\n' + err); } const versionsJson = asArray(JSON.parse(versionsProcess.stdout)); + if (!versionsJson) { + return []; + } if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From c8b2783b85b8ecc7c817eea85211af05684f29d4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:01:20 -0700 Subject: [PATCH 41/46] Tweak parsing versions --- bin/publish.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 75edd6357..e4e840e9d 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -127,10 +127,11 @@ function getPublishedVersions(packageJson, version, tag) { } throw new Error('Could not get published versions\n' + err); } - const versionsJson = asArray(JSON.parse(versionsProcess.stdout)); - if (!versionsJson) { + const output = JSON.parse(versionsProcess.stdout); + if (!output || Array.isArray(output) && output.length === 0) { return []; } + const versionsJson = asArray(output); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From 88b0b4a5c757b8f507bf4fcc7b35f1be6e2bba21 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:07:59 -0700 Subject: [PATCH 42/46] Log publish script --- bin/publish.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/publish.js b/bin/publish.js index e4e840e9d..f88b1b36d 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -131,7 +131,9 @@ function getPublishedVersions(packageJson, version, tag) { if (!output || Array.isArray(output) && output.length === 0) { return []; } + console.log('output', output); const versionsJson = asArray(output); + console.log('versionsJson', versionsJson); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From 31925596f105b74482e1d8514805daf513a7aa62 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:15:28 -0700 Subject: [PATCH 43/46] Log publish script --- bin/publish.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/publish.js b/bin/publish.js index f88b1b36d..836c81afb 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -128,6 +128,12 @@ function getPublishedVersions(packageJson, version, tag) { throw new Error('Could not get published versions\n' + err); } const output = JSON.parse(versionsProcess.stdout); + if (typeof output === 'object') { + if (output.error?.code === 'E404') { + return []; + } + throw new Error('Could not get published versions\n' + output); + } if (!output || Array.isArray(output) && output.length === 0) { return []; } From 92eb78230b54adfb15a0bab1a3052368990f5520 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:47:39 -0700 Subject: [PATCH 44/46] Verify it's not an array --- bin/publish.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 836c81afb..2ac602803 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -9,7 +9,7 @@ const os = require('os'); const path = require('path'); // Setup auth -fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); +// fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); const isDryRun = process.argv.includes('--dry'); if (isDryRun) { @@ -128,7 +128,9 @@ function getPublishedVersions(packageJson, version, tag) { throw new Error('Could not get published versions\n' + err); } const output = JSON.parse(versionsProcess.stdout); - if (typeof output === 'object') { + console.log('output', output); + console.log('typeof output', typeof output); + if (typeof output === 'object' && !Array.isArray(output)) { if (output.error?.code === 'E404') { return []; } From fbc51ae691bc27c5811f5c20532b31b5a5bd0458 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:24:38 -0700 Subject: [PATCH 45/46] Remove logs --- bin/publish.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 2ac602803..a4a15f63c 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -128,8 +128,6 @@ function getPublishedVersions(packageJson, version, tag) { throw new Error('Could not get published versions\n' + err); } const output = JSON.parse(versionsProcess.stdout); - console.log('output', output); - console.log('typeof output', typeof output); if (typeof output === 'object' && !Array.isArray(output)) { if (output.error?.code === 'E404') { return []; @@ -139,9 +137,7 @@ function getPublishedVersions(packageJson, version, tag) { if (!output || Array.isArray(output) && output.length === 0) { return []; } - console.log('output', output); const versionsJson = asArray(output); - console.log('versionsJson', versionsJson); if (tag) { return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`))); } From 45e7efce67efa8b225230b1813934fb9e47bc143 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:29:32 -0700 Subject: [PATCH 46/46] Re-enable auth --- bin/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index a4a15f63c..360e09fe6 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -9,7 +9,7 @@ const os = require('os'); const path = require('path'); // Setup auth -// fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); +fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); const isDryRun = process.argv.includes('--dry'); if (isDryRun) {