Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"env": {
"VSC_PYTHON_CI_TEST_GREP": "" // Modify this to run a subset of the single workspace tests
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
Expand Down
97 changes: 50 additions & 47 deletions build/webpack/common.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const glob = require("glob");
const path = require("path");
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
const constants_1 = require("../constants");
exports.nodeModulesToExternalize = [
'unicode/category/Lu',
'unicode/category/Ll',
'unicode/category/Lt',
'unicode/category/Lo',
'unicode/category/Lm',
'unicode/category/Nl',
'unicode/category/Mn',
'unicode/category/Mc',
'unicode/category/Nd',
'unicode/category/Pc',
'@jupyterlab/services',
'azure-storage',
'request',
'request-progress',
'source-map-support',
'diff-match-patch',
'sudo-prompt',
'node-stream-zip',
'xml2js',
'vsls/vscode'
];
function getDefaultPlugins(name) {
const plugins = [];
if (!constants_1.isCI) {
plugins.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.analyzer.html`
}));
}
return plugins;
}
exports.getDefaultPlugins = getDefaultPlugins;
function getListOfExistingModulesInOutDir() {
const outDir = path.join(constants_1.ExtensionRootDir, 'out', 'client');
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
return files.map(filePath => `./${filePath.slice(0, -3)}`);
}
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
// Copyright (c) Microsoft Corporation. All rights reserved.

@IanMatthewHuff IanMatthewHuff Mar 5, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code flow is not showing a change in this file. What changed? #ByDesign

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there's a bunch like this. Or there's about to be. I think it's just line endings. Git will skip these on the real commit.


In reply to: 262688394 [](ancestors = 262688394)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry the 'about to be' is me ingesting a new liveshare npm module. They broke our install again with a requirement we don't minify their js.


In reply to: 262689934 [](ancestors = 262689934,262688394)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that means I have to rework the 'fix' for release mode again.


In reply to: 262690183 [](ancestors = 262690183,262689934,262688394)

// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const glob = require("glob");
const path = require("path");
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
const constants_1 = require("../constants");
exports.nodeModulesToExternalize = [
'unicode/category/Lu',
'unicode/category/Ll',
'unicode/category/Lt',
'unicode/category/Lo',
'unicode/category/Lm',
'unicode/category/Nl',
'unicode/category/Mn',
'unicode/category/Mc',
'unicode/category/Nd',
'unicode/category/Pc',
'@jupyterlab/services',
'azure-storage',
'request',
'request-progress',
'source-map-support',
'diff-match-patch',
'sudo-prompt',
'node-stream-zip',
'xml2js',
'vsls/vscode',
];
exports.nodeModulesToReplacePaths = [
...exports.nodeModulesToExternalize
];
function getDefaultPlugins(name) {
const plugins = [];
if (!constants_1.isCI) {
plugins.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.analyzer.html`
}));
}
return plugins;
}
exports.getDefaultPlugins = getDefaultPlugins;
function getListOfExistingModulesInOutDir() {
const outDir = path.join(constants_1.ExtensionRootDir, 'out', 'client');
const files = glob.sync('**/*.js', { sync: true, cwd: outDir });
return files.map(filePath => `./${filePath.slice(0, -3)}`);
}
exports.getListOfExistingModulesInOutDir = getListOfExistingModulesInOutDir;
6 changes: 5 additions & 1 deletion build/webpack/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ export const nodeModulesToExternalize = [
'sudo-prompt',
'node-stream-zip',
'xml2js',
'vsls/vscode'
'vsls/vscode',
];

export const nodeModulesToReplacePaths = [
...nodeModulesToExternalize
]

export function getDefaultPlugins(name: 'extension' | 'debugger' | 'dependencies' | 'datascience-ui') {
const plugins = [];
if (!isCI) {
Expand Down
42 changes: 21 additions & 21 deletions build/webpack/loaders/externalizeDependencies.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("../common");
function replaceModule(contents, moduleName, quotes) {
const stringToSearch = `${quotes}${moduleName}${quotes}`;
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
}
// tslint:disable:no-default-export no-invalid-this
function default_1(source) {
common_1.nodeModulesToExternalize.forEach(moduleName => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, '\'');
}
});
return source;
}
exports.default = default_1;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("../common");
function replaceModule(contents, moduleName, quotes) {
const stringToSearch = `${quotes}${moduleName}${quotes}`;
const stringToReplaceWith = `${quotes}./node_modules/${moduleName}${quotes}`;
return contents.replace(new RegExp(stringToSearch, 'gm'), stringToReplaceWith);
}
// tslint:disable:no-default-export no-invalid-this
function default_1(source) {
common_1.nodeModulesToReplacePaths.forEach(moduleName => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, '\'');
}
});
return source;
}
exports.default = default_1;
4 changes: 2 additions & 2 deletions build/webpack/loaders/externalizeDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

