Merge pull request #1992 from Tyriar/1990_layering_libs

Ensure DOM APIs cannot be used in common and core
This commit is contained in:
Daniel Imms
2019-04-03 18:28:53 -04:00
committed by GitHub
15 changed files with 40 additions and 27 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
import * as Strings from './Strings';
import { ITerminal, IBuffer } from './Types';
import { isMac } from './core/Platform';
import { isMac } from './common/Platform';
import { RenderDebouncer } from './ui/RenderDebouncer';
import { addDisposableDomListener } from './ui/Lifecycle';
import { Disposable } from './common/Lifecycle';
+1 -1
View File
@@ -6,7 +6,7 @@
import { ITerminal, ISelectionManager, IBuffer, IBufferLine } from './Types';
import { XtermListener } from './common/Types';
import { MouseHelper } from './ui/MouseHelper';
import * as Browser from './core/Platform';
import * as Browser from './common/Platform';
import { CharMeasure } from './ui/CharMeasure';
import { EventEmitter } from './common/EventEmitter';
import { SelectionModel } from './SelectionModel';
+1 -1
View File
@@ -36,7 +36,7 @@ import { Renderer } from './renderer/Renderer';
import { Linkifier } from './Linkifier';
import { SelectionManager } from './SelectionManager';
import { CharMeasure } from './ui/CharMeasure';
import * as Browser from './core/Platform';
import * as Browser from './common/Platform';
import { addDisposableDomListener } from './ui/Lifecycle';
import * as Strings from './Strings';
import { MouseHelper } from './ui/MouseHelper';
+1 -2
View File
@@ -3,8 +3,7 @@
* @license MIT
*/
import { XtermListener } from './Types';
import { IEventEmitter, IDisposable } from 'xterm';
import { IDisposable, IEventEmitter, XtermListener } from './Types';
import { Disposable } from './Lifecycle';
export class EventEmitter extends Disposable implements IEventEmitter, IDisposable {
+1 -1
View File
@@ -3,7 +3,7 @@
* @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
@@ -3,6 +3,16 @@
* @license MIT
*/
interface INavigator {
userAgent: string;
language: string;
platform: string;
}
// 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;
const isNode = (typeof navigator === 'undefined') ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform;
+10 -1
View File
@@ -3,7 +3,16 @@
* @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;
+5 -4
View File
@@ -1,9 +1,10 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"outDir": "../../lib"
"outDir": "../../lib",
"types": [
"../../node_modules/@types/mocha"
]
},
"include": [
"./**/*"
]
"include": [ "./**/*" ]
}
+5 -4
View File
@@ -1,11 +1,12 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"outDir": "../../lib"
"outDir": "../../lib",
"types": [
"../../node_modules/@types/mocha"
]
},
"include": [
"./**/*"
],
"include": [ "./**/*" ],
"references": [
{ "path": "../common" }
]
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { FontWeight } from 'xterm';
import { isFirefox, isSafari } from '../../core/Platform';
import { isFirefox, isSafari } from '../../common/Platform';
import { IColor } 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 { clearColor } from './CharAtlasGenerator';
import LRUMap from './LRUMap';
import { isFirefox, isSafari } from '../../core/Platform';
import { isFirefox, isSafari } from '../../common/Platform';
import { IColor } from '../Types';
// 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,
"pretty": true,
"incremental": true,
"skipLibCheck": true
"incremental": true
}
}
-4
View File
@@ -1,10 +1,6 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"types": [
"../../node_modules/@types/mocha",
"../../"
],
"composite": true,
"strict": true
}
+1 -2
View File
@@ -11,7 +11,7 @@
],
"rootDir": ".",
"outDir": "../lib",
"noUnusedLocals": true,
"noImplicitAny": true
},
@@ -27,4 +27,3 @@
{ "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, ICellData } from '../Types';
import { ICircularList, XtermListener } from '../common/Types';
import { Buffer } from '../Buffer';
import * as Browser from '../core/Platform';
import * as Browser from '../common/Platform';
import { ITheme, IDisposable, IMarker } from 'xterm';
import { Terminal } from '../Terminal';