Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ before_install: |
install:
- travis_wait 5 npm ci
- npm run clean
- npm run vscode:prepublish
- npx gulp prePublishNonBundle
- npx gulp hygiene-modified
- python -m pip install --upgrade -r requirements.txt
- python -m pip install -t ./pythonFiles/experimental/ptvsd git+https://github.com/Microsoft/ptvsd/
Expand Down Expand Up @@ -131,6 +131,8 @@ script:
npm run clean;
vsce package;
azure storage blob upload python*.vsix $AZURE_STORAGE_CONTAINER ms-python-insiders.vsix --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --quiet;
npm run package;
azure storage blob upload python*.vsix $AZURE_STORAGE_CONTAINER ms-python-insiders-bundled.vsix --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --quiet;
fi
- if [[ $AZURE_STORAGE_ACCOUNT && "$TRAVIS_BRANCH" == release* && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
npm run clean;
Expand Down
4 changes: 3 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
!out/**/*.map
**/*.map
*.vsix
.appveyor.yml
.editorconfig
.eslintrc
Expand Down Expand Up @@ -26,7 +28,7 @@ typings.json
vsc-extension-quickstart.md
vscode-python-signing.*
webpack.config.js
webpack.default.config.js
webpack.datascience-ui.config.js

.github/**
.mocha-reporter/**
Expand Down
1 change: 1 addition & 0 deletions build/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ function getListOfExcludedFiles() {
return files.map(file => path.join(exports.ExtensionRootDir, file.replace(/\//g, path.sep)));
}
exports.filesNotToCheck = getListOfExcludedFiles();
exports.isCI = process.env.TRAVIS === 'true' || process.env.TF_BUILD !== undefined;
2 changes: 2 additions & 0 deletions build/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ function getListOfExcludedFiles() {
}

export const filesNotToCheck: string[] = getListOfExcludedFiles();

export const isCI = process.env.TRAVIS === 'true' || process.env.TF_BUILD !== undefined;
52 changes: 0 additions & 52 deletions build/datascience/inlinePlugin.js

This file was deleted.

29 changes: 29 additions & 0 deletions build/webpack/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
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'
];
function getDefaultPlugins(name) {
const plugins = [];
if (!constants_1.isCI) {
plugins.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.html`
}));
}
return plugins;
}
exports.getDefaultPlugins = getDefaultPlugins;
33 changes: 33 additions & 0 deletions build/webpack/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { isCI } from '../constants';
export const 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'
];

export function getDefaultPlugins(name: 'extension' | 'debugger' | 'dependencies' | 'datascience-ui') {
const plugins = [];
if (!isCI) {
plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: `${name}.html`
})
);
}
return plugins;
}
21 changes: 21 additions & 0 deletions build/webpack/loaders/externalizeDependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +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;
22 changes: 22 additions & 0 deletions build/webpack/loaders/externalizeDependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

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

function replaceModule(contents: string, moduleName: string, quotes: '"' | '\''): string {
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
export default function (source: string) {
nodeModulesToExternalize.forEach(moduleName => {
if (source.indexOf(moduleName) > 0) {
source = replaceModule(source, moduleName, '"');
source = replaceModule(source, moduleName, '\'');
}
});
return source;
}
23 changes: 23 additions & 0 deletions build/webpack/loaders/fixEvalRequire.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:no-default-export no-invalid-this
function default_1(source) {
if (source.indexOf('eval') > 0) {
let matches = source.match(/eval\('require'\)\('.*'\)/gm) || [];
matches.forEach(item => {
const moduleName = item.split('\'')[3];
const stringToReplaceWith = `require('${moduleName}')`;
source = source.replace(item, stringToReplaceWith);
});
matches = source.match(/eval\("require"\)\(".*"\)/gm) || [];
matches.forEach(item => {
const moduleName = item.split('\'')[3];
const stringToReplaceWith = `require("${moduleName}")`;
source = source.replace(item, stringToReplaceWith);
});
}
return source;
}
exports.default = default_1;
23 changes: 23 additions & 0 deletions build/webpack/loaders/fixEvalRequire.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

// tslint:disable:no-default-export no-invalid-this
export default function (source: string) {
if (source.indexOf('eval') > 0) {
let matches = source.match(/eval\('require'\)\('.*'\)/gm) || [];
matches.forEach(item => {
const moduleName = item.split('\'')[3];
const stringToReplaceWith = `require('${moduleName}')`;
source = source.replace(item, stringToReplaceWith);
});
matches = source.match(/eval\("require"\)\(".*"\)/gm) || [];
matches.forEach(item => {
const moduleName = item.split('\'')[3];
const stringToReplaceWith = `require("${moduleName}")`;
source = source.replace(item, stringToReplaceWith);
});
}
return source;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// For some reason this has to be in commonjs format
module.exports = function(source) {
// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;
}
// For some reason this has to be in commonjs format

module.exports = function(source) {

// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// For some reason this has to be in commonjs format

module.exports = function(source) {

// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;
}
// For some reason this has to be in commonjs format

module.exports = function(source) {

// Just inline the source and fix up defaults so that they don't
// mess up the logic in the setOptions.js file
return `module.exports = ${source}\nmodule.exports.default = false`;

}
89 changes: 89 additions & 0 deletions build/webpack/webpack.datascience-ui.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const common_1 = require("./common");
// tslint:disable-next-line:no-var-requires no-require-imports
const FixDefaultImportPlugin = require('webpack-fix-default-import-plugin');
const configFileName = 'tsconfig.datascience-ui.json';
const config = {
entry: ['babel-polyfill', './src/datascience-ui/history-react/index.tsx'],
output: {
path: path.join(__dirname, '..', '..', 'out'),
filename: 'datascience-ui/history-react/index_bundle.js',
publicPath: path.join(__dirname, '..', '..')
},
mode: 'production',
// Use 'eval' for release and `eval-source-map` for development.
// We need to use one where source is embedded, due to webviews (they restrict resources to specific schemes,
// this seems to prevent chrome from downloading the source maps)
devtool: 'eval',
node: {
fs: 'empty'
},
plugins: [
...common_1.getDefaultPlugins('datascience-ui'),
new HtmlWebpackPlugin({ template: 'src/datascience-ui/history-react/index.html', filename: 'datascience-ui/history-react/index.html' }),
new FixDefaultImportPlugin(),
new CopyWebpackPlugin([
{ from: './**/*.png', to: '.' },
{ from: './**/*.svg', to: '.' },
{ from: './**/*.css', to: '.' },
{ from: './**/*theme*.json', to: '.' }
])
],
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
use: {
loader: 'awesome-typescript-loader',
options: {
configFileName,
reportFiles: [
'src/datascience-ui/**/*.{ts,tsx}'
]
}
}
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.js$/,
include: /node_modules.*remark.*default.*js/,
use: [
{
loader: path.resolve('./build/datascience/remarkLoader.js'),
options: {}
}
]
},
{
test: /\.json$/,
type: 'javascript/auto',
include: /node_modules.*remark.*/,
use: [
{
loader: path.resolve('./build/webpack/loaders/jsonloader.js'),
options: {}
}
]
}
]
}
};
// tslint:disable-next-line:no-default-export
exports.default = config;
Loading