fix 'Can't resolve 'xterm' in xterm.js/addons/xterm-addon-serialize/out'

This commit is contained in:
javacs3
2019-11-21 20:41:47 +08:00
parent 7a7f3466f3
commit 22a2496360
3 changed files with 14 additions and 12 deletions
+2 -1
View File
@@ -51,7 +51,8 @@ const clientConfig = {
extensions: [ '.tsx', '.ts', '.js' ],
alias: {
common: path.resolve('./out/common'),
browser: path.resolve('./out/browser')
browser: path.resolve('./out/browser'),
xterm$: path.resolve('./out/public/Terminal.js')
}
},
output: {
+2 -1
View File
@@ -9,7 +9,8 @@
"xterm-addon-attach": ["../addons/xterm-addon-attach"],
"xterm-addon-fit": ["../addons/xterm-addon-fit"],
"xterm-addon-search": ["../addons/xterm-addon-search"],
"xterm-addon-web-links": ["../addons/xterm-addon-web-links"]
"xterm-addon-web-links": ["../addons/xterm-addon-web-links"],
"xterm-addon-serialize": ["../addons/xterm-addon-serialize"]
}
},
"include": [
+10 -10
View File
@@ -223,7 +223,7 @@ class BufferLineApiView implements IBufferLineApi {
const COLOR_MASK = Attributes.CM_MASK | Attributes.RGB_MASK;
class CellColorApi implements ICellColorApi {
export class CellColor implements ICellColorApi {
readonly type: 'default' | 'rgb' | 'palette16' | 'palette256';
readonly value: number = 0;
@@ -248,7 +248,7 @@ class CellColorApi implements ICellColorApi {
return [-1, -1, -1];
}
public static getDefault(): ICellColorApi { return new CellColorApi('default', 0); }
public static getDefault(): ICellColorApi { return new CellColor('default', 0); }
}
class BufferCellApiView implements IBufferCellApi {
@@ -260,14 +260,14 @@ class BufferCellApiView implements IBufferCellApi {
const cell = this._cell;
const value = cell.fg & COLOR_MASK;
if (cell.isFgDefault()) {
return new CellColorApi('default', 0);
return new CellColor('default', 0);
} else if (cell.isFgPalette()) {
switch (cell.getFgColorMode()) {
case Attributes.CM_P16: return new CellColorApi('palette16', value);
case Attributes.CM_P256: return new CellColorApi('palette256', value);
case Attributes.CM_P16: return new CellColor('palette16', value);
case Attributes.CM_P256: return new CellColor('palette256', value);
}
} else if (cell.isFgRGB()) {
return new CellColorApi('rgb', value);
return new CellColor('rgb', value);
}
throw new Error('Invalid foregroundColor');
}
@@ -275,14 +275,14 @@ class BufferCellApiView implements IBufferCellApi {
const cell = this._cell;
const value = cell.bg & COLOR_MASK;
if (cell.isBgDefault()) {
return new CellColorApi('default', 0);
return new CellColor('default', 0);
} else if (cell.isBgPalette()) {
switch (cell.getBgColorMode()) {
case Attributes.CM_P16: return new CellColorApi('palette16', value);
case Attributes.CM_P256: return new CellColorApi('palette256', value);
case Attributes.CM_P16: return new CellColor('palette16', value);
case Attributes.CM_P256: return new CellColor('palette256', value);
}
} else if (cell.isBgRGB()) {
return new CellColorApi('rgb', value);
return new CellColor('rgb', value);
}
throw new Error('Invalid backgroundColor');
}