resolve SerializeAddon importing workaround

This commit is contained in:
javacs3
2019-11-21 20:41:47 +08:00
parent f1a17e3cf5
commit ae70ef0fa2
3 changed files with 23 additions and 33 deletions
@@ -3,30 +3,7 @@
* @license MIT
*/
import { Terminal, ITerminalAddon, IBuffer, IBufferCell, CellColor } from 'xterm';
// TODO: Workaround here, will remove this later
// If I use `import { CellStyle } from 'xterm'` instead, demo page will raise bellow error
//
// ERROR in ./addons/xterm-addon-serialize/out/SerializeAddon.js
// Module not found: Error: Can't resolve 'xterm' in '/Users/javacs3/Lab/Playground/xterm.js/addons/xterm-addon-serialize/out'
// @ ./addons/xterm-addon-serialize/out/SerializeAddon.js 16:14-30
// @ ./demo/client.ts
//
// Looks like typescript generate this line `var xterm_1 = require("xterm");` that leads to the error;
//
enum CellStyle {
default = 0,
// foreground style
inverse = 0x4000000 >>> 24,
bold = 0x8000000 >>> 24,
underline = 0x10000000 >>> 24,
blink = 0x20000000 >>> 24,
invisible = 0x40000000 >>> 24,
// background style
italic = 0x4000000 >>> 16,
dim = 0x8000000 >>> 16
}
import { Terminal, ITerminalAddon, IBuffer, IBufferCell, CellColor, CellStyle } from 'xterm';
function crop(value: number | undefined, low: number, high: number, initial: number): number {
if (value === undefined) {
+14 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi, CellColor as ICellColorApi, CellStyle } from 'xterm';
import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi, CellColor as ICellColorApi } from 'xterm';
import { ITerminal } from '../Types';
import { IBufferLine, ICellData } from 'common/Types';
import { IBuffer } from 'common/buffer/Types';
@@ -221,6 +221,19 @@ class BufferLineApiView implements IBufferLineApi {
}
}
export enum CellStyle {
default = 0,
// foreground style
inverse = 0x4000000 >>> 24,
bold = 0x8000000 >>> 24,
underline = 0x10000000 >>> 24,
blink = 0x20000000 >>> 24,
invisible = 0x40000000 >>> 24,
// background style
italic = 0x4000000 >>> 16,
dim = 0x8000000 >>> 16
}
const COLOR_MASK = Attributes.CM_MASK | Attributes.RGB_MASK;
export class CellColor implements ICellColorApi {
+8 -8
View File
@@ -958,16 +958,16 @@ declare module 'xterm' {
}
export enum CellStyle {
default = 0,
default,
// foreground style
inverse = 0x4000000 >>> 24,
bold = 0x8000000 >>> 24,
underline = 0x10000000 >>> 24,
blink = 0x20000000 >>> 24,
invisible = 0x40000000 >>> 24,
inverse,
bold,
underline,
blink,
invisible,
// background style
italic = 0x4000000 >>> 16,
dim = 0x8000000 >>> 16
italic,
dim
}
export class CellColor {