From 497d7b5ef995d304822ea2b9f1c4fec48c741e99 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 17:06:57 -0700 Subject: [PATCH 1/7] Move redux logging to a different file --- .vscode/launch.json | 6 +- build/ci/templates/globals.yml | 1 + package-lock.json | 72 ++++++++ package.json | 9 +- .../interactive-common/redux/store.ts | 18 +- .../redux/testReduxLogger.ts | 165 ++++++++++++++++++ 6 files changed, 265 insertions(+), 6 deletions(-) create mode 100644 src/datascience-ui/interactive-common/redux/testReduxLogger.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index d993f2622cf5..6655ac327c6a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -234,16 +234,16 @@ "--ui=tdd", "--recursive", "--colors", - //"--grep", "", + "--grep", "LiveLoss", "--timeout=300000" ], "env": { // Remove `X` prefix to test with real python (for DS functional tests). - "XVSCODE_PYTHON_ROLLING": "1", + "VSCODE_PYTHON_ROLLING": "1", // Remove 'X' to turn on all logging in the debug output "XVSC_PYTHON_FORCE_LOGGING": "1", // Remove `X` prefix and update path to test with real python interpreter (for DS functional tests). - "XCI_PYTHON_PATH": "" + "XCI_PYTHON_PATH": "", }, "outFiles": [ "${workspaceFolder}/out/**/*.js" diff --git a/build/ci/templates/globals.yml b/build/ci/templates/globals.yml index 653f763266ac..993d41b98d18 100644 --- a/build/ci/templates/globals.yml +++ b/build/ci/templates/globals.yml @@ -6,6 +6,7 @@ variables: MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). VSC_PYTHON_FORCE_LOGGING: true # Enable this to turn on console output for the logger VSC_PYTHON_LOG_FILE: '$(Build.ArtifactStagingDirectory)/pvsc.log' + VSC_PYTHON_WEBVIEW_LOG_FILE: '$(Build.ArtifactStagingDirectory)/pvsc_webview.log' CI_BRANCH_NAME: ${Build.SourceBranchName} npm_config_cache: $(Pipeline.Workspace)/.npm vmImageMacOS: 'macOS-10.15' diff --git a/package-lock.json b/package-lock.json index 0018b952fe69..bcd06599a795 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6639,6 +6639,11 @@ } } }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==" + }, "date-now": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", @@ -8586,6 +8591,11 @@ } } }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==" + }, "flush-write-stream": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", @@ -12107,6 +12117,28 @@ "chalk": "^2.0.1" } }, + "log4js": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.1.2.tgz", + "integrity": "sha512-knS4Y30pC1e0n7rfx3VxcLOdBCsEo0o6/C7PVTGxdVK+5b1TYOSGQPn9FDcrhkoQBV29qwmA2mtkznPAQKnxQg==", + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, "logform": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/logform/-/logform-2.1.2.tgz", @@ -16574,6 +16606,11 @@ "wipe-webpack-cache": "^2.1.0" } }, + "rfdc": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -17800,6 +17837,41 @@ "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=", "dev": true }, + "streamroller": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.3.tgz", + "integrity": "sha512-AegmvQsscTRhHVO46PhCDerjIpxi7E+d2GxgUDu+nzw/HuLnUdxHWr6WQ+mVn/4iJgMKKFFdiUwFcFRDvcjCtw==", + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", diff --git a/package.json b/package.json index bae543b1ba12..f92b72b3ffb9 100644 --- a/package.json +++ b/package.json @@ -1377,7 +1377,9 @@ "default": "127.0.0.1" } }, - "required": ["port"] + "required": [ + "port" + ] }, "listen": { "type": "object", @@ -1393,7 +1395,9 @@ "default": "127.0.0.1" } }, - "required": ["port"] + "required": [ + "port" + ] }, "port": { "type": "number", @@ -2918,6 +2922,7 @@ "koa-logger": "^3.2.1", "line-by-line": "^0.1.6", "lodash": "^4.17.15", + "log4js": "^6.1.2", "md5": "^2.2.1", "minimatch": "^3.0.4", "named-js-regexp": "^1.3.3", diff --git a/src/datascience-ui/interactive-common/redux/store.ts b/src/datascience-ui/interactive-common/redux/store.ts index 04a41739f9e8..e6532881fd1f 100644 --- a/src/datascience-ui/interactive-common/redux/store.ts +++ b/src/datascience-ui/interactive-common/redux/store.ts @@ -2,8 +2,11 @@ // Licensed under the MIT License. 'use strict'; import * as fastDeepEqual from 'fast-deep-equal'; +import * as log4js from 'log4js'; +import * as path from 'path'; import * as Redux from 'redux'; import { createLogger } from 'redux-logger'; +import { EXTENSION_ROOT_DIR } from '../../../client/constants'; import { Identifiers } from '../../../client/datascience/constants'; import { InteractiveWindowMessages } from '../../../client/datascience/interactive-common/interactiveWindowTypes'; import { MessageType } from '../../../client/datascience/interactive-common/synchronization'; @@ -114,6 +117,18 @@ function createSendInfoMiddleware(): Redux.Middleware<{}, IStore> { }; } +function createTestLogger() { + const logFileEnv = process.env.VSC_PYTHON_WEBVIEW_LOG_FILE; + if (logFileEnv) { + const logFilePath = path.isAbsolute(logFileEnv) ? logFileEnv : path.join(EXTENSION_ROOT_DIR, logFileEnv); + log4js.configure({ + appenders: { reduxLogger: { type: 'file', filename: logFilePath } }, + categories: { default: { appenders: ['reduxLogger'], level: 'debug' } } + }); + return log4js.getLogger(); + } +} + function createTestMiddleware(): Redux.Middleware<{}, IStore> { // Make sure all dynamic imports are loaded. const transformPromise = forceLoad(); @@ -243,7 +258,8 @@ function createMiddleWare(testMode: boolean): Redux.Middleware<{}, IStore>[] { return { ...action, payload: reduceLogMessage }; } return action; - } + }, + logger: testMode ? createTestLogger() : undefined }); // On CI we might want to disable logging, as its a big wall of text. // TO disable that add the variable `VSC_PYTHON_DS_NO_REDUX_LOGGING=1` diff --git a/src/datascience-ui/interactive-common/redux/testReduxLogger.ts b/src/datascience-ui/interactive-common/redux/testReduxLogger.ts new file mode 100644 index 000000000000..158c9647ecc7 --- /dev/null +++ b/src/datascience-ui/interactive-common/redux/testReduxLogger.ts @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import * as fs from 'fs-extra'; +import * as path from 'path'; +import { noop } from '../../../client/common/utils/misc'; +import { EXTENSION_ROOT_DIR } from '../../../client/constants'; + +// This logger will log console output to a file instead the console. +export class TestReduxLogger { + // tslint:disable: no-any + public memory: any; + private logStream: fs.WriteStream | undefined; + constructor() { + this.createLogStream(); + } + public assert(condition?: boolean | undefined, message?: string | undefined, ...data: any[]): void; + public assert(value: any, message?: string | undefined, ...optionalParams: any[]): void; + public assert(_value?: any, _message?: any, ..._doptionalParams: any[]) { + // Skip asserts + noop(); + } + public clear(): void; + public clear(): void; + public clear() { + this.closeLogStream().then(() => this.createLogStream()); + } + public count(label?: string | undefined): void; + public count(label?: string | undefined): void; + public count(label?: any) { + throw new Error('Method not implemented.'); + } + public debug(message?: any, ...optionalParams: any[]): void; + public debug(message?: any, ...optionalParams: any[]): void; + public debug(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public dir(value?: any, ...optionalParams: any[]): void; + public dir(obj: any, options?: NodeJS.InspectOptions | undefined): void; + public dir(obj?: any, options?: any, ...rest: any[]) { + throw new Error('Method not implemented.'); + } + public dirxml(value: any): void; + public dirxml(...data: any[]): void; + public dirxml(value?: any, ...rest: any[]) { + throw new Error('Method not implemented.'); + } + public error(message?: any, ...optionalParams: any[]): void; + public error(message?: any, ...optionalParams: any[]): void; + public error(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public exception(message?: string | undefined, ...optionalParams: any[]): void { + throw new Error('Method not implemented.'); + } + public group(groupTitle?: string | undefined, ...optionalParams: any[]): void; + public group(...label: any[]): void; + public group(groupTitle?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public groupCollapsed(groupTitle?: string | undefined, ...optionalParams: any[]): void; + public groupCollapsed(): void; + public groupCollapsed(groupTitle?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public groupEnd(): void; + public groupEnd(): void; + public groupEnd() { + throw new Error('Method not implemented.'); + } + public info(message?: any, ...optionalParams: any[]): void; + public info(message?: any, ...optionalParams: any[]): void; + public info(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public log(message?: any, ...optionalParams: any[]): void; + public log(message?: any, ...optionalParams: any[]): void; + public log(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public markTimeline(label?: string | undefined): void; + public markTimeline(label?: string | undefined): void; + public markTimeline(label?: any) { + throw new Error('Method not implemented.'); + } + public profile(reportName?: string | undefined): void; + public profile(label?: string | undefined): void; + public profile(label?: any) { + throw new Error('Method not implemented.'); + } + public profileEnd(reportName?: string | undefined): void; + public profileEnd(label?: string | undefined): void; + public profileEnd(label?: any) { + throw new Error('Method not implemented.'); + } + public table(...tabularData: any[]): void; + public table(tabularData: any, properties?: string[] | undefined): void; + public table(tabularData?: any, properties?: any, ...rest: any[]) { + throw new Error('Method not implemented.'); + } + public time(label?: string | undefined): void; + public time(label?: string | undefined): void; + public time(label?: any) { + throw new Error('Method not implemented.'); + } + public timeEnd(label?: string | undefined): void; + public timeEnd(label?: string | undefined): void; + public timeEnd(label?: any) { + throw new Error('Method not implemented.'); + } + public timeStamp(label?: string | undefined): void; + public timeStamp(label?: string | undefined): void; + public timeStamp(label?: any) { + throw new Error('Method not implemented.'); + } + public timeline(label?: string | undefined): void; + public timeline(label?: string | undefined): void; + public timeline(label?: any) { + throw new Error('Method not implemented.'); + } + public timelineEnd(label?: string | undefined): void; + public timelineEnd(label?: string | undefined): void; + public timelineEnd(label?: any) { + throw new Error('Method not implemented.'); + } + public trace(message?: any, ...optionalParams: any[]): void; + public trace(message?: any, ...optionalParams: any[]): void; + public trace(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public warn(message?: any, ...optionalParams: any[]): void; + public warn(message?: any, ...optionalParams: any[]): void; + public warn(message?: any, ...optionalParams: any[]) { + throw new Error('Method not implemented.'); + } + public countReset(label?: string | undefined): void { + throw new Error('Method not implemented.'); + } + public timeLog(label?: string | undefined, ...data: any[]): void { + throw new Error('Method not implemented.'); + } + private write(message?: any, ...optionalParams: any[]): void { + if (this.logStream) { + this.logStream.write(message); + } + } + private closeLogStream(): Promise { + return new Promise((resolve, _reject) => { + if (this.logStream) { + this.logStream.on('finished', resolve); + this.logStream.close(); + this.logStream.end(); + this.logStream = undefined; + } else { + resolve(); + } + }); + } + private createLogStream() { + const logFileEnv = process.env.VSC_PYTHON_WEBVIEW_LOG_FILE; + if (logFileEnv) { + const logFilePath = path.isAbsolute(logFileEnv) ? logFileEnv : path.join(EXTENSION_ROOT_DIR, logFileEnv); + this.logStream = fs.createWriteStream(logFilePath, { flags: 'w', encoding: 'utf-8', autoClose: true }); + } + } +} From 21203d0dc35a012760d7f8f7eddf1330ffa6a06c Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 17:12:39 -0700 Subject: [PATCH 2/7] Put back launch.json --- .vscode/launch.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6655ac327c6a..65ac14a02553 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -234,12 +234,12 @@ "--ui=tdd", "--recursive", "--colors", - "--grep", "LiveLoss", + //"--grep", "", "--timeout=300000" ], "env": { // Remove `X` prefix to test with real python (for DS functional tests). - "VSCODE_PYTHON_ROLLING": "1", + "XVSCODE_PYTHON_ROLLING": "1", // Remove 'X' to turn on all logging in the debug output "XVSC_PYTHON_FORCE_LOGGING": "1", // Remove `X` prefix and update path to test with real python interpreter (for DS functional tests). From d9cd2b731918fcd578bdaf3f8fb8c35c813080cd Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 17:13:25 -0700 Subject: [PATCH 3/7] Delete unnecessary file --- .../redux/testReduxLogger.ts | 165 ------------------ 1 file changed, 165 deletions(-) delete mode 100644 src/datascience-ui/interactive-common/redux/testReduxLogger.ts diff --git a/src/datascience-ui/interactive-common/redux/testReduxLogger.ts b/src/datascience-ui/interactive-common/redux/testReduxLogger.ts deleted file mode 100644 index 158c9647ecc7..000000000000 --- a/src/datascience-ui/interactive-common/redux/testReduxLogger.ts +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import * as fs from 'fs-extra'; -import * as path from 'path'; -import { noop } from '../../../client/common/utils/misc'; -import { EXTENSION_ROOT_DIR } from '../../../client/constants'; - -// This logger will log console output to a file instead the console. -export class TestReduxLogger { - // tslint:disable: no-any - public memory: any; - private logStream: fs.WriteStream | undefined; - constructor() { - this.createLogStream(); - } - public assert(condition?: boolean | undefined, message?: string | undefined, ...data: any[]): void; - public assert(value: any, message?: string | undefined, ...optionalParams: any[]): void; - public assert(_value?: any, _message?: any, ..._doptionalParams: any[]) { - // Skip asserts - noop(); - } - public clear(): void; - public clear(): void; - public clear() { - this.closeLogStream().then(() => this.createLogStream()); - } - public count(label?: string | undefined): void; - public count(label?: string | undefined): void; - public count(label?: any) { - throw new Error('Method not implemented.'); - } - public debug(message?: any, ...optionalParams: any[]): void; - public debug(message?: any, ...optionalParams: any[]): void; - public debug(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public dir(value?: any, ...optionalParams: any[]): void; - public dir(obj: any, options?: NodeJS.InspectOptions | undefined): void; - public dir(obj?: any, options?: any, ...rest: any[]) { - throw new Error('Method not implemented.'); - } - public dirxml(value: any): void; - public dirxml(...data: any[]): void; - public dirxml(value?: any, ...rest: any[]) { - throw new Error('Method not implemented.'); - } - public error(message?: any, ...optionalParams: any[]): void; - public error(message?: any, ...optionalParams: any[]): void; - public error(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public exception(message?: string | undefined, ...optionalParams: any[]): void { - throw new Error('Method not implemented.'); - } - public group(groupTitle?: string | undefined, ...optionalParams: any[]): void; - public group(...label: any[]): void; - public group(groupTitle?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public groupCollapsed(groupTitle?: string | undefined, ...optionalParams: any[]): void; - public groupCollapsed(): void; - public groupCollapsed(groupTitle?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public groupEnd(): void; - public groupEnd(): void; - public groupEnd() { - throw new Error('Method not implemented.'); - } - public info(message?: any, ...optionalParams: any[]): void; - public info(message?: any, ...optionalParams: any[]): void; - public info(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public log(message?: any, ...optionalParams: any[]): void; - public log(message?: any, ...optionalParams: any[]): void; - public log(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public markTimeline(label?: string | undefined): void; - public markTimeline(label?: string | undefined): void; - public markTimeline(label?: any) { - throw new Error('Method not implemented.'); - } - public profile(reportName?: string | undefined): void; - public profile(label?: string | undefined): void; - public profile(label?: any) { - throw new Error('Method not implemented.'); - } - public profileEnd(reportName?: string | undefined): void; - public profileEnd(label?: string | undefined): void; - public profileEnd(label?: any) { - throw new Error('Method not implemented.'); - } - public table(...tabularData: any[]): void; - public table(tabularData: any, properties?: string[] | undefined): void; - public table(tabularData?: any, properties?: any, ...rest: any[]) { - throw new Error('Method not implemented.'); - } - public time(label?: string | undefined): void; - public time(label?: string | undefined): void; - public time(label?: any) { - throw new Error('Method not implemented.'); - } - public timeEnd(label?: string | undefined): void; - public timeEnd(label?: string | undefined): void; - public timeEnd(label?: any) { - throw new Error('Method not implemented.'); - } - public timeStamp(label?: string | undefined): void; - public timeStamp(label?: string | undefined): void; - public timeStamp(label?: any) { - throw new Error('Method not implemented.'); - } - public timeline(label?: string | undefined): void; - public timeline(label?: string | undefined): void; - public timeline(label?: any) { - throw new Error('Method not implemented.'); - } - public timelineEnd(label?: string | undefined): void; - public timelineEnd(label?: string | undefined): void; - public timelineEnd(label?: any) { - throw new Error('Method not implemented.'); - } - public trace(message?: any, ...optionalParams: any[]): void; - public trace(message?: any, ...optionalParams: any[]): void; - public trace(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public warn(message?: any, ...optionalParams: any[]): void; - public warn(message?: any, ...optionalParams: any[]): void; - public warn(message?: any, ...optionalParams: any[]) { - throw new Error('Method not implemented.'); - } - public countReset(label?: string | undefined): void { - throw new Error('Method not implemented.'); - } - public timeLog(label?: string | undefined, ...data: any[]): void { - throw new Error('Method not implemented.'); - } - private write(message?: any, ...optionalParams: any[]): void { - if (this.logStream) { - this.logStream.write(message); - } - } - private closeLogStream(): Promise { - return new Promise((resolve, _reject) => { - if (this.logStream) { - this.logStream.on('finished', resolve); - this.logStream.close(); - this.logStream.end(); - this.logStream = undefined; - } else { - resolve(); - } - }); - } - private createLogStream() { - const logFileEnv = process.env.VSC_PYTHON_WEBVIEW_LOG_FILE; - if (logFileEnv) { - const logFilePath = path.isAbsolute(logFileEnv) ? logFileEnv : path.join(EXTENSION_ROOT_DIR, logFileEnv); - this.logStream = fs.createWriteStream(logFilePath, { flags: 'w', encoding: 'utf-8', autoClose: true }); - } - } -} From 3fb9085790253c77c88af51356246c3286d9272f Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 17:21:01 -0700 Subject: [PATCH 4/7] Fix it so only loads during tests --- src/datascience-ui/interactive-common/redux/store.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/datascience-ui/interactive-common/redux/store.ts b/src/datascience-ui/interactive-common/redux/store.ts index e6532881fd1f..e9475adc078a 100644 --- a/src/datascience-ui/interactive-common/redux/store.ts +++ b/src/datascience-ui/interactive-common/redux/store.ts @@ -2,7 +2,6 @@ // Licensed under the MIT License. 'use strict'; import * as fastDeepEqual from 'fast-deep-equal'; -import * as log4js from 'log4js'; import * as path from 'path'; import * as Redux from 'redux'; import { createLogger } from 'redux-logger'; @@ -120,6 +119,8 @@ function createSendInfoMiddleware(): Redux.Middleware<{}, IStore> { function createTestLogger() { const logFileEnv = process.env.VSC_PYTHON_WEBVIEW_LOG_FILE; if (logFileEnv) { + // tslint:disable-next-line: no-require-imports + const log4js = require('log4js') as typeof import('log4js'); const logFilePath = path.isAbsolute(logFileEnv) ? logFileEnv : path.join(EXTENSION_ROOT_DIR, logFileEnv); log4js.configure({ appenders: { reduxLogger: { type: 'file', filename: logFilePath } }, From b704b49801ca93084162fafbfc32f7b16cbda6e9 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 17:50:03 -0700 Subject: [PATCH 5/7] Update dependency list --- gulpfile.js | 4 +- package.datascience-ui.dependencies.json | 511 ++++++++++++----------- 2 files changed, 268 insertions(+), 247 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 66bed78babbd..1b00f5043b01 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -274,7 +274,9 @@ function getAllowedWarningsForWebPack(buildConfig) { 'WARNING in ./node_modules/ws/lib/validation.js', 'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/buffer-util.js', 'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/validation.js', - 'WARNING in ./node_modules/any-promise/register.js' + 'WARNING in ./node_modules/any-promise/register.js', + 'WARNING in ./node_modules/log4js/lib/appenders/index.js', + 'WARNING in ./node_modules/log4js/lib/clustering.js' ]; case 'extension': return [ diff --git a/package.datascience-ui.dependencies.json b/package.datascience-ui.dependencies.json index 7eba4d7fb8cf..2f28d8e4fe1d 100644 --- a/package.datascience-ui.dependencies.json +++ b/package.datascience-ui.dependencies.json @@ -1,247 +1,266 @@ [ - "@babel/runtime", - "@babel/runtime-corejs2", - "@emotion/hash", - "@emotion/memoize", - "@emotion/stylis", - "@emotion/unitless", - "@loadable/component", - "@mapbox/polylabel", - "@nteract/markdown", - "@nteract/mathjax", - "@nteract/octicons", - "@nteract/transform-dataresource", - "@nteract/transform-geojson", - "@nteract/transform-model-debug", - "@nteract/transform-plotly", - "@nteract/transform-vdom", - "@nteract/transform-vega", - "@nteract/transforms", - "@blueprintjs/core", - "@blueprintjs/icons", - "@blueprintjs/select", - "@icons/material", - "@nteract/styled-blueprintjsx", - "@nteract/vega-embed-v2", - "@nteract/vega-embed-v3", - "anser", - "ansi-regex", - "ansi-to-html", - "ansi-to-react", - "babel-polyfill", - "babel-runtime", - "bail", - "base16", - "bintrees", - "bootstrap-less", - "base64-js", - "create-react-context", - "character-entities-legacy", - "character-reference-invalid", - "classnames", - "clsx", - "collapse-white-space", - "create-emotion", - "css-loader", - "canvas", - "dom4", - "d3-array", - "d3-bboxCollide", - "d3-brush", - "d3-chord", - "d3-collection", - "d3-color", - "d3-contour", - "d3-dispatch", - "d3-drag", - "d3-ease", - "d3-force", - "d3-format", - "d3-glyphedge", - "d3-hexbin", - "d3-hierarchy", - "d3-interpolate", - "d3-path", - "d3-polygon", - "d3-quadtree", - "d3-sankey-circular", - "d3-scale", - "d3-selection", - "d3-shape", - "d3-time-format", - "d3-time", - "d3-timer", - "d3-transition", - "d3-voronoi", - "dom-helpers", - "d3-cloud", - "d3-delaunay", - "d3-dsv", - "d3-geo", - "d3-request", - "d3-scale-chromatic", - "d3", - "datalib", - "delaunator", - "define-properties", - "emotion", - "entities", - "escape-carriage", - "extend", - "fast-deep-equal", - "fast-plist", - "fast-json-stable-stringify", - "function-bind", - "gud", - "has", - "hoist-non-react-statics", - "inherits", - "invariant", - "is-alphabetical", - "is-alphanumerical", - "is-arguments", - "is-buffer", - "is-date-object", - "is-decimal", - "is-hexadecimal", - "is-plain-obj", - "is-regex", - "is-whitespace-character", - "is-word-character", - "ieee754", - "isarray", - "json2csv", - "json-stable-stringify", - "json-stringify-pretty-compact", - "jsonify", - "labella", - "leaflet", - "linear-layout-vector", - "lodash.curry", - "lodash.flow", - "lodash", - "lru-cache", - "martinez-polygon-clipping", - "markdown-escapes", - "material-colors", - "mdast-add-list-metadata", - "monaco-editor", - "monaco-editor-textmate", - "monaco-textmate", - "numeral", - "node-libs-browser", - "object-assign", - "object-is", - "object-keys", - "onigasm", - "popper.js", - "parse-entities", - "path-browserify", - "polygon-offset", - "plotly.js-dist", - "process", - "prop-types", - "pseudomap", - "pure-color", - "react-is", - "react-popper", - "react-transition-group", - "regexp.prototype.flags", - "regression", - "replace-ext", - "resize-observer-polyfill", - "react-annotation", - "react-base16-styling", - "react-color", - "react-data-grid", - "react-dom", - "react-hot-loader", - "react-json-tree", - "react-lifecycles-compat", - "react-markdown", - "react-redux", - "react-svg-pan-zoom", - "react-svgmt", - "react-table-hoc-fixed-columns", - "react-table", - "react-virtualized", - "react", - "reactcss", - "redux-logger", - "redux", - "remark-parse", - "repeat-string", - "roughjs-es5", - "scheduler", - "semiotic-mark", - "semiotic", - "setimmediate", - "slickgrid", - "state-toggle", - "string-hash", - "style-loader", - "styled-jsx", - "stylis-rule-sheet", - "svg-inline-react", - "svg-path-bounding-box", - "svgpath", - "semver", - "timers-browserify", - "tinycolor2", - "tinyqueue", - "transformation-matrix", - "trim-trailing-lines", - "trim", - "trough", - "topojson-client", - "tslib", - "unherit", - "unified", - "uniqid", - "unist-util-is", - "unist-util-remove-position", - "unist-util-stringify-position", - "unist-util-visit-parents", - "unist-util-visit", - "util", - "uuid", - "vfile-location", - "vfile-message", - "vfile", - "viz-annotation", - "vega-canvas", - "vega-crossfilter", - "vega-dataflow", - "vega-embed", - "vega-encode", - "vega-event-selector", - "vega-expression", - "vega-force", - "vega-functions", - "vega-geo", - "vega-hierarchy", - "vega-lite", - "vega-loader", - "vega-parser", - "vega-projection", - "vega-regression", - "vega-runtime", - "vega-scale", - "vega-scenegraph", - "vega-schema-url-parser", - "vega-selections", - "vega-statistics", - "vega-themes", - "vega-tooltip", - "vega-transforms", - "vega-util", - "vega-view-transforms", - "vega-view", - "vega-voronoi", - "vega-wordcloud", - "vega", - "warning", - "x-is-string", - "xtend", - "yallist" -] + "@babel/runtime", + "@babel/runtime-corejs2", + "@emotion/hash", + "@emotion/memoize", + "@emotion/stylis", + "@emotion/unitless", + "@loadable/component", + "@mapbox/polylabel", + "@nteract/markdown", + "@nteract/mathjax", + "@nteract/octicons", + "@nteract/transform-dataresource", + "@nteract/transform-geojson", + "@nteract/transform-model-debug", + "@nteract/transform-plotly", + "@nteract/transform-vdom", + "@nteract/transform-vega", + "@nteract/transforms", + "@blueprintjs/core", + "@blueprintjs/icons", + "@blueprintjs/select", + "@icons/material", + "@nteract/styled-blueprintjsx", + "@nteract/vega-embed-v2", + "@nteract/vega-embed-v3", + "anser", + "ansi-regex", + "ansi-to-html", + "ansi-to-react", + "assert", + "babel-polyfill", + "babel-runtime", + "bail", + "base16", + "bintrees", + "bootstrap-less", + "base64-js", + "browserify-zlib", + "create-react-context", + "character-entities-legacy", + "character-reference-invalid", + "classnames", + "clsx", + "collapse-white-space", + "create-emotion", + "css-loader", + "canvas", + "core-util-is", + "constants-browserify", + "dom4", + "d3-array", + "d3-bboxCollide", + "d3-brush", + "d3-chord", + "d3-collection", + "d3-color", + "d3-contour", + "d3-dispatch", + "d3-drag", + "d3-ease", + "d3-force", + "d3-format", + "d3-glyphedge", + "d3-hexbin", + "d3-hierarchy", + "d3-interpolate", + "d3-path", + "d3-polygon", + "d3-quadtree", + "d3-sankey-circular", + "d3-scale", + "d3-selection", + "d3-shape", + "d3-time-format", + "d3-time", + "d3-timer", + "d3-transition", + "d3-voronoi", + "dom-helpers", + "d3-cloud", + "d3-delaunay", + "d3-dsv", + "d3-geo", + "d3-request", + "d3-scale-chromatic", + "d3", + "datalib", + "delaunator", + "define-properties", + "date-format", + "emotion", + "entities", + "escape-carriage", + "extend", + "events", + "fast-deep-equal", + "fast-plist", + "fast-json-stable-stringify", + "function-bind", + "flatted", + "gud", + "graceful-fs", + "has", + "hoist-non-react-statics", + "inherits", + "invariant", + "is-alphabetical", + "is-alphanumerical", + "is-arguments", + "is-buffer", + "is-date-object", + "is-decimal", + "is-hexadecimal", + "is-plain-obj", + "is-regex", + "is-whitespace-character", + "is-word-character", + "ieee754", + "isarray", + "json2csv", + "json-stable-stringify", + "json-stringify-pretty-compact", + "jsonify", + "jsonfile", + "labella", + "log4js", + "leaflet", + "linear-layout-vector", + "lodash.curry", + "lodash.flow", + "lodash", + "lru-cache", + "ms", + "martinez-polygon-clipping", + "markdown-escapes", + "material-colors", + "mdast-add-list-metadata", + "monaco-editor", + "monaco-editor-textmate", + "monaco-textmate", + "numeral", + "node-libs-browser", + "os-browserify", + "object-assign", + "object-is", + "object-keys", + "onigasm", + "popper.js", + "parse-entities", + "path-browserify", + "polygon-offset", + "plotly.js-dist", + "process", + "prop-types", + "pseudomap", + "pure-color", + "rfdc", + "react-is", + "react-popper", + "react-transition-group", + "regexp.prototype.flags", + "regression", + "replace-ext", + "resize-observer-polyfill", + "react-annotation", + "react-base16-styling", + "react-color", + "react-data-grid", + "react-dom", + "react-hot-loader", + "react-json-tree", + "react-lifecycles-compat", + "react-markdown", + "react-redux", + "react-svg-pan-zoom", + "react-svgmt", + "react-table-hoc-fixed-columns", + "react-table", + "react-virtualized", + "react", + "reactcss", + "redux-logger", + "redux", + "remark-parse", + "repeat-string", + "roughjs-es5", + "streamroller", + "stream-browserify", + "string_decoder", + "safe-buffer", + "scheduler", + "semiotic-mark", + "semiotic", + "setimmediate", + "slickgrid", + "state-toggle", + "string-hash", + "style-loader", + "styled-jsx", + "stylis-rule-sheet", + "svg-inline-react", + "svg-path-bounding-box", + "svgpath", + "semver", + "timers-browserify", + "tinycolor2", + "tinyqueue", + "transformation-matrix", + "trim-trailing-lines", + "trim", + "trough", + "topojson-client", + "tslib", + "universalify", + "util-deprecate", + "unherit", + "unified", + "uniqid", + "unist-util-is", + "unist-util-remove-position", + "unist-util-stringify-position", + "unist-util-visit-parents", + "unist-util-visit", + "util", + "uuid", + "vfile-location", + "vfile-message", + "vfile", + "viz-annotation", + "vega-canvas", + "vega-crossfilter", + "vega-dataflow", + "vega-embed", + "vega-encode", + "vega-event-selector", + "vega-expression", + "vega-force", + "vega-functions", + "vega-geo", + "vega-hierarchy", + "vega-lite", + "vega-loader", + "vega-parser", + "vega-projection", + "vega-regression", + "vega-runtime", + "vega-scale", + "vega-scenegraph", + "vega-schema-url-parser", + "vega-selections", + "vega-statistics", + "vega-themes", + "vega-tooltip", + "vega-transforms", + "vega-util", + "vega-view-transforms", + "vega-view", + "vega-voronoi", + "vega-wordcloud", + "vega", + "warning", + "x-is-string", + "xtend", + "yallist" +] \ No newline at end of file From 104629221a006b64f56b550fbf4475343ec6c329 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Mon, 16 Mar 2020 18:16:46 -0700 Subject: [PATCH 6/7] Make sure to exclude log4js when not needed --- build/webpack/webpack.datascience-ui.config.builder.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/webpack/webpack.datascience-ui.config.builder.js b/build/webpack/webpack.datascience-ui.config.builder.js index 928db7271cd9..8535b129fc78 100644 --- a/build/webpack/webpack.datascience-ui.config.builder.js +++ b/build/webpack/webpack.datascience-ui.config.builder.js @@ -190,6 +190,7 @@ function buildConfiguration(isNotebook) { }), ...getPlugins(isNotebook) ], + externals: ['log4js'], resolve: { // Add '.ts' and '.tsx' as resolvable extensions. extensions: ['.ts', '.tsx', '.js', '.json', '.svg'] From 316dd484194f22593cf5c849c0efc58a8c2904b0 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Tue, 17 Mar 2020 08:52:02 -0700 Subject: [PATCH 7/7] Remove unneeded dependencies --- package.datascience-ui.dependencies.json | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/package.datascience-ui.dependencies.json b/package.datascience-ui.dependencies.json index 2f28d8e4fe1d..b03b9f49ccb4 100644 --- a/package.datascience-ui.dependencies.json +++ b/package.datascience-ui.dependencies.json @@ -28,7 +28,6 @@ "ansi-regex", "ansi-to-html", "ansi-to-react", - "assert", "babel-polyfill", "babel-runtime", "bail", @@ -36,7 +35,6 @@ "bintrees", "bootstrap-less", "base64-js", - "browserify-zlib", "create-react-context", "character-entities-legacy", "character-reference-invalid", @@ -46,8 +44,6 @@ "create-emotion", "css-loader", "canvas", - "core-util-is", - "constants-browserify", "dom4", "d3-array", "d3-bboxCollide", @@ -88,19 +84,15 @@ "datalib", "delaunator", "define-properties", - "date-format", "emotion", "entities", "escape-carriage", "extend", - "events", "fast-deep-equal", "fast-plist", "fast-json-stable-stringify", "function-bind", - "flatted", "gud", - "graceful-fs", "has", "hoist-non-react-statics", "inherits", @@ -122,16 +114,13 @@ "json-stable-stringify", "json-stringify-pretty-compact", "jsonify", - "jsonfile", "labella", - "log4js", "leaflet", "linear-layout-vector", "lodash.curry", "lodash.flow", "lodash", "lru-cache", - "ms", "martinez-polygon-clipping", "markdown-escapes", "material-colors", @@ -141,7 +130,6 @@ "monaco-textmate", "numeral", "node-libs-browser", - "os-browserify", "object-assign", "object-is", "object-keys", @@ -155,7 +143,6 @@ "prop-types", "pseudomap", "pure-color", - "rfdc", "react-is", "react-popper", "react-transition-group", @@ -185,10 +172,6 @@ "remark-parse", "repeat-string", "roughjs-es5", - "streamroller", - "stream-browserify", - "string_decoder", - "safe-buffer", "scheduler", "semiotic-mark", "semiotic", @@ -212,8 +195,6 @@ "trough", "topojson-client", "tslib", - "universalify", - "util-deprecate", "unherit", "unified", "uniqid",