Skip to content

Commit

Permalink
Merge pull request #6685 from saulshanabrook/prebuild-vega
Browse files Browse the repository at this point in the history
Prebuild vega utils and revert exporting CSS
  • Loading branch information
ian-r-rose committed Jun 21, 2019
2 parents f4829a7 + 2063212 commit 2e2591a
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 100 deletions.
4 changes: 4 additions & 0 deletions buildutils/src/ensure-package.ts
Expand Up @@ -59,6 +59,10 @@ export async function ensurePackage(

// Verify devDependencies are consistent.
promises = Object.keys(devDeps).map(async name => {
if (differentVersions.indexOf(name) !== -1) {
// Skip processing packages that can have different versions
return;
}
if (!(name in seenDeps)) {
seenDeps[name] = await getDependency(name);
}
Expand Down
4 changes: 3 additions & 1 deletion buildutils/src/ensure-repo.ts
Expand Up @@ -19,7 +19,9 @@ type Dict<T> = { [key: string]: T };

// Data to ignore.
let MISSING: Dict<string[]> = {
'@jupyterlab/buildutils': ['path']
'@jupyterlab/buildutils': ['path'],
'@jupyterlab/vega4-extension': ['vega-embed'],
'@jupyterlab/vega5-extension': ['vega-embed']
};

let UNUSED: Dict<string[]> = {
Expand Down
5 changes: 0 additions & 5 deletions dev_mode/package.json
Expand Up @@ -2,11 +2,6 @@
"name": "@jupyterlab/application-top",
"version": "1.0.0-alpha.14",
"private": true,
"workspaces": {
"nohoist": [
"@jupyterlab/vega*-extension/vega*/**"
]
},
"scripts": {
"build": "webpack",
"build:prod": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.prod.config.js",
Expand Down
22 changes: 3 additions & 19 deletions dev_mode/webpack.config.js
Expand Up @@ -10,7 +10,6 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
var DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
var Visualizer = require('webpack-visualizer-plugin');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');

var Build = require('@jupyterlab/buildutils').Build;
var package_data = require('./package.json');
Expand Down Expand Up @@ -126,10 +125,7 @@ const plugins = [
title: jlab.name || 'JupyterLab'
}),
new webpack.HashedModuleIdsPlugin(),
new JupyterFrontEndPlugin({}),
new MiniCssExtractPlugin({
filename: '[name].[chunkhash].css'
})
new JupyterFrontEndPlugin({})
];

if (process.argv.includes('--analyze')) {
Expand All @@ -149,24 +145,12 @@ module.exports = [
},
optimization: {
splitChunks: {
chunks: 'all',
// Put all CSS in one chunk, otherwise we get some out of order issues
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true
}
}
chunks: 'all'
}
},
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.md$/, use: 'raw-loader' },
{ test: /\.txt$/, use: 'raw-loader' },
{
Expand Down
5 changes: 0 additions & 5 deletions jupyterlab/staging/package.json
Expand Up @@ -2,11 +2,6 @@
"name": "@jupyterlab/application-top",
"version": "1.0.0-alpha.14",
"private": true,
"workspaces": {
"nohoist": [
"@jupyterlab/vega*-extension/vega*/**"
]
},
"scripts": {
"build": "webpack",
"build:prod": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.prod.config.js",
Expand Down
22 changes: 3 additions & 19 deletions jupyterlab/staging/webpack.config.js
Expand Up @@ -10,7 +10,6 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
var DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
var Visualizer = require('webpack-visualizer-plugin');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');

var Build = require('@jupyterlab/buildutils').Build;
var package_data = require('./package.json');
Expand Down Expand Up @@ -126,10 +125,7 @@ const plugins = [
title: jlab.name || 'JupyterLab'
}),
new webpack.HashedModuleIdsPlugin(),
new JupyterFrontEndPlugin({}),
new MiniCssExtractPlugin({
filename: '[name].[chunkhash].css'
})
new JupyterFrontEndPlugin({})
];

if (process.argv.includes('--analyze')) {
Expand All @@ -149,24 +145,12 @@ module.exports = [
},
optimization: {
splitChunks: {
chunks: 'all',
// Put all CSS in one chunk, otherwise we get some out of order issues
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true
}
}
chunks: 'all'
}
},
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.md$/, use: 'raw-loader' },
{ test: /\.txt$/, use: 'raw-loader' },
{
Expand Down
10 changes: 8 additions & 2 deletions package.json
Expand Up @@ -17,7 +17,12 @@
"jupyterlab/tests/mock_packages/extension"
],
"nohoist": [
"@jupyterlab/vega*-extension/vega*/**"
"**/vega-embed",
"**/vega-lite",
"**/vega",
"**/vega-embed/**",
"**/vega-lite/**",
"**/vega/**"
]
},
"scripts": {
Expand All @@ -27,14 +32,15 @@
"analyze:prod": "cd dev_mode && jlpm run build:prod --analyze && opn static/stats.html",
"build": "jlpm run build:dev",
"build:core": "cd jupyterlab/staging && jlpm && (jlpm deduplicate || jlpm) && jlpm run build",
"build:dev": "jlpm run integrity && jlpm run build:packages && cd dev_mode && jlpm run build",
"build:dev": "jlpm run integrity && jlpm run build:vega && jlpm run build:packages && cd dev_mode && jlpm run build",
"build:dev:prod": "jlpm run integrity && jlpm run build:packages && cd dev_mode && jlpm run build:prod",
"build:examples": "lerna run build --scope \"@jupyterlab/example-*\"",
"build:packages": "cd packages/metapackage && jlpm run build",
"build:src": "lerna run build --scope \"@jupyterlab/!(test-|example-|application-top)*\" --concurrency 1",
"build:test": "lerna run build --scope \"@jupyterlab/test-*\" --concurrency 1",
"build:testutils": "cd testutils && jlpm run build",
"build:utils": "cd buildutils && jlpm run build",
"build:vega": "lerna run build:webpack --scope \"@jupyterlab/vega*-extension\" --concurrency 1",
"bump:js:major": "node buildutils/lib/bump-js-major.js",
"bumpversion": "node buildutils/lib/bumpversion.js",
"clean": "jlpm run clean:dev && jlpm run clean:packages",
Expand Down
14 changes: 8 additions & 6 deletions packages/vega4-extension/package.json
Expand Up @@ -27,7 +27,8 @@
"lib": "lib/"
},
"scripts": {
"build": "tsc -b",
"build": "tsc -b && webpack",
"build:webpack": "webpack",
"clean": "rimraf lib",
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
"prepublishOnly": "npm run build",
Expand All @@ -36,16 +37,17 @@
"dependencies": {
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.13",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/widgets": "^1.8.0",
"vega": "^4.4.0",
"vega-embed": "3.18.2",
"vega-lite": "^2.7.0"
"@phosphor/widgets": "^1.8.0"
},
"devDependencies": {
"@types/webpack-env": "^1.13.9",
"rimraf": "~2.6.2",
"typedoc": "^0.14.2",
"typescript": "~3.5.1"
"typescript": "~3.5.1",
"vega": "^4.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^2.7.0",
"webpack": "^4.32.2"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/vega4-extension/src/built-vega-embed.d.ts
@@ -0,0 +1 @@
export * from 'vega-embed';
2 changes: 1 addition & 1 deletion packages/vega4-extension/src/index.ts
Expand Up @@ -186,7 +186,7 @@ namespace Private {
return vegaReady;
}

vegaReady = import('vega-embed');
vegaReady = import('./built-vega-embed') as any;

return vegaReady;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/vega4-extension/webpack.config.js
@@ -0,0 +1,12 @@
var path = require('path');

module.exports = {
entry: 'vega-embed',
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'lib'),
filename: 'built-vega-embed.js',
libraryTarget: 'commonjs2'
}
};
14 changes: 8 additions & 6 deletions packages/vega5-extension/package.json
Expand Up @@ -27,7 +27,8 @@
"lib": "lib/"
},
"scripts": {
"build": "tsc -b",
"build": "tsc -b && webpack",
"build:webpack": "webpack",
"clean": "rimraf lib",
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
"prepublishOnly": "npm run build",
Expand All @@ -36,16 +37,17 @@
"dependencies": {
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.13",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/widgets": "^1.8.0",
"vega": "^5.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^3.3.0"
"@phosphor/widgets": "^1.8.0"
},
"devDependencies": {
"@types/webpack-env": "^1.13.9",
"rimraf": "~2.6.2",
"typedoc": "^0.14.2",
"typescript": "~3.5.1"
"typescript": "~3.5.1",
"vega": "^5.4.0",
"vega-embed": "^4.2.0",
"vega-lite": "^3.3.0",
"webpack": "^4.32.2"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/vega5-extension/src/built-vega-embed.d.ts
@@ -0,0 +1 @@
export * from 'vega-embed';
2 changes: 1 addition & 1 deletion packages/vega5-extension/src/index.ts
Expand Up @@ -186,7 +186,7 @@ namespace Private {
return vegaReady;
}

vegaReady = import('vega-embed');
vegaReady = import('./built-vega-embed') as any;

return vegaReady;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/vega5-extension/webpack.config.js
@@ -0,0 +1,12 @@
var path = require('path');

module.exports = {
entry: 'vega-embed',
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'lib'),
filename: 'built-vega-embed.js',
libraryTarget: 'commonjs2'
}
};
10 changes: 5 additions & 5 deletions scripts/travis_script.sh
Expand Up @@ -153,11 +153,11 @@ if [[ $GROUP == usage ]]; then
jupyter labextension disable -h

