Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to no bundling and let extensions decide how they would like to bundle #119

Merged
merged 7 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions .esbuild.config.js

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.vscode
build
.github
lib/*.js.map
lib/*.js
lib/test
!lib/*.min.js
node_modules
src
typings_patches
Expand All @@ -16,4 +12,5 @@ tsfmt.json
.esbuild.config.js
.eslintrc.json
.eslintignore
*.tgz
*.test.ts
File renamed without changes.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
"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"
"build": "npm run compile",
"test": "tsc -p 'test/tsconfig.json' && mocha dist/test/*",
"compile": "tsc -p 'src/browser/tsconfig.json' && tsc -p 'src/node/tsconfig.json'"
},
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.4",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/browser/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lib": ["ES2015","DOM"],
"module": "ES2020",
"moduleResolution": "node",
"outDir": "./lib",
"outDir": "../../dist/browser",
"typeRoots": []
},
"include": [".", "../common", "../../vscode.proposed.telemetry.d.ts"]
Expand Down
4 changes: 2 additions & 2 deletions src/common/1dsClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/common/baseTelemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -148,13 +149,16 @@ 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;
commonProperties["common.nodeArch"] = this.osShim.architecture;
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;
Expand Down
2 changes: 1 addition & 1 deletion src/node/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"lib": ["ES2015", "DOM"],
"module": "CommonJS",
"moduleResolution": "node",
"outDir": "./lib",
"outDir": "../../dist/node",
"typeRoots": []
},
"include": [".", "../common", "../../vscode.proposed.telemetry.d.ts"]
Expand Down
2 changes: 1 addition & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
},
Expand Down
30 changes: 0 additions & 30 deletions thirdpartynotices.txt

This file was deleted.

1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"noEmitOnError": false,
"strict": true,
"resolveJsonModule": true,
"target": "ES2020",
"module": "ES2020",
"esModuleInterop": true,
Expand Down