Move platform to common and remove dom dependence in common

Because common/ imports 'xterm', it also imported dom accidentally.

Fixes #1990
This commit is contained in:
Daniel Imms
2019-03-31 23:24:29 -07:00
parent b05c66b132
commit 4a3609f805
15 changed files with 32 additions and 21 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
import * as Strings from './Strings'; import * as Strings from './Strings';
import { ITerminal, IBuffer } from './Types'; import { ITerminal, IBuffer } from './Types';
import { isMac } from './core/Platform'; import { isMac } from './common/Platform';
import { RenderDebouncer } from './ui/RenderDebouncer'; import { RenderDebouncer } from './ui/RenderDebouncer';
import { addDisposableDomListener } from './ui/Lifecycle'; import { addDisposableDomListener } from './ui/Lifecycle';
import { Disposable } from './common/Lifecycle'; import { Disposable } from './common/Lifecycle';
+1 -1
View File
@@ -6,7 +6,7 @@
import { ITerminal, ISelectionManager, IBuffer, CharData, IBufferLine } from './Types'; import { ITerminal, ISelectionManager, IBuffer, CharData, IBufferLine } from './Types';
import { XtermListener } from './common/Types'; import { XtermListener } from './common/Types';
import { MouseHelper } from './ui/MouseHelper'; import { MouseHelper } from './ui/MouseHelper';
import * as Browser from './core/Platform'; import * as Browser from './common/Platform';
import { CharMeasure } from './ui/CharMeasure'; import { CharMeasure } from './ui/CharMeasure';
import { EventEmitter } from './common/EventEmitter'; import { EventEmitter } from './common/EventEmitter';
import { SelectionModel } from './SelectionModel'; import { SelectionModel } from './SelectionModel';
+1 -1
View File
@@ -36,7 +36,7 @@ import { Renderer } from './renderer/Renderer';
import { Linkifier } from './Linkifier'; import { Linkifier } from './Linkifier';
import { SelectionManager } from './SelectionManager'; import { SelectionManager } from './SelectionManager';
import { CharMeasure } from './ui/CharMeasure'; import { CharMeasure } from './ui/CharMeasure';
import * as Browser from './core/Platform'; import * as Browser from './common/Platform';
import { addDisposableDomListener } from './ui/Lifecycle'; import { addDisposableDomListener } from './ui/Lifecycle';
import * as Strings from './Strings'; import * as Strings from './Strings';
import { MouseHelper } from './ui/MouseHelper'; import { MouseHelper } from './ui/MouseHelper';
+1 -2
View File
@@ -3,8 +3,7 @@
* @license MIT * @license MIT
*/ */
import { XtermListener } from './Types'; import { IDisposable, IEventEmitter, XtermListener } from './Types';
import { IEventEmitter, IDisposable } from 'xterm';
import { Disposable } from './Lifecycle'; import { Disposable } from './Lifecycle';
export class EventEmitter extends Disposable implements IEventEmitter, IDisposable { export class EventEmitter extends Disposable implements IEventEmitter, IDisposable {
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { IDisposable } from 'xterm'; import { IDisposable } from './Types';
/** /**
* A base class that can be extended to provide convenience methods for managing the lifecycle of an * A base class that can be extended to provide convenience methods for managing the lifecycle of an
@@ -3,6 +3,13 @@
* @license MIT * @license MIT
*/ */
interface INavigator {
userAgent: string;
language: string;
platform: string;
}
declare const navigator: INavigator;
const isNode = (typeof navigator === 'undefined') ? true : false; const isNode = (typeof navigator === 'undefined') ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent; const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform; const platform = (isNode) ? 'node' : navigator.platform;
+10 -1
View File
@@ -3,7 +3,16 @@
* @license MIT * @license MIT
*/ */
import { IEventEmitter } from 'xterm'; export interface IDisposable {
dispose(): void;
}
export interface IEventEmitter {
on(type: string, listener: (...args: any[]) => void): void;
off(type: string, listener: (...args: any[]) => void): void;
emit(type: string, data?: any): void;
addDisposableListener(type: string, handler: (...args: any[]) => void): IDisposable;
}
export type XtermListener = (...args: any[]) => void; export type XtermListener = (...args: any[]) => void;
+4 -1
View File
@@ -1,7 +1,10 @@
{ {
"extends": "../tsconfig-library-base", "extends": "../tsconfig-library-base",
"compilerOptions": { "compilerOptions": {
"outDir": "../../lib" "outDir": "../../lib",
"types": [
"../../node_modules/@types/mocha"
]
}, },
"include": [ "include": [
"./**/*" "./**/*"
+1 -1
View File
@@ -4,7 +4,7 @@
"outDir": "../../lib" "outDir": "../../lib"
}, },
"include": [ "include": [
"./**/*" "./**/*", "../common/Platform.ts"
], ],
"references": [ "references": [
{ "path": "../common" } { "path": "../common" }
+1 -1
View File
@@ -4,7 +4,7 @@
*/ */
import { FontWeight } from 'xterm'; import { FontWeight } from 'xterm';
import { isFirefox, isSafari } from '../../core/Platform'; import { isFirefox, isSafari } from '../../common/Platform';
import { IColor } from '../Types'; import { IColor } from '../Types';
import { ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types'; import { ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types';
+1 -1
View File
@@ -8,7 +8,7 @@ import BaseCharAtlas from './BaseCharAtlas';
import { DEFAULT_ANSI_COLORS } from '../ColorManager'; import { DEFAULT_ANSI_COLORS } from '../ColorManager';
import { clearColor } from './CharAtlasGenerator'; import { clearColor } from './CharAtlasGenerator';
import LRUMap from './LRUMap'; import LRUMap from './LRUMap';
import { isFirefox, isSafari } from '../../core/Platform'; import { isFirefox, isSafari } from '../../common/Platform';
import { IColor } from '../Types'; import { IColor } from '../Types';
// In practice we're probably never going to exhaust a texture this large. For debugging purposes, // In practice we're probably never going to exhaust a texture this large. For debugging purposes,
+1 -3
View File
@@ -8,8 +8,6 @@
"removeComments": true, "removeComments": true,
"pretty": true, "pretty": true,
"incremental": true, "incremental": true
"skipLibCheck": true
} }
} }
-4
View File
@@ -1,10 +1,6 @@
{ {
"extends": "./tsconfig-base.json", "extends": "./tsconfig-base.json",
"compilerOptions": { "compilerOptions": {
"types": [
"../../node_modules/@types/mocha",
"../../"
],
"composite": true, "composite": true,
"strict": true "strict": true
} }
+1 -2
View File
@@ -11,7 +11,7 @@
], ],
"rootDir": ".", "rootDir": ".",
"outDir": "../lib", "outDir": "../lib",
"noUnusedLocals": true, "noUnusedLocals": true,
"noImplicitAny": true "noImplicitAny": true
}, },
@@ -27,4 +27,3 @@
{ "path": "./core" } { "path": "./core" }
] ]
} }
+1 -1
View File
@@ -7,7 +7,7 @@ import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../rende
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine, IBufferStringIterator } from '../Types'; import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine, IBufferStringIterator } from '../Types';
import { ICircularList, XtermListener } from '../common/Types'; import { ICircularList, XtermListener } from '../common/Types';
import { Buffer } from '../Buffer'; import { Buffer } from '../Buffer';
import * as Browser from '../core/Platform'; import * as Browser from '../common/Platform';
import { ITheme, IDisposable, IMarker } from 'xterm'; import { ITheme, IDisposable, IMarker } from 'xterm';
import { Terminal } from '../Terminal'; import { Terminal } from '../Terminal';