'use strict';

import { nodeModulesToExternalize } from '../common';
import { nodeModulesToReplacePaths } from '../common';

function replaceModule(contents: string, moduleName: string, quotes: '"' | '\''): string {
const stringToSearch = `${quotes}${moduleName}${quotes}`;
Expand All @@ -12,7 +12,7 @@ function replaceModule(contents: string, moduleName: string, quotes: '"' | '\'')
}
// tslint:disable:no-default-export no-invalid-this
export default function (source: string) {
nodeModulesToExternalize.forEach(moduleName => {
nodeModulesToReplacePaths.forEach(moduleName => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, '\'');
Expand Down
108 changes: 57 additions & 51 deletions build/webpack/webpack.extension.dependencies.config.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const constants_1 = require("../constants");
const common_1 = require("./common");
const entryItems = {};
common_1.nodeModulesToExternalize.forEach(moduleName => {
entryItems[`node_modules/${moduleName}`] = `./node_modules/${moduleName}`;
});
const config = {
mode: 'production',
target: 'node',
entry: entryItems,
devtool: 'source-map',
node: {
__dirname: false
},
module: {
rules: [
{
// JupyterServices imports node-fetch using `eval`.
test: /@jupyterlab[\\\/]services[\\\/].*js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js')
}
]
}
]
},
externals: [
'vscode',
'commonjs'
],
plugins: [
...common_1.getDefaultPlugins('dependencies')
],
resolve: {
extensions: ['.js']
},
output: {
filename: '[name].js',
path: path.resolve(constants_1.ExtensionRootDir, 'out', 'client'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../../[resource-path]'
}
};
// tslint:disable-next-line:no-default-export
exports.default = config;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const constants_1 = require("../constants");
const common_1 = require("./common");
const copyWebpackPlugin = require("copy-webpack-plugin");
const entryItems = {};
common_1.nodeModulesToExternalize.forEach(moduleName => {
entryItems[`node_modules/${moduleName}`] = `./node_modules/${moduleName}`;
});
const config = {
mode: 'production',
target: 'node',
entry: entryItems,
devtool: 'source-map',
node: {
__dirname: false
},
module: {
rules: [
{
// JupyterServices imports node-fetch using `eval`.
test: /@jupyterlab[\\\/]services[\\\/].*js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js')
}
]
}
]
},
externals: [
'vscode',
'commonjs'
],
plugins: [
...common_1.getDefaultPlugins('dependencies'),
// vsls requires our package.json to be next to node_modules. It's how they
// 'find' the calling extension.
new copyWebpackPlugin([
{ from: './package.json', to: '.' }
])
],
resolve: {
extensions: ['.js']
},
output: {
filename: '[name].js',
path: path.resolve(constants_1.ExtensionRootDir, 'out', 'client'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../../[resource-path]'
}
};
// tslint:disable-next-line:no-default-export
exports.default = config;
10 changes: 8 additions & 2 deletions build/webpack/webpack.extension.dependencies.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from 'path';
import * as webpack from 'webpack';
import { ExtensionRootDir } from '../constants';
import { getDefaultPlugins, nodeModulesToExternalize } from './common';
import copyWebpackPlugin = require('copy-webpack-plugin');

const entryItems: Record<string, string> = {};
nodeModulesToExternalize.forEach(moduleName => {
Expand All @@ -31,15 +32,20 @@ const config: webpack.Configuration = {
loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js')
}
]
}
}
]
},
externals: [
'vscode',
'commonjs'
],
plugins: [
...getDefaultPlugins('dependencies')
...getDefaultPlugins('dependencies'),
// vsls requires our package.json to be next to node_modules. It's how they
// 'find' the calling extension.
new copyWebpackPlugin([
{ from: './package.json', to: '.' }
])
],
resolve: {
extensions: ['.js']
Expand Down
1 change: 1 addition & 0 deletions news/3 Code Health/4521.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add tests for live share support.
1 change: 1 addition & 0 deletions news/3 Code Health/4529.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix running liveshare support in a release build.
18 changes: 9 additions & 9 deletions package-lock.json

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

Loading