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

Vega 5 upgrade #58545

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c2bc72c
Vega 5 upgrade
wylieconlon Feb 25, 2020
b5ba506
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Feb 27, 2020
2f2e5e7
validate the syntax of node_modules included in the dll
spalger Mar 12, 2020
2ecb4b4
fix missed rename
spalger Mar 12, 2020
38ca2ea
update renovate config
spalger Mar 12, 2020
907d2c3
move DisallowedSyntaxPlugin to kbn-optimizer
spalger Mar 12, 2020
0f3032d
avoid renaming named exports
spalger Mar 12, 2020
6356d38
remove import that was for testing
spalger Mar 12, 2020
dceebe4
Merge branch 'master' of github.com:elastic/kibana into implement/dll…
spalger Mar 12, 2020
573b877
move parse_path snapshot
spalger Mar 12, 2020
a66be9d
strip query strings from paths that might come from webpack
spalger Mar 12, 2020
50ad4f5
reference DT pr
spalger Mar 17, 2020
df8333e
Merge branch 'master' of github.com:elastic/kibana into implement/dll…
spalger Mar 17, 2020
f68f1c7
ignore import/export syntax since webpack takes care of it for us
spalger Mar 17, 2020
26dd6a5
upgrade react-use
spalger Mar 17, 2020
98a707b
Merge branch 'upgrade/react-use' into implement/dll-syntax-check
spalger Mar 17, 2020
7d32dc0
Merge branch 'master' of github.com:elastic/kibana into implement/dll…
spalger Mar 17, 2020
ea883a3
Merge branch 'master' of github.com:elastic/kibana into implement/dll…
spalger Mar 20, 2020
0fe337f
upgrade estree now that DT PR is merged
spalger Mar 20, 2020
0eebdd0
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Mar 20, 2020
123674d
Downgrade vega-lite to ES5 version
wylieconlon Mar 20, 2020
c7ab270
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Mar 20, 2020
70579ea
Merge remote-tracking branch 'spalger/implement/dll-syntax-check' int…
wylieconlon Mar 20, 2020
2832fac
Upgrade vega, still support IE11
wylieconlon Mar 20, 2020
fe70fff
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Mar 20, 2020
a10eacc
Define d3-array dependency in x-pack
wylieconlon Mar 23, 2020
73150f7
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Mar 23, 2020
156fa69
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Apr 3, 2020
32f4ca4
Use vega-lite with ES5 mode- not released yet
wylieconlon Apr 3, 2020
a93cc0d
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Apr 6, 2020
b299835
Upgrade to vega-lite ES5
wylieconlon Apr 6, 2020
75233d3
Commit yarn.lock
wylieconlon Apr 6, 2020
e9588ce
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Apr 7, 2020
5c989bd
Upgrade to vega-lite for real
wylieconlon Apr 7, 2020
9cfbf6a
Merge remote-tracking branch 'origin/master' into upgrade-vega
wylieconlon Apr 7, 2020
e39a711
Merge branch 'master' into upgrade-vega
elasticmachine Apr 7, 2020
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@
"uuid": "3.3.2",
"val-loader": "^1.1.1",
"validate-npm-package-name": "2.2.2",
"vega-lib": "4.3.0",
"vega-lite": "^2.6.0",
"vega-schema-url-parser": "1.0.0",
"vega": "^5.10.1",
"vega-lite": "^4.10.1",
"vega-schema-url-parser": "1.1.0",
"vega-tooltip": "^0.12.0",
"vision": "^5.3.3",
"webpack": "^4.41.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
$schema: https://vega.github.io/schema/vega-lite/v2.json
$schema: https://vega.github.io/schema/vega-lite/v3.json
data: {
format: {property: "aggregations.time_buckets.buckets"}
values: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

import _ from 'lodash';
import * as vega from 'vega-lib';
import * as vegaLite from 'vega-lite';
import { logger as vegaLogger, Warn, version as vegaVersion } from 'vega/build-es5/vega.js';
import { version as vegaLiteVersion, compile } from 'vega-lite/build-es5/vega-lite.js';
import schemaParser from 'vega-schema-url-parser';
import versionCompare from 'compare-versions';
import { EsQueryParser } from './es_query_parser';
Expand All @@ -33,7 +33,7 @@ import { i18n } from '@kbn/i18n';
// Set default single color to match other Kibana visualizations
const defaultColor = VISUALIZATION_COLORS[0];

const DEFAULT_SCHEMA = 'https://vega.github.io/schema/vega/v3.0.json';
const DEFAULT_SCHEMA = 'https://vega.github.io/schema/vega/v5.0.json';

const locToDirMap = {
left: 'row-reverse',
Expand Down Expand Up @@ -116,10 +116,9 @@ export class VegaParser {
*/
_compileVegaLite() {
this.vlspec = this.spec;
// eslint-disable-next-line import/namespace
const logger = vega.logger(vega.Warn); // note: eslint has a false positive here
const logger = vegaLogger(Warn);
logger.warn = this._onWarning.bind(this);
this.spec = vegaLite.compile(this.vlspec, logger).spec;
this.spec = compile(this.vlspec, logger).spec;

// When using VL with the type=map and user did not provid their own projection settings,
// remove the default projection that was generated by VegaLite compiler.
Expand Down Expand Up @@ -464,7 +463,7 @@ export class VegaParser {

const schema = schemaParser(this.spec.$schema);
const isVegaLite = schema.library === 'vega-lite';
const libVersion = isVegaLite ? vegaLite.version : vega.version;
const libVersion = isVegaLite ? vegaLiteVersion : vegaVersion;

if (versionCompare(schema.version, libVersion) > 0) {
this._onWarning(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
import $ from 'jquery';
import moment from 'moment';
import dateMath from '@elastic/datemath';
import * as vega from 'vega-lib';
import * as vegaLite from 'vega-lite';
import {
scheme,
expressionFunction,
Warn,
loader as vegaLoader,
version as vegaVersion,
} from 'vega/build-es5/vega.js';
import { version as vegaLiteVersion } from 'vega-lite/build-es5/vega-lite.js';
import { Utils } from '../data_model/utils';
import { VISUALIZATION_COLORS } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand All @@ -30,7 +36,7 @@ import { esFilters } from '../../../../../plugins/data/public';

import { getEnableExternalUrls } from '../services';

vega.scheme('elastic', VISUALIZATION_COLORS);
scheme('elastic', VISUALIZATION_COLORS);

// Vega's extension functions are global. When called,
// we forward execution to the instance-specific handler
Expand All @@ -43,8 +49,8 @@ const vegaFunctions = {
};

for (const funcName of Object.keys(vegaFunctions)) {
if (!vega.expressionFunction(funcName)) {
vega.expressionFunction(funcName, function handlerFwd(...args) {
if (!expressionFunction(funcName)) {
expressionFunction(funcName, function handlerFwd(...args) {
const view = this.context.dataflow;
view.runAfter(() => view._kibanaView.vegaFunctionsHandler(funcName, ...args));
});
Expand Down Expand Up @@ -132,13 +138,12 @@ export class VegaBaseView {

createViewConfig() {
const config = {
// eslint-disable-next-line import/namespace
logLevel: vega.Warn, // note: eslint has a false positive here
logLevel: Warn,
renderer: this._parser.renderer,
};

// Override URL sanitizer to prevent external data loading (if disabled)
const loader = vega.loader();
const loader = vegaLoader();
const originalSanitize = loader.sanitize.bind(loader);
loader.sanitize = (uri, options) => {
if (uri.bypassToken === bypassToken) {
Expand Down Expand Up @@ -378,8 +383,8 @@ export class VegaBaseView {
}
const debugObj = {};
window.VEGA_DEBUG = debugObj;
window.VEGA_DEBUG.VEGA_VERSION = vega.version;
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLite.version;
window.VEGA_DEBUG.VEGA_VERSION = vegaVersion;
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLiteVersion;
window.VEGA_DEBUG.view = view;
window.VEGA_DEBUG.vega_spec = spec;
window.VEGA_DEBUG.vegalite_spec = vlspec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import * as vega from 'vega-lib';
import vega from 'vega/build-es5/vega.js';
import { i18n } from '@kbn/i18n';
import { VegaBaseView } from './vega_base_view';
import { VegaMapLayer } from './vega_map_layer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* under the License.
*/

import * as vega from 'vega-lib';
import { View, parse } from 'vega/build-es5/vega.js';
import { VegaBaseView } from './vega_base_view';

export class VegaView extends VegaBaseView {
async _initViewCustomizations() {
// In some cases, Vega may be initialized twice... TBD
if (!this._$container) return;

const view = new vega.View(vega.parse(this._parser.spec), this._vegaViewConfig);
const view = new View(parse(this._parser.spec), this._vegaViewConfig);
this.setDebugValues(view, this._parser.spec, this._parser.vlspec);

view.warn = this.onWarn.bind(this);
Expand Down
1 change: 1 addition & 0 deletions src/optimize/dynamic_dll_plugin/dll_config_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import webpackMerge from 'webpack-merge';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import * as UiSharedDeps from '@kbn/ui-shared-deps';
import { DisallowedSyntaxPlugin } from '@kbn/optimizer';

function generateDLL(config) {
const {
Expand Down
1 change: 1 addition & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"cronstrue": "^1.51.0",
"cytoscape": "^3.10.0",
"d3": "3.5.17",
"d3-array": "1.2.4",
"d3-scale": "1.0.7",
"dedent": "^0.7.0",
"del": "^5.1.0",
Expand Down
Loading