Skip to content

Commit

Permalink
Upgrading typescript and vscode-extension-telemetry (#2704)
Browse files Browse the repository at this point in the history
Upgrading typescript and vscode-extension-telemetry and making changes to support the upgrades
  • Loading branch information
vidorteg authored Jan 17, 2025
1 parent 2355757 commit f5f257c
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 288 deletions.
399 changes: 133 additions & 266 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,19 +677,18 @@
},
"dependencies": {
"@vscode/codicons": "0.0.36",
"@vscode/extension-telemetry":"0.9.4",
"bufferutil": "4.0.8",
"lit-html": "^3.2.0",
"puppeteer-core": "22.12.1",
"utf-8-validate": "6.0.4",
"vscode-chrome-debug-core": "6.8.11",
"vscode-extension-telemetry": "0.4.1",
"vscode-webhint": "2.1.15",
"ws": "8.18.0",
"xmlhttprequest": "1.8.0"
},
"devDependencies": {
"@opentelemetry/tracing": "0.24.0",
"@types/copy-webpack-plugin": "8.0.1",
"@types/fs-extra": "11.0.4",
"@types/jest": "29.5.14",
"@types/node": "22.5.4",
Expand All @@ -707,12 +706,11 @@
"jest": "29.7.0",
"ts-jest": " 29.2.5",
"ts-loader": "9.5.1",
"typescript": "4.9.4",
"typescript": "5.5.2",
"uglify-js": "3.19.3",
"unzipper": "0.12.3",
"jest-environment-jsdom": "^29.7.0",
"vscode-languageclient": "9.0.1",
"vscode-test": "1.6.1",
"webpack": "5.94.0",
"webpack-cli": "5.1.4"
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdpTargetsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import * as path from 'path';
import * as fs from 'fs';
import { CDPTarget } from './cdpTarget';
Expand Down
4 changes: 2 additions & 2 deletions src/debugTelemetryReporter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';

export class DebugTelemetryReporter extends TelemetryReporter {
constructor() {
super('extensionId', 'extensionVersion', 'key');
super('key');
}

sendTelemetryEvent(
Expand Down
2 changes: 1 addition & 1 deletion src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import { performance } from 'perf_hooks';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { SettingsProvider } from './common/settingsProvider';
import {
encodeMessageForChannel,
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Browser, Target, TargetType } from 'puppeteer-core';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { CDPTarget } from './cdpTarget';
import { CDPTargetsProvider } from './cdpTargetsProvider';
import { DevToolsPanel } from './devtoolsPanel';
Expand Down
2 changes: 1 addition & 1 deletion src/launchDebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import {
IUserConfig,
SETTINGS_STORE_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/screencastPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SETTINGS_SCREENCAST_WEBVIEW_NAME,
SETTINGS_VIEW_NAME,
} from './utils';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { DevToolsPanel } from './devtoolsPanel';
import { providedHeadlessDebugConfig } from './launchConfigManager';

Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import * as url from 'url';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import packageJson from '../package.json';
import { DebugTelemetryReporter } from './debugTelemetryReporter';

Expand Down Expand Up @@ -338,7 +338,7 @@ export async function getJsDebugCDPProxyWebsocketUrl(debugSessionId: string): Pr
export function createTelemetryReporter(_context: vscode.ExtensionContext): Readonly<TelemetryReporter> {
if (packageJson && (_context.extensionMode === vscode.ExtensionMode.Production)) {
// Use the real telemetry reporter
return new TelemetryReporter(packageJson.name, packageJson.version, packageJson.aiKey);
return new TelemetryReporter(packageJson.aiKey);
}
// Fallback to a fake telemetry reporter
return new DebugTelemetryReporter();
Expand Down
2 changes: 1 addition & 1 deletion test/cdpTargetsProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// tslint:disable: variable-name

import { ExtensionContext } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { CDPTarget } from "../src/cdpTarget";
import { createFakeExtensionContext, createFakeTelemetryReporter, createFakeVSCode, Mocked } from "./helpers/helpers";
import { IRemoteTargetJson } from "../src/utils";
Expand Down
2 changes: 1 addition & 1 deletion test/debugTelemetryReporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createFakeVSCode } from "./helpers/helpers";
// eslint-disable no-console

jest.mock("vscode", () => createFakeVSCode(), { virtual: true });
jest.mock("vscode-extension-telemetry");
jest.mock("@vscode/extension-telemetry");

describe("debugTelemetryReporter", () => {
it("gets created successfully", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/devtoolsPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// tslint:disable: variable-name

import { Disposable, ExtensionContext, WebviewPanel } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { TelemetryData, webviewEventNames } from "../src/common/webviewEvents";
import { PanelSocket } from "../src/panelSocket";
import { JsDebugProxyPanelSocket } from "../src/JsDebugProxyPanelSocket";
Expand Down
2 changes: 1 addition & 1 deletion test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import { ExtensionContext, Uri} from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { createFakeExtensionContext, createFakeTelemetryReporter, createFakeVSCode, createFakeLanguageClient, Mocked } from "./helpers/helpers";
import {
buttonCode,
Expand Down
10 changes: 7 additions & 3 deletions test/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { ExtensionContext } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";

// Allow unused variables in the mocks to have leading underscore
// tslint:disable: variable-name
Expand Down Expand Up @@ -162,9 +162,13 @@ export function createFakeExtensionContext() {
export function createFakeTelemetryReporter(): Mocked<Readonly<TelemetryReporter>> {
return {
dispose: jest.fn(),
sendTelemetryErrorEvent: jest.fn(),
sendTelemetryEvent: jest.fn(),
sendTelemetryException: jest.fn(),
sendRawTelemetryEvent: jest.fn(),
sendDangerousTelemetryEvent: jest.fn(),
sendTelemetryErrorEvent: jest.fn(),
sendDangerousTelemetryErrorEvent: jest.fn(),
onDidChangeTelemetryLevel: jest.fn(),
telemetryLevel: "all"
};
}

Expand Down
2 changes: 1 addition & 1 deletion test/launchDebugProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { LaunchDebugProvider } from "../src/launchDebugProvider";
import {
createFakeExtensionContext,
Expand Down
2 changes: 1 addition & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ describe("utils", () => {

it("returns a retail version when valid package in retail env", async () => {
const retailReporter = {};
jest.doMock("vscode-extension-telemetry", () => function retail() { return retailReporter; });
jest.doMock("@vscode/extension-telemetry", () => function retail() { return retailReporter; });
jest.resetModules();
jest.requireMock("vscode").env.machineId = "12345";

Expand Down

0 comments on commit f5f257c

Please sign in to comment.