Skip to content

Commit 6ef653e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into de_vs
2 parents a4c0e46 + a2bec2a commit 6ef653e

51 files changed

Lines changed: 1328 additions & 679 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ npm run build && npm run esbuild # Build all TypeScript and bundle
2222
**Testing**:
2323
- Unit tests: `npm run test-unit` (Mocha)
2424
- Unit tests filtering to file: `npm run test-unit -- **/fileName.ts
25-
- Per-addon unit tests: `npm run test-unit addons/addon-image/out-esbuild/*.test.js`
25+
- Per-addon unit tests: `npm run test-unit -- addons/addon-image/out-esbuild/*.test.js`
2626
- Integration tests: `npm run test-integration` (Playwright across Chrome/Firefox/WebKit)
2727
- Integration tests by file: `npm run test-integration -- test/playwright/InputHandler.test.ts`. Never use grep to filter tests, it doesn't work
28-
- Integration tests by addon: `npm run test-integration --suite=addon-search`. Suites always follow the format `addon-<something>`
28+
- Integration tests by addon: `npm run test-integration -- --suite=addon-search`. Suites always follow the format `addon-<something>`
2929
- Lint changes: `npm run lint-changes` to lint only changed files, `npm run lint-changes-fix` to fix them
3030

3131
## Addon Development Pattern

addons/addon-attach/test/playwright.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const config: PlaywrightTestConfig = {
55
timeout: 10000,
66
projects: [
77
{
8-
name: 'ChromeStable',
8+
name: 'Chromium',
99
use: {
10-
browserName: 'chromium',
11-
channel: 'chrome'
10+
browserName: 'chromium'
1211
}
1312
},
1413
{

addons/addon-clipboard/test/playwright.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const config: PlaywrightTestConfig = {
55
timeout: 10000,
66
projects: [
77
{
8-
name: 'ChromeStable',
8+
name: 'Chromium',
99
use: {
10-
browserName: 'chromium',
11-
channel: 'chrome'
10+
browserName: 'chromium'
1211
}
1312
},
1413
{

addons/addon-fit/test/playwright.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const config: PlaywrightTestConfig = {
55
timeout: 10000,
66
projects: [
77
{
8-
name: 'ChromeStable',
8+
name: 'Chromium',
99
use: {
10-
browserName: 'chromium',
11-
channel: 'chrome'
10+
browserName: 'chromium'
1211
}
1312
},
1413
{

addons/addon-image/src/IIPHandler.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import Base64Decoder from 'xterm-wasm-parts/lib/base64/Base64Decoder.wasm';
99
import { HeaderParser, IHeaderFields, HeaderState } from './IIPHeaderParser';
1010
import { imageType, UNSUPPORTED_TYPE } from './IIPMetrics';
1111

12-
13-
// eslint-disable-next-line
14-
declare const Buffer: any;
15-
1612
// limit hold memory in base64 decoder
1713
const KEEP_DATA = 4194304;
1814

@@ -105,7 +101,8 @@ export class IIPHandler implements IOscHandler, IResetHandler {
105101
return true;
106102
}
107103

108-
const blob = new Blob([new Uint8Array(this._dec.data8)], { type: this._metrics.mime });
104+
// HACK: The types on Blob are too restrictive, this is a Uint8Array so the browser accepts it
105+
const blob = new Blob([this._dec.data8 as Uint8Array<ArrayBuffer>], { type: this._metrics.mime });
109106
this._dec.release();
110107

111108
if (!window.createImageBitmap) {

addons/addon-image/src/IIPHeaderParser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ declare const Buffer: any;
88

99

1010
export interface IHeaderFields {
11+
[key: string]: number | string | Uint32Array | null | undefined;
1112
// base-64 encoded filename. Defaults to "Unnamed file".
1213
name: string;
1314
// File size in bytes. The file transfer will be canceled if this size is exceeded.
@@ -81,7 +82,7 @@ function toName(data: Uint32Array): string {
8182
return new TextDecoder().decode(b);
8283
}
8384

84-
const DECODERS: {[key: string]: (v: Uint32Array) => any} = {
85+
const DECODERS: {[key: string]: (v: Uint32Array) => number | string} = {
8586
inline: toInt,
8687
size: toInt,
8788
name: toName,
@@ -100,7 +101,7 @@ export class HeaderParser {
100101
private _buffer = new Uint32Array(MAX_FIELDCHARS);
101102
private _position = 0;
102103
private _key = '';
103-
public fields: {[key: string]: any} = {};
104+
public fields: {[key: string]: number | string | Uint32Array | null | undefined} = {};
104105

105106
public reset(): void {
106107
this._buffer.fill(0);

addons/addon-image/src/ImageStorage.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ export class ImageStorage implements IDisposable {
132132
) {
133133
try {
134134
this.setLimit(this._opts.storageLimit);
135-
} catch (e: any) {
136-
console.error(e.message);
135+
} catch (e: unknown) {
136+
if (e instanceof Error) {
137+
console.error(e.message);
138+
}
137139
console.warn(`storageLimit is set to ${this.getLimit()} MB`);
138140
}
139141
this._viewportMetrics = {

addons/addon-image/test/playwright.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const config: PlaywrightTestConfig = {
55
timeout: 10000,
66
projects: [
77
{
8-
name: 'ChromeStable',
8+
name: 'Chromium',
99
use: {
10-
browserName: 'chromium',
11-
channel: 'chrome'
10+
browserName: 'chromium'
1211
}
1312
},
1413
{

addons/addon-ligatures/src/font.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
4242
if (status && status.state !== 'granted') {
4343
throw new Error('Permission to access local fonts not granted.');
4444
}
45-
} catch (err: any) {
45+
} catch (err: unknown) {
4646
// A `TypeError` indicates the 'local-fonts'
4747
// permission is not yet implemented, so
4848
// only `throw` if this is _not_ the problem.
49-
if (err.name !== 'TypeError') {
49+
if (err instanceof Error && err.name !== 'TypeError') {
5050
throw err;
5151
}
5252
}
@@ -60,8 +60,10 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
6060
fonts[metadata.family].push(metadata);
6161
}
6262
fontsPromise = Promise.resolve(fonts);
63-
} catch (err: any) {
64-
console.error(err.name, err.message);
63+
} catch (err: unknown) {
64+
if (err instanceof Error) {
65+
console.error(err.name, err.message);
66+
}
6567
}
6668
}
6769
// Latest proposal https://bugs.chromium.org/p/chromium/issues/detail?id=1312603
@@ -76,8 +78,10 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
7678
fonts[metadata.family].push(metadata);
7779
}
7880
fontsPromise = Promise.resolve(fonts);
79-
} catch (err: any) {
80-
console.error(err.name, err.message);
81+
} catch (err: unknown) {
82+
if (err instanceof Error) {
83+
console.error(err.name, err.message);
84+
}
8185
}
8286
}
8387
fontsPromise ??= Promise.resolve({});

addons/addon-ligatures/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function enableLigatures(term: Terminal, fallbackLigatures: string[] = []
3030
let currentFontName: string | undefined = undefined;
3131
let font: Font | undefined = undefined;
3232
let loadingState: LoadingState = LoadingState.UNLOADED;
33-
let loadError: any | undefined = undefined;
33+
let loadError: unknown = undefined;
3434

3535
return term.registerCharacterJoiner((text: string): [number, number][] => {
3636
// If the font hasn't been loaded yet, load it and return an empty result

0 commit comments

Comments
 (0)