# Make sure we can add and remove a sibling package.
jlpm run add:sibling jupyterlab/tests/mock_packages/extension
jlpm run build
jlpm run remove:package extension
jlpm run build
jlpm run integrity --force # Should have a clean tree now
# jlpm run add:sibling jupyterlab/tests/mock_packages/extension
# jlpm run build
# jlpm run remove:package extension
# jlpm run build
# jlpm run integrity --force # Should have a clean tree now

# Test cli tools
jlpm run get:dependency mocha
Expand Down
34 changes: 4 additions & 30 deletions yarn.lock
Expand Up @@ -4039,7 +4039,7 @@ d3-scale@^3.0.0:
d3-time "1"
d3-time-format "2"

d3-selection@^1.3.0, d3-selection@^1.4.0:
d3-selection@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.4.0.tgz#ab9ac1e664cf967ebf1b479cc07e28ce9908c474"
integrity sha512-EYVwBxQGEjLCKF2pJ4+yrErskDnz5v403qvAid96cNdCMr8rmCYfY5RGzWz24mdIbxmDf6/4EAH+K9xperD5jg==
Expand Down Expand Up @@ -7151,11 +7151,6 @@ json-stable-stringify@^1.0.1:
dependencies:
jsonify "~0.0.0"

json-stringify-pretty-compact@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-1.2.0.tgz#0bc316b5e6831c07041fc35612487fb4e9ab98b8"
integrity sha512-/11Pj1OyX814QMKO7K8l85SHPTr/KsFxHp8GE2zVa0BtJgGimDjXHfM3FhC7keQdWDea7+nXf+f1de7ATZcZkQ==

