[6.x] [@kbn/interpreter] improve build/packaging (#26096) (#26136)

* [@kbn/interpreter] improve build/packaging (#26096)

Summary of changes:

 - move all build artifacts under `target` directory
 - run babel and webpack in parallel
 - support optional watch and sourcemaps in build
 - expose /common /public /plugin /server sub-exports as index.js
 - avoid importing deeply from `@kbn/interpreter`
 - move a couple missed dependencies from x-pack to kibana
 - remove custom babel-register implementation

* fix bad conflict resolution
This commit is contained in:
Spencer 2018-11-24 12:26:07 -07:00 committed by GitHub
parent 0ab370a715
commit e618cf43da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 414 additions and 241 deletions

View file

@ -27,10 +27,6 @@ bower_components
/x-pack/coverage
/x-pack/build
/x-pack/plugins/**/__tests__/fixtures/**
/packages/kbn-interpreter/common
/packages/kbn-interpreter/plugin
/packages/kbn-interpreter/public
/packages/kbn-interpreter/server
/packages/kbn-interpreter/src/common/lib/grammar.js
/x-pack/plugins/canvas/canvas_plugin
/x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts

View file

@ -99,7 +99,7 @@ module.exports = {
* Files that ARE NOT allowed to use devDependencies
*/
{
files: ['packages/kbn-ui-framework/**/*', 'x-pack/**/*'],
files: ['packages/kbn-ui-framework/**/*', 'x-pack/**/*', 'packages/kbn-interpreter/**/*'],
rules: {
'import/no-extraneous-dependencies': [
'error',
@ -121,6 +121,8 @@ module.exports = {
'packages/kbn-ui-framework/generator-kui/**/*',
'packages/kbn-ui-framework/Gruntfile.js',
'packages/kbn-es/src/**/*',
'packages/kbn-interpreter/tasks/**/*',
'packages/kbn-interpreter/src/plugin/**/*',
'x-pack/{dev-tools,tasks,scripts,test,build_chromium}/**/*',
'x-pack/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*',
'x-pack/**/*.test.js',

View file

@ -216,6 +216,8 @@
"rxjs": "^6.2.1",
"script-loader": "0.7.2",
"semver": "^5.5.0",
"socket.io": "^2.1.1",
"stream-stream": "^1.2.6",
"style-loader": "0.19.0",
"symbol-observable": "^1.2.0",
"tar": "2.2.0",

View file

@ -1,7 +1,7 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"plugins": [
["transform-runtime", {
["babel-plugin-transform-runtime", {
"polyfill": false,
"regenerator": true
}]

View file

@ -1,4 +0,0 @@
/common
/plugin
/public
/server

View file

@ -0,0 +1,3 @@
src
tasks
.babelrc

View file

@ -0,0 +1,5 @@
{
"private": true,
"main": "../target/common/index.js",
"jsnext:main": "../src/common/index.js"
}

View file

@ -3,9 +3,10 @@
"version": "1.0.0",
"license": "Apache-2.0",
"scripts": {
"build": "babel src --out-dir ./ --ignore 'src/plugin' && node tasks/build.js",
"canvas:peg": "pegjs common/lib/grammar.peg",
"kbn:bootstrap": "yarn build"
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --dev",
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"lodash": "npm:@elastic/lodash@3.10.1-kibana1",
@ -16,15 +17,19 @@
},
"devDependencies": {
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "6.20.0",
"css-loader": "0.28.7",
"del": "^3.0.0",
"getopts": "^2.2.3",
"pegjs": "0.9.0",
"sass-loader": "^7.1.0",
"style-loader": "0.19.0",
"supports-color": "^5.5.0",
"url-loader": "0.5.9",
"webpack": "3.6.0"
}

View file

@ -17,11 +17,9 @@
* under the License.
*/
import { resolve } from 'path';
const { resolve } = require('path');
const dir = resolve(__dirname, '..', '..', '..');
export const pluginPaths = {
commonFunctions: resolve(dir, 'node_modules/@kbn/interpreter/plugin/functions/common'),
types: resolve(dir, 'node_modules/@kbn/interpreter/plugin/types'),
exports.pluginPaths = {
commonFunctions: resolve(__dirname, 'target/plugin/functions/common'),
types: resolve(__dirname, 'target/plugin/types'),
};

View file

@ -0,0 +1,5 @@
{
"private": true,
"main": "../target/public/index.js",
"jsnext:main": "../src/public/index.js"
}

View file

@ -17,15 +17,4 @@
* under the License.
*/
// taken from kibana/src/setup_node_env/babel_register/polyfill.js
// ...
// `babel-preset-env` looks for and rewrites the following import
// statement into a list of import statements based on the polyfills
// necessary for our target environment (the current version of node)
// but since it does that during compilation, `import 'babel-polyfill'`
// must be in a file that is loaded with `require()` AFTER `babel-register`
// is configured.
//
// This is why we have this single statement in it's own file and require
// it from ./babeled.js
import 'babel-polyfill';
require('../tasks/build/cli');

View file

@ -0,0 +1,5 @@
{
"private": true,
"main": "../target/server/index.js",
"jsnext:main": "../src/server/index.js"
}

View file

@ -0,0 +1,32 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { pathsRegistry } from './lib/paths_registry';
export { functionsRegistry } from './lib/functions_registry';
export { typesRegistry } from './lib/types_registry';
export { createError } from './interpreter/create_error';
export { interpretProvider } from './interpreter/interpret';
export { serializeProvider } from './lib/serialize';
export { fromExpression, toExpression, safeElementFromExpression } from './lib/ast';
export { Fn } from './lib/fn';
export { getType } from './lib/get_type';
export { castProvider } from './interpreter/cast';
export { parse } from './lib/grammar';
export { getByAlias } from './lib/get_by_alias';
export { Registry } from './lib/registry';

View file

@ -0,0 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { populateBrowserRegistries, getBrowserRegistries } from './browser_registries';
export { createSocket } from './socket';
export { initializeInterpreter, interpretAst } from './interpreter';

View file

@ -29,7 +29,7 @@ let socket;
let resolve;
const functionList = new Promise(_resolve => (resolve = _resolve));
export async function initialize() {
export async function initializeInterpreter() {
socket = getSocket();
// Listen for interpreter runs

View file

@ -0,0 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { populateServerRegistries, getServerRegistries } from './server_registries';
export { getPluginPaths } from './get_plugin_paths';

View file

@ -0,0 +1,113 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const { relative } = require('path');
const getopts = require('getopts');
const del = require('del');
const supportsColor = require('supports-color');
const { ToolingLog, withProcRunner, pickLevelFromFlags } = require('@kbn/dev-utils');
const {
ROOT_DIR,
PLUGIN_SOURCE_DIR,
BUILD_DIR,
WEBPACK_CONFIG_PATH
} = require('./paths');
const unknownFlags = [];
const flags = getopts(process.argv, {
boolean: [
'watch',
'dev',
'help',
'debug'
],
unknown(name) {
unknownFlags.push(name);
}
});
const log = new ToolingLog({
level: pickLevelFromFlags(flags),
writeTo: process.stdout
});
if (unknownFlags.length) {
log.error(`Unknown flag(s): ${unknownFlags.join(', ')}`);
flags.help = true;
process.exitCode = 1;
}
if (flags.help) {
log.info(`
Simple build tool for @kbn/interpreter package
--dev Build for development, include source maps
--watch Run in watch mode
--debug Turn on debug logging
`);
process.exit();
}
withProcRunner(log, async (proc) => {
log.info('Deleting old output');
await del(BUILD_DIR);
const cwd = ROOT_DIR;
const env = { ...process.env };
if (supportsColor.stdout) {
env.FORCE_COLOR = 'true';
}
log.info(`Starting babel and webpack${flags.watch ? ' in watch mode' : ''}`);
await Promise.all([
proc.run('babel ', {
cmd: 'babel',
args: [
'src',
'--ignore', `${relative(cwd, PLUGIN_SOURCE_DIR)},*.test.js`,
'--out-dir', relative(cwd, BUILD_DIR),
'--copy-files',
...(flags.dev ? ['--source-maps', 'inline'] : []),
...(flags.watch ? ['--watch'] : ['--quiet'])
],
wait: true,
env,
cwd
}),
proc.run('webpack', {
cmd: 'webpack',
args: [
'--config', relative(cwd, WEBPACK_CONFIG_PATH),
'--env.sourceMaps', String(Boolean(flags.dev)),
...(flags.watch ? ['--watch'] : []),
],
wait: true,
env,
cwd
}),
]);
log.success('Complete');
}).catch((error) => {
log.error(error);
process.exit(1);
});

View file

@ -17,24 +17,15 @@
* under the License.
*/
const webpack = require('webpack');
const webpackConfig = require('./webpack.plugins');
const { resolve } = require('path');
const devtool = 'inline-cheap-module-source-map';
exports.ROOT_DIR = resolve(__dirname, '../../');
exports.SOURCE_DIR = resolve(exports.ROOT_DIR, 'src');
exports.BUILD_DIR = resolve(exports.ROOT_DIR, 'target');
const onComplete = function (done) {
return function (err, stats) {
if (err) {
done && done(err);
} else {
const seconds = ((stats.endTime - stats.startTime) / 1000).toFixed(2);
console.log(`Plugins built in ${seconds} seconds`);
done && done();
}
};
};
exports.PLUGIN_SOURCE_DIR = resolve(exports.SOURCE_DIR, 'plugin');
exports.PLUGIN_BUILD_DIR = resolve(exports.BUILD_DIR, 'plugin');
webpack({ ...webpackConfig, devtool }, onComplete(function () {
console.log('all done');
}));
exports.WEBPACK_CONFIG_PATH = require.resolve('./webpack.config');
exports.BABEL_PRESET_PATH = require.resolve('@kbn/babel-preset/webpack_preset');

View file

@ -0,0 +1,110 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const { resolve } = require('path');
const {
PLUGIN_SOURCE_DIR,
PLUGIN_BUILD_DIR,
BABEL_PRESET_PATH,
} = require('./paths');
module.exports = function ({ sourceMaps }, { watch }) {
return {
devtool: sourceMaps ? 'inline-cheap-module-source-map' : undefined,
entry: {
'types/all': resolve(PLUGIN_SOURCE_DIR, 'types/register.js'),
'functions/common/all': resolve(PLUGIN_SOURCE_DIR, 'functions/common/register.js'),
},
// there were problems with the node and web targets since this code is actually
// targetting both the browser and node.js. If there was a hybrid target we'd use
// it, but this seems to work either way.
target: 'webworker',
output: {
path: PLUGIN_BUILD_DIR,
filename: '[name].js', // Need long paths here.
libraryTarget: 'umd',
},
resolve: {
extensions: ['.js', '.json'],
mainFields: ['browser', 'main'],
},
module: {
rules: [
{
test: /\.js$/,
include: PLUGIN_SOURCE_DIR,
loaders: 'babel-loader',
options: {
babelrc: false,
presets: [BABEL_PRESET_PATH],
},
},
{
test: /\.(png|jpg|gif|jpeg|svg)$/,
loaders: ['url-loader'],
},
{
test: /\.(css|scss)$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
node: {
// Don't replace built-in globals
__filename: false,
__dirname: false,
},
watchOptions: {
ignored: [/node_modules/],
},
stats: 'errors-only',
plugins: [
function loaderFailHandler() {
if (!watch) {
return;
}
let lastBuildFailed = false;
// bails on error, including loader errors
// see https://github.com/webpack/webpack/issues/708, which does not fix loader errors
this.plugin('done', function (stats) {
if (stats.hasErrors() || stats.hasWarnings()) {
lastBuildFailed = true;
return;
}
if (lastBuildFailed) {
lastBuildFailed = false;
console.log('✅ Webpack error resolved');
}
});
},
]
};
};

View file

@ -1,100 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const path = require('path');
const sourceDir = path.resolve(__dirname, '../src/plugin');
const buildDir = path.resolve(__dirname, '../plugin');
module.exports = {
entry: {
'types/all': path.join(sourceDir, 'types/register.js'),
'functions/common/all': path.join(sourceDir, 'functions/common/register.js'),
},
target: 'webworker',
output: {
path: buildDir,
filename: '[name].js', // Need long paths here.
libraryTarget: 'umd',
},
resolve: {
extensions: ['.js', '.json'],
mainFields: ['browser', 'main'],
},
plugins: [
function loaderFailHandler() {
// bails on error, including loader errors
// see https://github.com/webpack/webpack/issues/708, which does not fix loader errors
let isWatch = true;
this.plugin('run', function (compiler, callback) {
isWatch = false;
callback.call(compiler);
});
this.plugin('done', function (stats) {
if (!stats.hasErrors()) {
return;
}
const errorMessage = stats.toString('errors-only');
if (isWatch) {
console.error(errorMessage);
}
else {
throw new Error(errorMessage);
}
});
},
],
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
loaders: 'babel-loader',
options: {
babelrc: false,
presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
},
},
{
test: /\.(png|jpg|gif|jpeg|svg)$/,
loaders: ['url-loader'],
},
{
test: /\.(css|scss)$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
node: {
// Don't replace built-in globals
__filename: false,
__dirname: false,
},
watchOptions: {
ignored: [/node_modules/],
},
};

View file

@ -19,8 +19,8 @@
import { resolve } from 'path';
import init from './init';
import { pathsRegistry } from '@kbn/interpreter/common/lib/paths_registry';
import { pluginPaths } from './plugin_paths';
import { pathsRegistry } from '@kbn/interpreter/common';
import { pluginPaths } from '@kbn/interpreter/plugin_paths';
export default function (kibana) {
return new kibana.Plugin({

View file

@ -18,8 +18,8 @@
*/
import { routes } from './server/routes';
import { functionsRegistry } from '@kbn/interpreter/common/lib/functions_registry';
import { populateServerRegistries } from '@kbn/interpreter/server/server_registries';
import { functionsRegistry } from '@kbn/interpreter/common';
import { populateServerRegistries } from '@kbn/interpreter/server';
export default async function (server /*options*/) {
server.injectUiAppVars('canvas', () => {

View file

@ -17,9 +17,8 @@
* under the License.
*/
import { populateBrowserRegistries } from '@kbn/interpreter/public/browser_registries';
import { typesRegistry } from '@kbn/interpreter/common/lib/types_registry';
import { functionsRegistry } from '@kbn/interpreter/common/lib/functions_registry';
import { populateBrowserRegistries } from '@kbn/interpreter/public';
import { typesRegistry, functionsRegistry } from '@kbn/interpreter/common';
const types = {
commonFunctions: functionsRegistry,

View file

@ -19,7 +19,7 @@
import fs from 'fs';
import ss from 'stream-stream';
import { getPluginPaths } from '@kbn/interpreter/server/get_plugin_paths';
import { getPluginPaths } from '@kbn/interpreter/server';
export const getPluginStream = type => {
const stream = ss({

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { createError } from '@kbn/interpreter/common/interpreter/create_error';
import { createError } from '@kbn/interpreter/common';
export const routeExpressionProvider = environments => {
async function routeExpression(ast, context = null) {

View file

@ -17,8 +17,8 @@
* under the License.
*/
import { getServerRegistries } from '@kbn/interpreter/server/server_registries';
import { interpretProvider } from '@kbn/interpreter/common/interpreter/interpret';
import { getServerRegistries } from '@kbn/interpreter/server';
import { interpretProvider } from '@kbn/interpreter/common';
import { createHandlers } from '../create_handlers';
export const server = async ({ onFunctionNotFound, server, request }) => {

View file

@ -17,16 +17,5 @@
* under the License.
*/
require('babel-register')({
ignore: [
// stolen from kibana/src/setup_node_env/babel_register/register.js
// ignore paths matching `/node_modules/{a}/{b}`, unless `a`
// is `x-pack` and `b` is not `node_modules`
/\/node_modules\/(?!x-pack\/(?!node_modules)([^\/]+))([^\/]+\/[^\/]+)/,
],
babelrc: false,
presets: [require.resolve('@kbn/babel-preset/node_preset')],
});
require('./polyfill');
require('../../../../../../setup_node_env');
require('./worker');

View file

@ -18,9 +18,8 @@
*/
import uuid from 'uuid/v4';
import { populateServerRegistries } from '@kbn/interpreter/server/server_registries';
import { interpretProvider } from '@kbn/interpreter/common/interpreter/interpret';
import { serializeProvider } from '@kbn/interpreter/common/lib/serialize';
import { populateServerRegistries } from '@kbn/interpreter/server';
import { interpretProvider, serializeProvider } from '@kbn/interpreter/common';
// We actually DO need populateServerRegistries here since this is a different node process
const pluginsReady = populateServerRegistries(['commonFunctions', 'types']);

View file

@ -18,9 +18,8 @@
*/
import socket from 'socket.io';
import { serializeProvider } from '@kbn/interpreter/common/lib/serialize';
import { typesRegistry } from '@kbn/interpreter/common/lib/types_registry';
import { getServerRegistries } from '@kbn/interpreter/server/server_registries';
import { serializeProvider, typesRegistry } from '@kbn/interpreter/common';
import { getServerRegistries } from '@kbn/interpreter/server';
import { routeExpressionProvider } from '../lib/route_expression/index';
import { browser } from '../lib/route_expression/browser';
import { thread } from '../lib/route_expression/thread/index';

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { fromExpression, toExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression, toExpression } from '@kbn/interpreter/common';
export function translate(server) {
/*

View file

@ -41,9 +41,6 @@ var ignore = [
// is `x-pack` and `b` is not `node_modules`
/\/node_modules\/(?!x-pack\/(?!node_modules)([^\/]+))([^\/]+\/[^\/]+)/,
// ignore paths matching `/kbn-interpreter`
/\/kbn-interpreter\//,
// ignore paths matching `/canvas/canvas_plugin/{a}/{b}` unless
// `a` is `functions` and `b` is `server`
/\/canvas\/canvas_plugin\/(?!functions\/server)([^\/]+\/[^\/]+)/,

View file

@ -247,9 +247,7 @@
"rison-node": "0.3.1",
"rxjs": "^6.2.1",
"semver": "5.1.0",
"socket.io": "^2.1.1",
"squel": "^5.12.2",
"stream-stream": "^1.2.6",
"style-it": "^1.6.12",
"styled-components": "3.3.3",
"tar-fs": "1.13.0",

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Fn } from '@kbn/interpreter/common/lib/fn';
import { Fn } from '@kbn/interpreter/common';
import { functions as browserFns } from '../../canvas_plugin_src/functions/browser';
import { functions as commonFns } from '../../canvas_plugin_src/functions/common';
import { functions as serverFns } from '../../canvas_plugin_src/functions/server/src';

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
export const asFn = () => ({
name: 'as',

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
export const mapColumn = () => ({
name: 'mapColumn',

View file

@ -5,7 +5,7 @@
*/
import { get, map } from 'lodash';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
export const getFlotAxisConfig = (axis, argValue, { columns, ticks, font } = {}) => {
if (!argValue || argValue.show === false) return { show: false };

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
export const staticColumn = () => ({
name: 'staticColumn',

View file

@ -7,7 +7,7 @@
import ReactDOM from 'react-dom';
import React from 'react';
import { get } from 'lodash';
import { fromExpression, toExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression, toExpression } from '@kbn/interpreter/common';
import { DropdownFilter } from './component';
export const dropdownFilter = () => ({

View file

@ -7,7 +7,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { get } from 'lodash';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
import { TimePicker } from '../time_picker';
import { TimePickerMini } from '../time_picker_mini';

View file

@ -7,7 +7,7 @@
import ReactDOM from 'react-dom';
import React from 'react';
import { get, set } from 'lodash';
import { fromExpression, toExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression, toExpression } from '@kbn/interpreter/common';
import { TimeFilter } from './components/time_filter';
export const timeFilter = () => ({

View file

@ -9,7 +9,7 @@ import { compose, withPropsOnChange, withHandlers } from 'recompose';
import PropTypes from 'prop-types';
import { EuiSelect, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import { sortBy } from 'lodash';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
import { createStatefulPropHoc } from '../../../../public/components/enhance/stateful_prop';
import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component';
import { SimpleMathFunction } from './simple_math_function';

View file

@ -7,7 +7,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { get } from 'lodash';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
import { PalettePicker } from '../../../public/components/palette_picker';
import { templateFromReactComponent } from '../../../public/lib/template_from_react_component';

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { castProvider } from '@kbn/interpreter/common/interpreter/cast';
import { castProvider } from '@kbn/interpreter/common';
export const to = () => ({
name: 'to',

View file

@ -5,8 +5,7 @@
*/
import { uniq } from 'lodash';
import { parse } from '@kbn/interpreter/common/lib/grammar';
import { getByAlias } from '@kbn/interpreter/common/lib/get_by_alias';
import { parse, getByAlias } from '@kbn/interpreter/common';
const MARKER = 'CANVAS_SUGGESTION_MARKER';

View file

@ -5,7 +5,7 @@
*/
import { resolve } from 'path';
import { pathsRegistry } from '@kbn/interpreter/common/lib/paths_registry';
import { pathsRegistry } from '@kbn/interpreter/common';
import init from './init';
import { mappings } from './server/mappings';
import { CANVAS_APP } from './common/lib';

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { functionsRegistry } from '@kbn/interpreter/common/lib/functions_registry';
import { populateServerRegistries } from '@kbn/interpreter/server/server_registries';
import { functionsRegistry } from '@kbn/interpreter/common';
import { populateServerRegistries } from '@kbn/interpreter/server';
import { routes } from './server/routes';
import { commonFunctions } from './common/functions';
import { registerCanvasUsageCollector } from './server/usage';

View file

@ -4,11 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { createSocket } from '@kbn/interpreter/public/socket';
import { initialize as initializeInterpreter } from '@kbn/interpreter/public/interpreter';
import {
createSocket,
initializeInterpreter,
populateBrowserRegistries,
} from '@kbn/interpreter/public';
import { connect } from 'react-redux';
import { compose, withProps } from 'recompose';
import { populateBrowserRegistries } from '@kbn/interpreter/public/browser_registries';
import { getAppReady, getBasePath } from '../../state/selectors/app';
import { appReady, appError } from '../../state/actions/app';
import { loadPrivateBrowserFunctions } from '../../lib/load_private_browser_functions';

View file

@ -8,7 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { compose, withProps, withPropsOnChange } from 'recompose';
import { EuiForm, EuiTextArea, EuiButton, EuiButtonEmpty, EuiFormRow } from '@elastic/eui';
import { fromExpression, toExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression, toExpression } from '@kbn/interpreter/common';
import { createStatefulPropHoc } from '../../components/enhance/stateful_prop';
export const AdvancedFailureComponent = props => {

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { interpretAst } from '@kbn/interpreter/public/interpreter';
import { interpretAst } from '@kbn/interpreter/public';
import { pure, compose, lifecycle, withState, branch, renderComponent } from 'recompose';
import { PropTypes } from 'prop-types';
import { Loading } from '../../loading';

View file

@ -8,7 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { pure, compose, branch, renderComponent } from 'recompose';
import Style from 'style-it';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
import { Loading } from '../loading';
import { RenderWithFn } from '../render_with_fn';
import { ElementShareContainer } from '../element_share_container';

View file

@ -15,7 +15,7 @@ import {
branch,
renderComponent,
} from 'recompose';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
import { getSelectedPage, getSelectedElement } from '../../state/selectors/workpad';
import { setExpression, flushContext } from '../../state/actions/elements';
import { getFunctionDefinitions } from '../../lib/function_definitions';

View file

@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { interpretAst } from '@kbn/interpreter/public/interpreter';
import { interpretAst } from '@kbn/interpreter/public';
import { compose, withProps } from 'recompose';
import { get } from 'lodash';
import { toExpression } from '@kbn/interpreter/common/lib/ast';
import { toExpression } from '@kbn/interpreter/common';
import { modelRegistry, viewRegistry, transformRegistry } from '../../expression_types';
import { FunctionFormList as Component } from './function_form_list';

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { BaseForm } from './base_form';
export class ArgType extends BaseForm {

View file

@ -6,7 +6,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { RenderToDom } from '../components/render_to_dom';
import { ExpressionFormHandlers } from '../../common/lib/expression_form_handlers';
import { BaseForm } from './base_form';

View file

@ -7,7 +7,7 @@
import { EuiCallOut } from '@elastic/eui';
import React from 'react';
import { isPlainObject, uniq, last, compact } from 'lodash';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
import { ArgAddPopover } from '../components/arg_add_popover';
import { SidebarSection } from '../components/sidebar/sidebar_section';
import { SidebarSectionTitle } from '../components/sidebar/sidebar_section_title';

View file

@ -5,7 +5,7 @@
*/
import { get, pick } from 'lodash';
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { FunctionForm } from './function_form';
const NO_NEXT_EXP = 'no next expression';

View file

@ -5,7 +5,7 @@
*/
import { pick } from 'lodash';
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { FunctionForm } from './function_form';
export class Transform extends FunctionForm {

View file

@ -5,7 +5,7 @@
*/
import { pick } from 'lodash';
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { FunctionForm } from './function_form';
export class View extends FunctionForm {

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { interpretAst } from '@kbn/interpreter/public/interpreter';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { typesRegistry } from '@kbn/interpreter/common/lib/types_registry';
import { interpretAst } from '@kbn/interpreter/public';
import { fromExpression, typesRegistry } from '@kbn/interpreter/common';
import { getState } from '../state/store';
import { getGlobalFilterExpression } from '../state/selectors/workpad';

View file

@ -5,7 +5,7 @@
*/
import { includes } from 'lodash';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { getType } from '@kbn/interpreter/common';
/*

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { Element } from './element';
class ElementsRegistry extends Registry {

View file

@ -5,7 +5,7 @@
*/
import uniqBy from 'lodash.uniqby';
import { getBrowserRegistries } from '@kbn/interpreter/public/browser_registries';
import { getBrowserRegistries } from '@kbn/interpreter/public';
import { getServerFunctions } from '../state/selectors/app';
export async function getFunctionDefinitions(state) {

View file

@ -5,4 +5,4 @@
*/
// export the common registry here, so it's available in plugin public code
export { functionsRegistry } from '@kbn/interpreter/common/lib/functions_registry';
export { functionsRegistry } from '@kbn/interpreter/common';

View file

@ -5,7 +5,7 @@
*/
import { get, mapValues, map } from 'lodash';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
export function parseSingleFunctionChain(filterString) {
const ast = fromExpression(filterString);

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { RenderFunction } from './render_function';
class RenderFunctionsRegistry extends Registry {

View file

@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { interpretAst } from '@kbn/interpreter/public/interpreter';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { getType } from '@kbn/interpreter/common/lib/get_type';
import { interpretAst } from '@kbn/interpreter/public';
import { fromExpression, getType } from '@kbn/interpreter/common';
import { notify } from './notify';
/**

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Registry } from '@kbn/interpreter/common/lib/registry';
import { Registry } from '@kbn/interpreter/common';
import { Transition } from '../transitions/transition';
class TransitionsRegistry extends Registry {

View file

@ -5,4 +5,4 @@
*/
// export the common registry here, so it's available in plugin public code
export { typesRegistry } from '@kbn/interpreter/common/lib/types_registry';
export { typesRegistry } from '@kbn/interpreter/common';

View file

@ -4,12 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { interpretAst } from '@kbn/interpreter/public/interpreter';
import { interpretAst } from '@kbn/interpreter/public';
import { createAction } from 'redux-actions';
import { createThunk } from 'redux-thunks';
import { set, del } from 'object-path-immutable';
import { get, pick, cloneDeep, without } from 'lodash';
import { toExpression, safeElementFromExpression } from '@kbn/interpreter/common/lib/ast';
import { toExpression, safeElementFromExpression } from '@kbn/interpreter/common';
import { getPages, getElementById, getSelectedPageIndex } from '../selectors/workpad';
import { getValue as getResolvedArgsValue } from '../selectors/resolved_args';
import { getDefaultElement } from '../defaults';

View file

@ -5,7 +5,7 @@
*/
import { get, omit } from 'lodash';
import { safeElementFromExpression } from '@kbn/interpreter/common/lib/ast';
import { safeElementFromExpression } from '@kbn/interpreter/common';
import { append } from '../../lib/modify_path';
import { getAssets } from './assets';

View file

@ -5,7 +5,7 @@
*/
import { sum as arraySum, min as arrayMin, max as arrayMax, get } from 'lodash';
import { fromExpression } from '@kbn/interpreter/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
import { CANVAS_USAGE_TYPE, CANVAS_TYPE } from '../../common/lib/constants';
/*

View file

@ -47,17 +47,10 @@ export function getWebpackConfig({ devtool, watch } = {}) {
function loaderFailHandler() {
// bails on error, including loader errors
// see https://github.com/webpack/webpack/issues/708, which does not fix loader errors
let isWatch = true;
this.plugin('run', function(compiler, callback) {
isWatch = false;
callback.call(compiler);
});
this.plugin('done', function(stats) {
if (!stats.hasErrors()) return;
const errorMessage = stats.toString('errors-only');
if (isWatch) console.error(errorMessage);
if (watch) console.error(errorMessage);
else throw new Error(errorMessage);
});
},

View file

@ -9407,6 +9407,11 @@ getopts@^2.0.6:
resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.0.6.tgz#4788d533a977527e79efd57b5e742ffa0dd33105"
integrity sha512-LauKhe3IAHTAlefQNg1I4rZRE6uPrCWwtVh/rMwHAvqY0PaEkRxOzhgyam0+ZBGdh0K6vybD81KeaS6v6H9+Ww==
getopts@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.2.3.tgz#11d229775e2ec2067ed8be6fcc39d9b4bf39cf7d"
integrity sha512-viEcb8TpgeG05+Nqo5EzZ8QR0hxdyrYDp6ZSTZqe2M/h53Bk036NmqG38Vhf5RGirC/Of9Xql+v66B2gp256SQ==
getos@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.0.tgz#db3aa4df15a3295557ce5e81aa9e3e5cdfaa6567"
@ -20302,7 +20307,7 @@ supports-color@^5.2.0, supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
supports-color@^5.4.0:
supports-color@^5.4.0, supports-color@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==