This commit is contained in:
Logan Ramos 2022-08-31 15:36:56 -04:00
Родитель 5d778578cb
Коммит bdd0fe9008
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: D9CCFF14F0B18183
15 изменённых файлов: 25 добавлений и 103 удалений

Просмотреть файл

@ -1,51 +0,0 @@
const esbuild = require('esbuild');
// Build node packages and their minifed versions
esbuild.build({
entryPoints: ['src/node/telemetryReporter.ts'],
tsconfig: "./src/node/tsconfig.json",
bundle: true,
external: ['vscode', './node_modules/*'],
sourcemap: true,
platform: 'node',
target: ['node14'],
outfile: 'lib/telemetryReporter.node.js',
}).catch(() => process.exit(1))
esbuild.build({
entryPoints: ['src/node/telemetryReporter.ts'],
tsconfig: "./src/node/tsconfig.json",
bundle: true,
sourcemap: false,
external: ['vscode', './node_modules/*'],
minify: true,
platform: 'node',
target: ['node14'],
outfile: 'lib/telemetryReporter.node.min.js',
}).catch(() => process.exit(1))
// Build browser packages and their minified versions
esbuild.build({
entryPoints: ['src/browser/telemetryReporter.ts'],
format: "esm",
tsconfig: "./src/browser/tsconfig.json",
bundle: true,
sourcemap: true,
external: ['vscode', './node_modules/*'],
platform: 'browser',
target: ['es6'],
outfile: 'lib/telemetryReporter.web.js',
}).catch(() => process.exit(1))
esbuild.build({
entryPoints: ['src/browser/telemetryReporter.ts'],
tsconfig: "./src/browser/tsconfig.json",
format: "esm",
bundle: true,
sourcemap: false,
external: ['vscode', './node_modules/*'],
minify: true,
platform: 'browser',
target: ['es6'],
outfile: 'lib/telemetryReporter.web.min.js',
}).catch(() => process.exit(1))

6
.gitignore поставляемый
Просмотреть файл

@ -9,8 +9,10 @@ npm-debug.log
# sourcemaps
src/**/*.js.map
lib/**/*.js.map
lib/**/*.js
# dist
dist/**/*
!dist/**/*.d.ts
# Packaged node modules
*.tgz

Просмотреть файл