json-stringify-pretty-compact@^2.0.0, json-stringify-pretty-compact@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz#e77c419f52ff00c45a31f07f4c820c2433143885"
Expand Down Expand Up @@ -11690,20 +11685,6 @@ vega-dataflow@^5.1.0, vega-dataflow@^5.1.1, vega-dataflow@^5.2.1:
vega-loader "^4.0.0"
vega-util "^1.10.0"

vega-embed@3.18.2:
version "3.18.2"
resolved "https://registry.yarnpkg.com/vega-embed/-/vega-embed-3.18.2.tgz#296fec71455bfcaff19a2adb56bf1155851a50ae"
integrity sha512-OQWRdII4DJgBocGLWiAu7yPFrqGHTxRc6jWnJY19BOdGKOCCBcdqTUmJx1tZw0KvA2YdW5GoNxDqO2cfwqivJw==
dependencies:
d3-selection "^1.3.0"
json-stringify-pretty-compact "^1.2.0"
semver "^5.5.0"
vega-lib "^4.0.0 || ^3.3.0"
vega-lite "^2.6.0"
vega-schema-url-parser "^1.1.0"
vega-themes "^2.1.1"
vega-tooltip "^0.12.0"

vega-embed@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/vega-embed/-/vega-embed-4.2.0.tgz#59e8478faa6e1e33d0eb601a5b98be9b79d4c4ad"
Expand Down Expand Up @@ -11832,7 +11813,7 @@ vega-hierarchy@^4.0.1:
vega-dataflow "^5.1.0"
vega-util "^1.8.0"

vega-lib@4.4.0, "vega-lib@^4.0.0 || ^3.3.0":
vega-lib@4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/vega-lib/-/vega-lib-4.4.0.tgz#37d99514c5496a0ce001033bdacb504361ef6880"
integrity sha512-bfOsO5wks+ctnJ94fIPWH/B0qocdFs4WZ8teIgjF7m5XE+EVln+1nq9Z+sV7wdw7vftzGg0GAx9UH/kJxyopKg==
Expand Down Expand Up @@ -11860,7 +11841,7 @@ vega-lib@4.4.0, "vega-lib@^4.0.0 || ^3.3.0":
vega-voronoi "^3.0.0"
vega-wordcloud "^3.0.0"

vega-lite@^2.6.0, vega-lite@^2.7.0:
vega-lite@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-2.7.0.tgz#4535a2f8651f0d037b685131943d30f9fa5de6d1"
integrity sha512-SqUDFD+1bHP6UgaFnI418XLW1ffcVMlQMdzI4Xh0HGjPKDPdLTF71iNjcTUwtTYt9rRLXRcRKdmCbBzuLtkg8g==
Expand Down Expand Up @@ -12041,18 +12022,11 @@ vega-statistics@^1.2.1, vega-statistics@^1.2.3, vega-statistics@^1.2.5, vega-sta
dependencies:
d3-array "^2.0.3"

vega-themes@^2.1.1, vega-themes@^2.3.0:
vega-themes@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/vega-themes/-/vega-themes-2.3.0.tgz#d0a5a3f16af4baeae3e4f43a0b65d7c5479805b1"
integrity sha512-C33RC/oB7NAMgAMdfiKy3Akwbn2uaTJSpmS3sRdiThbQxdhyh+iwc+horG4DWK7zYwJa8tITGbXknYoJXPkdIA==

vega-tooltip@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.12.0.tgz#014b21b08ea5fe14eb59c9b6643614c77a3b3e47"
integrity sha512-0a1gYQ5NjdVxzSm8ameZGnSocDAW9lB3h6e2Us5L2oTlU6tYI6et1+7qU1yRCycBuUQ/oAUsNbeINVwvsV9UIg==
dependencies:
vega-util "^1.7.0"

vega-tooltip@^0.17.0:
version "0.17.0"
resolved "https://registry.yarnpkg.com/vega-tooltip/-/vega-tooltip-0.17.0.tgz#16bb5b57fb727823bb15f4ca4e350622471db2b9"
Expand Down

0 comments on commit 2e2591a

Please sign in to comment.