@ -1,10 +1,6 @@
.vscode
build
.github
lib/*.js.map
lib/*.js
lib/test
!lib/*.min.js
node_modules
src
typings_patches
@ -16,4 +12,5 @@ tsfmt.json
.esbuild.config.js
.eslintrc.json
.eslintignore
*.tgz
*.test.ts

Просмотреть файл

4
package-lock.json сгенерированный
Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "@vscode/extension-telemetry",
"version": "0.6.2",
"version": "0.6.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@vscode/extension-telemetry",
"version": "0.6.2",
"version": "0.6.3",
"license": "MIT",
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.4",

Просмотреть файл

@ -1,21 +1,21 @@
{
"name": "@vscode/extension-telemetry",
"description": "A module for Visual Studio Code extensions to report consistent telemetry.",
"version": "0.6.2",
"version": "0.6.3",
"author": {
"name": "Microsoft Corporation"
},
"main": "./lib/telemetryReporter.node.min.js",
"browser": "./lib/telemetryReporter.web.min.js",
"main": "./dist/node/src/node/telemetryReporter.js",
"browser": "./dist/browser/src/browser/telemetryReporter.js",
"types": "./lib/telemetryReporter.d.ts",
"license": "MIT",
"engines": {
"vscode": "^1.60.0"
},
"scripts": {
"build": "node .esbuild.config.js",
"build": "npm run compile",
"test": "tsc -p 'test/tsconfig.json' && mocha lib/test/*",
"compile": "tsc -noEmit -p 'src/browser/tsconfig.json' && tsc -noEmit -p 'src/node/tsconfig.json' && npm run build"
"compile": "tsc -p 'src/browser/tsconfig.json' && tsc -p 'src/node/tsconfig.json'"
},
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.4",
@ -30,7 +30,6 @@
"@types/vscode": "^1.60.0",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"esbuild": "^0.14.32",
"eslint": "^8.12.0",
"mocha": "^9.2.2",
"sinon": "^13.0.2",

Просмотреть файл

@ -12,7 +12,7 @@ import { TelemetryUtil } from "../common/util";
const webAppInsightsClientFactory = async (key: string, replacementOptions?: ReplacementOption[]): Promise<BaseTelemetryClient> => {
let appInsightsClient: ApplicationInsights | undefined;
try {
const web = await import("@microsoft/applicationinsights-web");
const web = await import/* webpackMode: "eager" */ ("@microsoft/applicationinsights-web");
appInsightsClient = new web.ApplicationInsights({
config: {
instrumentationKey: key,

Просмотреть файл

@ -4,7 +4,7 @@
"lib": ["ES2015","DOM"],
"module": "ES2020",
"moduleResolution": "node",
"outDir": "./lib",
"outDir": "../../dist/browser",
"typeRoots": []
},
"include": [".", "../common", "../../vscode.proposed.telemetry.d.ts"]

Просмотреть файл

@ -16,8 +16,8 @@ import { AppenderData } from "./baseTelemetryReporter";
* @returns The AI core object
*/
const getAICore = async (key: string, vscodeAPI: typeof vscode, xhrOverride?: IXHROverride): Promise<AppInsightsCore> => {
const oneDs = await import("@microsoft/1ds-core-js");
const postPlugin = await import("@microsoft/1ds-post-js");
const oneDs = await import(/* webpackMode: "eager" */ "@microsoft/1ds-core-js");
const postPlugin = await import(/* webpackMode: "eager" */ "@microsoft/1ds-post-js");
const appInsightsCore = new oneDs.AppInsightsCore();
const collectorChannelPlugin: PostChannel = new postPlugin.PostChannel();
// Configure the app insights core to send to collector++ and disable logging of debug info

Просмотреть файл

@ -3,9 +3,10 @@
*--------------------------------------------------------*/
import type * as vscode from "vscode";
import type { TelemetryEventMeasurements, TelemetryEventProperties, RawTelemetryEventProperties } from "../../lib/telemetryReporter";
import type { TelemetryEventMeasurements, TelemetryEventProperties, RawTelemetryEventProperties } from "../../dist/telemetryReporter";
import { ITelemetryAppender } from "./baseTelemetryAppender";
import { TelemetryLevel, TelemetryUtil } from "./util";
import { version } from "../../package.json";
export interface AppenderData {
properties?: RawTelemetryEventProperties,
@ -148,6 +149,7 @@ export class BaseTelemetryReporter {
// __GDPR__COMMON__ "common.remotename" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
// __GDPR__COMMON__ "common.isnewappinstall" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
// __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
// __GDPR__COMMON__ "common.telemetryclientversion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
private getCommonProperties(): TelemetryEventProperties {
const commonProperties: Record<string, any> = {};
commonProperties["common.os"] = this.osShim.platform;
@ -155,6 +157,8 @@ export class BaseTelemetryReporter {
commonProperties["common.platformversion"] = (this.osShim.release || "").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, "$1$2$3");
commonProperties["common.extname"] = this.extensionId;
commonProperties["common.extversion"] = this.extensionVersion;
// Reads version from package.json
commonProperties["common.telemetryclientversion"] = version;
if (this.vscodeAPI && this.vscodeAPI.env) {
commonProperties["common.vscodemachineid"] = this.vscodeAPI.env.machineId;
commonProperties["common.vscodesessionid"] = this.vscodeAPI.env.sessionId;

Просмотреть файл

@ -24,7 +24,7 @@ const appInsightsClientFactory = async (key: string, replacementOptions?: Replac
let appInsightsClient: TelemetryClient | undefined;
try {
process.env["APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL"] = "1";
const appInsights = await import("applicationinsights");
const appInsights = await import(/* webpackMode: "eager" */ "applicationinsights");
//check if another instance is already initialized
if (appInsights.defaultClient) {
appInsightsClient = new appInsights.TelemetryClient(key);

Просмотреть файл

@ -5,7 +5,7 @@
"lib": ["ES2015", "DOM"],
"module": "CommonJS",
"moduleResolution": "node",
"outDir": "./lib",
"outDir": "../../dist/node",
"typeRoots": []
},
"include": [".", "../common", "../../vscode.proposed.telemetry.d.ts"]

Просмотреть файл

@ -5,7 +5,7 @@
"lib": ["ES2015", "DOM"],
"module": "CommonJS",
"moduleResolution": "node",
"outDir": "../lib/test",
"outDir": "../dist/test",
// Not sure why it cannot find them, but alas it must be pointed out where the types are
"typeRoots": ["../node_modules/@types"]
},

Просмотреть файл

@ -1,30 +0,0 @@
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
For Microsoft vscode-extension-telemetry
This project incorporates material from the projects listed below. The original copyright notice
and the license under which Microsoft received such material are set out below. Microsoft reserves
all other rights not expressly granted, whether by implication, estoppel or otherwise.
1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped)
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Просмотреть файл

@ -2,6 +2,7 @@
"compilerOptions": {
"noEmitOnError": false,
"strict": true,
"resolveJsonModule": true,
"target": "ES2020",
"module": "ES2020",
"esModuleInterop": true,