mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
babel 6 upgrade (#9702)
* [npm] upgrade babel The upgrade to babel 6 requires an upgrade to all of the associated modules, which meant that a few other things changed at the same time. The most notable is the way that we handle our babel-options, which is now done with an npm module and includes using the babel-loader's "presets" query string param. This meant changes to the babel_options.js module and extending it to help setting up the "babel-register" module, which was previously copy-pasted in several places. * [mtodules] upgrade to support babel6 module semantics * [eslint] fix lint errors * [babel] ignoer massive fixture files * [cli/errors] use Object.setPrototypeOf since subclassing Error is broken * [babel] Upgrading core babel libraries [babel] Use WIP babel-6-fix branch of babel-preset-kibana * Fix broken test * [babel] Reverse unnecessary module.exports changes * Fix notifier * Use babel presets and plugins directly * [babel/options] resolve preset/plugins paths for better plugin compatibility * [babel/options] use babel-preset-env for correct node settings * [babel] cache babel compilation in webpack like we thought we were
This commit is contained in:
parent
f2da2a3640
commit
8b4c052889
40 changed files with 242 additions and 142 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -31,6 +31,7 @@ config/*
|
|||
coverage
|
||||
selenium
|
||||
.babelcache.json
|
||||
.webpack.babelcache
|
||||
*.swp
|
||||
*.swo
|
||||
*.out
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const camelCase = require('lodash').camelCase;
|
||||
require('babel/register')(require('./src/optimize/babel_options').node);
|
||||
require('./src/optimize/babel/register');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
// set the config once before calling load-grunt-config
|
||||
|
|
18
package.json
18
package.json
|
@ -93,10 +93,18 @@
|
|||
"ansicolors": "0.3.2",
|
||||
"autoprefixer": "6.5.4",
|
||||
"autoprefixer-loader": "2.0.0",
|
||||
"babel": "5.8.38",
|
||||
"babel-core": "5.8.38",
|
||||
"babel-loader": "5.3.2",
|
||||
"babel-runtime": "5.8.38",
|
||||
"babel-cli": "6.18.0",
|
||||
"babel-core": "6.21.0",
|
||||
"babel-loader": "6.2.10",
|
||||
"babel-plugin-add-module-exports": "0.2.1",
|
||||
"babel-polyfill": "6.20.0",
|
||||
"babel-preset-env": "1.1.8",
|
||||
"babel-preset-es2015": "6.22.0",
|
||||
"babel-preset-es2015-node": "6.1.1",
|
||||
"babel-preset-react": "6.22.0",
|
||||
"babel-preset-stage-1": "6.22.0",
|
||||
"babel-register": "6.18.0",
|
||||
"babel-runtime": "6.20.0",
|
||||
"bluebird": "2.9.34",
|
||||
"body-parser": "1.12.0",
|
||||
"boom": "2.8.0",
|
||||
|
@ -188,7 +196,7 @@
|
|||
"faker": "1.1.0",
|
||||
"grunt": "1.0.1",
|
||||
"grunt-aws-s3": "0.14.5",
|
||||
"grunt-babel": "5.0.1",
|
||||
"grunt-babel": "6.0.0",
|
||||
"grunt-cli": "0.1.13",
|
||||
"grunt-contrib-clean": "1.0.0",
|
||||
"grunt-contrib-copy": "0.8.1",
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
// load the babel options seperately so that they can modify the process.env
|
||||
// before calling babel/register
|
||||
const babelOptions = require('../optimize/babel_options').node;
|
||||
require('babel/register')(babelOptions);
|
||||
require('../optimize/babel/register');
|
||||
require('./cli');
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
// load the babel options seperately so that they can modify the process.env
|
||||
// before calling babel/register
|
||||
const babelOptions = require('../optimize/babel_options').node;
|
||||
require('babel/register')(babelOptions);
|
||||
require('../optimize/babel/register');
|
||||
require('./cli');
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
export class UnsupportedProtocolError extends Error {}
|
||||
export function UnsupportedProtocolError() {
|
||||
Error.call(this, 'Unsupported protocol');
|
||||
}
|
||||
|
||||
UnsupportedProtocolError.prototype = Object.create(Error.prototype);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import visDebugSpyPanelTemplate from 'plugins/dev_mode/vis_debug_spy_panel.html';
|
||||
// register the spy mode or it won't show up in the spys
|
||||
require('ui/registry/spy_modes').register(VisDetailsSpyProvider);
|
||||
import spyModesRegistry from 'ui/registry/spy_modes';
|
||||
|
||||
function VisDetailsSpyProvider(Notifier, $filter, $rootScope, config) {
|
||||
return {
|
||||
|
@ -16,4 +15,5 @@ function VisDetailsSpyProvider(Notifier, $filter, $rootScope, config) {
|
|||
};
|
||||
}
|
||||
|
||||
export default VisDetailsSpyProvider;
|
||||
// register the spy mode or it won't show up in the spys
|
||||
spyModesRegistry.register(VisDetailsSpyProvider);
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
import visTypes from 'ui/registry/vis_types';
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/histogram'));
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/line'));
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/pie'));
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/area'));
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/tile_map'));
|
||||
visTypes.register(require('plugins/kbn_vislib_vis_types/heatmap'));
|
||||
|
||||
import histogramVisTypeProvider from 'plugins/kbn_vislib_vis_types/histogram';
|
||||
import lineVisTypeProvider from 'plugins/kbn_vislib_vis_types/line';
|
||||
import pieVisTypeProvider from 'plugins/kbn_vislib_vis_types/pie';
|
||||
import areaVisTypeProvider from 'plugins/kbn_vislib_vis_types/area';
|
||||
import tileMapVisTypeProvider from 'plugins/kbn_vislib_vis_types/tile_map';
|
||||
import heatmapVisTypeProvider from 'plugins/kbn_vislib_vis_types/heatmap';
|
||||
|
||||
visTypes.register(histogramVisTypeProvider);
|
||||
visTypes.register(lineVisTypeProvider);
|
||||
visTypes.register(pieVisTypeProvider);
|
||||
visTypes.register(areaVisTypeProvider);
|
||||
visTypes.register(tileMapVisTypeProvider);
|
||||
visTypes.register(heatmapVisTypeProvider);
|
||||
|
|
|
@ -2,13 +2,14 @@ import 'plugins/kibana/dashboard/dashboard';
|
|||
import 'plugins/kibana/dashboard/saved_dashboard/saved_dashboards';
|
||||
import 'plugins/kibana/dashboard/styles/index.less';
|
||||
import uiRoutes from 'ui/routes';
|
||||
import savedObjectRegistry from 'ui/saved_objects/saved_object_registry';
|
||||
import { savedDashboardRegister } from 'plugins/kibana/dashboard/saved_dashboard/saved_dashboard_register';
|
||||
|
||||
import dashboardListingTemplate from './listing/dashboard_listing.html';
|
||||
import { DashboardListingController } from './listing/dashboard_listing';
|
||||
import { DashboardConstants } from './dashboard_constants';
|
||||
|
||||
require('ui/saved_objects/saved_object_registry').register(savedDashboardRegister);
|
||||
savedObjectRegistry.register(savedDashboardRegister);
|
||||
|
||||
uiRoutes
|
||||
.defaults(/dashboard/, {
|
||||
|
|
|
@ -2,9 +2,10 @@ import _ from 'lodash';
|
|||
import Scanner from 'ui/utils/scanner';
|
||||
import 'plugins/kibana/dashboard/saved_dashboard/saved_dashboard';
|
||||
import uiModules from 'ui/modules';
|
||||
const module = uiModules.get('app/dashboard');
|
||||
import { SavedObjectLoader } from 'ui/courier/saved_object/saved_object_loader';
|
||||
|
||||
const module = uiModules.get('app/dashboard');
|
||||
|
||||
// bring in the factory
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'plugins/kibana/discover/controllers/discover';
|
|||
import 'plugins/kibana/discover/styles/main.less';
|
||||
import 'ui/doc_table/components/table_row';
|
||||
import savedObjectRegistry from 'ui/saved_objects/saved_object_registry';
|
||||
import savedSearchProvider from 'plugins/kibana/discover/saved_searches/saved_search_register';
|
||||
|
||||
// preload
|
||||
|
||||
savedObjectRegistry.register(require('plugins/kibana/discover/saved_searches/saved_search_register'));
|
||||
savedObjectRegistry.register(savedSearchProvider);
|
||||
|
|
|
@ -17,10 +17,11 @@ import 'ui/draggable/draggable_handle';
|
|||
import 'plugins/kibana/visualize/saved_visualizations/_saved_vis';
|
||||
import 'plugins/kibana/visualize/saved_visualizations/saved_visualizations';
|
||||
import uiRoutes from 'ui/routes';
|
||||
|
||||
import visualizeListingTemplate from './listing/visualize_listing.html';
|
||||
import { VisualizeListingController } from './listing/visualize_listing';
|
||||
import { VisualizeConstants } from './visualize_constants';
|
||||
import savedObjectRegistry from 'ui/saved_objects/saved_object_registry';
|
||||
import savedVisusalizationProvider from 'plugins/kibana/visualize/saved_visualizations/saved_visualization_register';
|
||||
|
||||
uiRoutes
|
||||
.defaults(/visualize/, {
|
||||
|
@ -34,5 +35,4 @@ uiRoutes
|
|||
|
||||
// preloading
|
||||
|
||||
require('ui/saved_objects/saved_object_registry')
|
||||
.register(require('plugins/kibana/visualize/saved_visualizations/saved_visualization_register'));
|
||||
savedObjectRegistry.register(savedVisusalizationProvider);
|
||||
|
|
|
@ -3,12 +3,13 @@ import 'plugins/markdown_vis/markdown_vis_controller';
|
|||
import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/template_vis_type';
|
||||
import markdownVisTemplate from 'plugins/markdown_vis/markdown_vis.html';
|
||||
import markdownVisParamsTemplate from 'plugins/markdown_vis/markdown_vis_params.html';
|
||||
import visTypesRegistry from 'ui/registry/vis_types';
|
||||
// we need to load the css ourselves
|
||||
|
||||
// we also need to load the controller and used by the template
|
||||
|
||||
// register the provider with the visTypes registry so that other know it exists
|
||||
require('ui/registry/vis_types').register(MarkdownVisProvider);
|
||||
visTypesRegistry.register(MarkdownVisProvider);
|
||||
|
||||
function MarkdownVisProvider(Private) {
|
||||
const TemplateVisType = Private(TemplateVisTypeTemplateVisTypeProvider);
|
||||
|
|
|
@ -4,12 +4,13 @@ import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/templat
|
|||
import VisSchemasProvider from 'ui/vis/schemas';
|
||||
import metricVisTemplate from 'plugins/metric_vis/metric_vis.html';
|
||||
import metricVisParamsTemplate from 'plugins/metric_vis/metric_vis_params.html';
|
||||
import visTypesRegistry from 'ui/registry/vis_types';
|
||||
// we need to load the css ourselves
|
||||
|
||||
// we also need to load the controller and used by the template
|
||||
|
||||
// register the provider with the visTypes registry
|
||||
require('ui/registry/vis_types').register(MetricVisProvider);
|
||||
visTypesRegistry.register(MetricVisProvider);
|
||||
|
||||
function MetricVisProvider(Private) {
|
||||
const TemplateVisType = Private(TemplateVisTypeTemplateVisTypeProvider);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
import reqRespStatsHTML from 'plugins/spy_modes/req_resp_stats_spy_mode.html';
|
||||
import spyModesRegistry from 'ui/registry/spy_modes';
|
||||
|
||||
const linkReqRespStats = function ($scope, config) {
|
||||
$scope.$bind('req', 'searchSource.history[searchSource.history.length - 1]');
|
||||
|
@ -27,7 +28,7 @@ const linkReqRespStats = function ($scope, config) {
|
|||
});
|
||||
};
|
||||
|
||||
require('ui/registry/spy_modes')
|
||||
spyModesRegistry
|
||||
.register(function () {
|
||||
return {
|
||||
name: 'request',
|
||||
|
|
|
@ -3,12 +3,12 @@ import _ from 'lodash';
|
|||
import 'ui/agg_table';
|
||||
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
|
||||
import tableSpyModeTemplate from 'plugins/spy_modes/table_spy_mode.html';
|
||||
import spyModesRegistry from 'ui/registry/spy_modes';
|
||||
|
||||
function VisSpyTableProvider(Notifier, $filter, $rootScope, config, Private) {
|
||||
const tabifyAggResponse = Private(AggResponseTabifyTabifyProvider);
|
||||
|
||||
const PER_PAGE_DEFAULT = 10;
|
||||
|
||||
|
||||
return {
|
||||
name: 'table',
|
||||
display: 'Table',
|
||||
|
@ -37,4 +37,4 @@ function VisSpyTableProvider(Notifier, $filter, $rootScope, config, Private) {
|
|||
};
|
||||
}
|
||||
|
||||
require('ui/registry/spy_modes').register(VisSpyTableProvider);
|
||||
spyModesRegistry.register(VisSpyTableProvider);
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'ui/agg_table/agg_table_group';
|
|||
import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/template_vis_type';
|
||||
import VisSchemasProvider from 'ui/vis/schemas';
|
||||
import tableVisTemplate from 'plugins/table_vis/table_vis.html';
|
||||
import visTypesRegistry from 'ui/registry/vis_types';
|
||||
// we need to load the css ourselves
|
||||
|
||||
// we also need to load the controller and used by the template
|
||||
|
@ -15,7 +16,7 @@ import tableVisTemplate from 'plugins/table_vis/table_vis.html';
|
|||
// require the directives that we use as well
|
||||
|
||||
// register the provider with the visTypes registry
|
||||
require('ui/registry/vis_types').register(TableVisTypeProvider);
|
||||
visTypesRegistry.register(TableVisTypeProvider);
|
||||
|
||||
// define the TableVisType
|
||||
function TableVisTypeProvider(Private) {
|
||||
|
|
|
@ -27,7 +27,7 @@ require('./vis');
|
|||
require('ui/saved_objects/saved_object_registry').register(require('plugins/timelion/services/saved_sheet_register'));
|
||||
|
||||
// TODO: Expose an api for dismissing notifications
|
||||
const unsafeNotifications = require('ui/notify')._notifs;
|
||||
const unsafeNotifications = require('ui/notify').default._notifs;
|
||||
|
||||
require('ui/routes').enable();
|
||||
|
||||
|
|
8
src/optimize/babel/.eslintrc
Normal file
8
src/optimize/babel/.eslintrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
root: true
|
||||
env:
|
||||
es6: true
|
||||
node: true
|
||||
rules:
|
||||
no-undef: error
|
||||
quotes: [error, single]
|
52
src/optimize/babel/helpers.js
Normal file
52
src/optimize/babel/helpers.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
// this file is not transpiled in dev
|
||||
|
||||
const env = process.env;
|
||||
const fromRoot = require('path').resolve.bind(null, __dirname, '../../../');
|
||||
|
||||
if (!env.BABEL_CACHE_PATH) {
|
||||
env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json');
|
||||
}
|
||||
|
||||
exports.webpackCacheDir = env.WEBPACK_BABEL_CACHE_DIR || fromRoot('optimize/.webpack.babelcache');
|
||||
|
||||
exports.nodePresets = [
|
||||
[
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
targets: {
|
||||
node: 'current'
|
||||
}
|
||||
}
|
||||
],
|
||||
require.resolve('babel-preset-stage-1'),
|
||||
];
|
||||
|
||||
exports.webpackPresets = [
|
||||
[
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'> 5%',
|
||||
'Safari 7' // for PhantomJS support
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
require.resolve('babel-preset-stage-1'),
|
||||
require.resolve('babel-preset-react'),
|
||||
]
|
||||
|
||||
exports.plugins = [
|
||||
require.resolve('babel-plugin-add-module-exports'),
|
||||
];
|
||||
|
||||
exports.devIgnore = [
|
||||
/[\\\/](node_modules|bower_components)[\\\/]/
|
||||
]
|
||||
|
||||
exports.buildIgnore = [
|
||||
fromRoot('src'),
|
||||
...exports.devIgnore
|
||||
]
|
16
src/optimize/babel/options.build.js
Normal file
16
src/optimize/babel/options.build.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const {
|
||||
nodePresets,
|
||||
webpackPresets,
|
||||
plugins,
|
||||
buildIgnore
|
||||
} = require('./helpers');
|
||||
|
||||
exports.webpack = {
|
||||
presets: webpackPresets,
|
||||
plugins: plugins
|
||||
};
|
||||
exports.node = {
|
||||
presets: nodePresets,
|
||||
plugins,
|
||||
ignore: buildIgnore
|
||||
};
|
20
src/optimize/babel/options.js
Normal file
20
src/optimize/babel/options.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
// this file is not transpiled in dev
|
||||
|
||||
const {
|
||||
nodePresets,
|
||||
webpackPresets,
|
||||
webpackCacheDir,
|
||||
plugins,
|
||||
devIgnore
|
||||
} = require('./helpers');
|
||||
|
||||
exports.webpack = {
|
||||
cacheDirectory: webpackCacheDir,
|
||||
presets: webpackPresets,
|
||||
plugins: plugins
|
||||
};
|
||||
exports.node = {
|
||||
presets: nodePresets,
|
||||
plugins,
|
||||
ignore: devIgnore
|
||||
};
|
4
src/optimize/babel/register.js
Normal file
4
src/optimize/babel/register.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
// this file is not transpiled in dev
|
||||
|
||||
require('babel-polyfill');
|
||||
require('babel-register')(require('./options').node);
|
|
@ -1,19 +0,0 @@
|
|||
import { cloneDeep } from 'lodash';
|
||||
const fromRoot = require('path').resolve.bind(null, __dirname, '../../');
|
||||
|
||||
if (!process.env.BABEL_CACHE_PATH) {
|
||||
process.env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json');
|
||||
}
|
||||
|
||||
exports.webpack = {
|
||||
stage: 1,
|
||||
nonStandard: true,
|
||||
optional: ['runtime']
|
||||
};
|
||||
|
||||
exports.node = cloneDeep({
|
||||
ignore: [
|
||||
fromRoot('src'),
|
||||
/[\\\/](node_modules|bower_components)[\\\/]/
|
||||
]
|
||||
}, exports.webpack);
|
|
@ -1,19 +0,0 @@
|
|||
// this file is not transpiled
|
||||
'use strict'; // eslint-disable-line strict
|
||||
|
||||
const cloneDeep = require('lodash').cloneDeep;
|
||||
const fromRoot = require('path').resolve.bind(null, __dirname, '../../');
|
||||
|
||||
if (!process.env.BABEL_CACHE_PATH) {
|
||||
process.env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json');
|
||||
}
|
||||
|
||||
exports.webpack = {
|
||||
stage: 1,
|
||||
nonStandard: true,
|
||||
optional: ['runtime']
|
||||
};
|
||||
|
||||
exports.node = cloneDeep(exports.webpack);
|
||||
exports.node.optional = ['asyncToGenerator'];
|
||||
exports.node.blacklist = ['regenerator'];
|
|
@ -11,7 +11,7 @@ import UglifyJsPlugin from 'webpack/lib/optimize/UglifyJsPlugin';
|
|||
import { defaults, transform } from 'lodash';
|
||||
|
||||
import fromRoot from '../utils/from_root';
|
||||
import babelOptions from './babel_options';
|
||||
import babelOptions from './babel/options';
|
||||
import pkg from '../../package.json';
|
||||
import { setLoaderQueryParam, makeLoaderString } from './loaders';
|
||||
|
||||
|
@ -135,12 +135,8 @@ class BaseOptimizer {
|
|||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: babelExclude.concat(this.env.noParse),
|
||||
loader: makeLoaderString([
|
||||
{
|
||||
name: 'babel-loader',
|
||||
query: babelOptions.webpack
|
||||
}
|
||||
]),
|
||||
loader: 'babel-loader',
|
||||
query: babelOptions.webpack
|
||||
},
|
||||
],
|
||||
postLoaders: this.env.postLoaders || [],
|
||||
|
|
|
@ -8,14 +8,17 @@ import getDefaultRoute from './get_default_route';
|
|||
import versionCheckMixin from './version_check';
|
||||
import { handleShortUrlError } from './short_url_error';
|
||||
import { shortUrlAssertValid } from './short_url_assert_valid';
|
||||
import shortUrlLookupProvider from './short_url_lookup';
|
||||
import setupConnectionMixin from './setup_connection';
|
||||
import registerHapiPluginsMixin from './register_hapi_plugins';
|
||||
import xsrfMixin from './xsrf';
|
||||
|
||||
module.exports = async function (kbnServer, server, config) {
|
||||
|
||||
server = kbnServer.server = new Hapi.Server();
|
||||
|
||||
const shortUrlLookup = require('./short_url_lookup')(server);
|
||||
await kbnServer.mixin(require('./register_hapi_plugins'));
|
||||
await kbnServer.mixin(require('./setup_connection'));
|
||||
const shortUrlLookup = shortUrlLookupProvider(server);
|
||||
await kbnServer.mixin(setupConnectionMixin);
|
||||
await kbnServer.mixin(registerHapiPluginsMixin);
|
||||
|
||||
// provide a simple way to expose static directories
|
||||
server.decorate('server', 'exposeStaticDir', function (routePath, dirPath) {
|
||||
|
@ -144,5 +147,5 @@ module.exports = async function (kbnServer, server, config) {
|
|||
|
||||
kbnServer.mixin(versionCheckMixin);
|
||||
|
||||
return kbnServer.mixin(require('./xsrf'));
|
||||
return kbnServer.mixin(xsrfMixin);
|
||||
};
|
||||
|
|
|
@ -5,6 +5,22 @@ import { fromRoot, pkg } from '../utils';
|
|||
import Config from './config/config';
|
||||
import loggingConfiguration from './logging/configuration';
|
||||
|
||||
import configSetupMixin from './config/setup';
|
||||
import httpMixin from './http';
|
||||
import loggingMixin from './logging';
|
||||
import deprecationWarningsMixin from './config/deprecation_warnings';
|
||||
import warningsMixin from './warnings';
|
||||
import statusMixin from './status';
|
||||
import pidMixin from './pid';
|
||||
import pluginsScanMixin from './plugins/scan';
|
||||
import pluginsCheckEnabledMixin from './plugins/check_enabled';
|
||||
import pluginsCheckVersionMixin from './plugins/check_version';
|
||||
import configCompleteMixin from './config/complete';
|
||||
import uiMixin from '../ui';
|
||||
import uiSettingsMixin from '../ui/settings';
|
||||
import optimizeMixin from '../optimize';
|
||||
import pluginsInitializeMixin from './plugins/initialize';
|
||||
|
||||
const rootDir = fromRoot('.');
|
||||
|
||||
module.exports = class KbnServer {
|
||||
|
@ -16,41 +32,37 @@ module.exports = class KbnServer {
|
|||
this.settings = settings || {};
|
||||
|
||||
this.ready = constant(this.mixin(
|
||||
require('./config/setup'), // sets this.config, reads this.settings
|
||||
require('./http'), // sets this.server
|
||||
require('./logging'),
|
||||
require('./config/deprecation_warnings'),
|
||||
require('./warnings'),
|
||||
require('./status'),
|
||||
|
||||
// sets this.config, reads this.settings
|
||||
configSetupMixin,
|
||||
// sets this.server
|
||||
httpMixin,
|
||||
loggingMixin,
|
||||
warningsMixin,
|
||||
statusMixin,
|
||||
// writes pid file
|
||||
require('./pid'),
|
||||
|
||||
pidMixin,
|
||||
// find plugins and set this.plugins
|
||||
require('./plugins/scan'),
|
||||
pluginsScanMixin,
|
||||
|
||||
// disable the plugins that are disabled through configuration
|
||||
require('./plugins/check_enabled'),
|
||||
pluginsCheckEnabledMixin,
|
||||
|
||||
// disable the plugins that are incompatible with the current version of Kibana
|
||||
require('./plugins/check_version'),
|
||||
pluginsCheckVersionMixin,
|
||||
|
||||
// tell the config we are done loading plugins
|
||||
require('./config/complete'),
|
||||
|
||||
configCompleteMixin,
|
||||
// setup this.uiExports and this.bundles
|
||||
require('../ui'),
|
||||
uiMixin,
|
||||
|
||||
// setup server.uiSettings
|
||||
require('../ui/settings'),
|
||||
uiSettingsMixin,
|
||||
|
||||
// ensure that all bundles are built, or that the
|
||||
// lazy bundle server is running
|
||||
require('../optimize'),
|
||||
|
||||
optimizeMixin,
|
||||
// finally, initialize the plugins
|
||||
require('./plugins/initialize'),
|
||||
|
||||
pluginsInitializeMixin,
|
||||
() => {
|
||||
if (this.config.get('server.autoListen')) {
|
||||
this.ready = constant(resolve());
|
||||
|
|
8
src/ui/public/chrome/api/angular.js
vendored
8
src/ui/public/chrome/api/angular.js
vendored
|
@ -5,9 +5,11 @@ import modules from 'ui/modules';
|
|||
import Notifier from 'ui/notify/notifier';
|
||||
import { UrlOverflowServiceProvider } from '../../error_url_overflow';
|
||||
|
||||
import directivesProvider from '../directives';
|
||||
|
||||
const URL_LIMIT_WARN_WITHIN = 1000;
|
||||
|
||||
module.exports = function (chrome, internals) {
|
||||
export default function (chrome, internals) {
|
||||
chrome.getFirstPathSegment = _.noop;
|
||||
chrome.getBreadcrumbs = _.noop;
|
||||
|
||||
|
@ -95,9 +97,9 @@ module.exports = function (chrome, internals) {
|
|||
$rootScope.$on('$routeChangeStart', check);
|
||||
});
|
||||
|
||||
require('../directives')(chrome, internals);
|
||||
directivesProvider(chrome, internals);
|
||||
|
||||
modules.link(kibana);
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||
import angular from 'angular';
|
||||
|
||||
import metadata from 'ui/metadata';
|
||||
import 'babel/polyfill';
|
||||
import 'babel-polyfill';
|
||||
import 'ui/timefilter';
|
||||
import 'ui/notify';
|
||||
import 'ui/private';
|
||||
|
@ -12,6 +12,14 @@ import 'ui/directives/kbn_src';
|
|||
import 'ui/watch_multi';
|
||||
import './services';
|
||||
|
||||
import angularApi from './api/angular';
|
||||
import appsApi from './api/apps';
|
||||
import controlsApi from './api/controls';
|
||||
import navApi from './api/nav';
|
||||
import templateApi from './api/template';
|
||||
import themeApi from './api/theme';
|
||||
import xsrfApi from './api/xsrf';
|
||||
|
||||
const chrome = {};
|
||||
const internals = _.defaults(
|
||||
_.cloneDeep(metadata),
|
||||
|
@ -28,13 +36,13 @@ const internals = _.defaults(
|
|||
}
|
||||
);
|
||||
|
||||
require('./api/apps')(chrome, internals);
|
||||
require('./api/xsrf')(chrome, internals);
|
||||
require('./api/nav')(chrome, internals);
|
||||
require('./api/angular')(chrome, internals);
|
||||
require('./api/controls')(chrome, internals);
|
||||
require('./api/template')(chrome, internals);
|
||||
require('./api/theme')(chrome, internals);
|
||||
appsApi(chrome, internals);
|
||||
xsrfApi(chrome, internals);
|
||||
navApi(chrome, internals);
|
||||
angularApi(chrome, internals);
|
||||
controlsApi(chrome, internals);
|
||||
templateApi(chrome, internals);
|
||||
themeApi(chrome, internals);
|
||||
|
||||
chrome.bootstrap = function () {
|
||||
chrome.setupAngular();
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
getUnhashableStatesProvider,
|
||||
unhashUrl,
|
||||
} from 'ui/state_management/state_hashing';
|
||||
import Notifier from 'ui/notify';
|
||||
|
||||
export default function (chrome, internals) {
|
||||
|
||||
|
@ -55,7 +56,7 @@ export default function (chrome, internals) {
|
|||
|
||||
// and some local values
|
||||
chrome.httpActive = $http.pendingRequests;
|
||||
$scope.notifList = require('ui/notify')._notifs;
|
||||
$scope.notifList = Notifier._notifs;
|
||||
|
||||
return chrome;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ const links = [];
|
|||
* @param {AngularModule} module - the module to extend
|
||||
* @return {undefined}
|
||||
*/
|
||||
function link(module) {
|
||||
export function link(module) {
|
||||
// as modules are defined they will be set as requirements for this app
|
||||
links.push(module);
|
||||
|
||||
|
@ -78,7 +78,7 @@ function link(module) {
|
|||
* @param {array[string]} [requires=[]] - the other modules this module requires
|
||||
* @return {AngularModule}
|
||||
*/
|
||||
function get(moduleName, requires) {
|
||||
export function get(moduleName, requires) {
|
||||
let module = existingModules[moduleName];
|
||||
|
||||
if (module === void 0) {
|
||||
|
@ -101,7 +101,7 @@ function get(moduleName, requires) {
|
|||
return module;
|
||||
}
|
||||
|
||||
function close(moduleName) {
|
||||
export function close(moduleName) {
|
||||
const module = existingModules[moduleName];
|
||||
|
||||
// already closed
|
||||
|
@ -120,8 +120,4 @@ function close(moduleName) {
|
|||
delete existingModules[moduleName];
|
||||
}
|
||||
|
||||
export default {
|
||||
link: link,
|
||||
get: get,
|
||||
close: close
|
||||
};
|
||||
export default { link, get, close };
|
||||
|
|
|
@ -81,8 +81,8 @@ class UiExports {
|
|||
|
||||
case 'link':
|
||||
case 'links':
|
||||
return (plugin, spec) => {
|
||||
for (const spec of [].concat(spec || [])) {
|
||||
return (plugin, specs) => {
|
||||
for (const spec of [].concat(specs || [])) {
|
||||
this.navLinks.new(spec);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Binder } from './';
|
||||
import Binder from './binder';
|
||||
|
||||
export default class BinderFor extends Binder {
|
||||
constructor(emitter) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function (grunt) {
|
||||
|
||||
const srcFile = 'build/kibana/src/optimize/babel_options.js';
|
||||
const buildFile = 'build/kibana/src/optimize/babel_options.build.js';
|
||||
const srcFile = 'build/kibana/src/optimize/babel/options.js';
|
||||
const buildFile = 'build/kibana/src/optimize/babel/options.build.js';
|
||||
const rename = require('fs').renameSync;
|
||||
const unlink = require('fs').unlinkSync;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import fromRoot from '../../src/utils/from_root';
|
|||
import KbnServer from '../../src/server/kbn_server';
|
||||
import * as i18nVerify from '../utils/i18n_verify_keys';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
export default function (grunt) {
|
||||
grunt.registerTask('_build:verifyTranslations', function () {
|
||||
const done = this.async();
|
||||
const parsePaths = [fromRoot('/src/ui/views/*.jade')];
|
||||
|
@ -43,7 +43,7 @@ module.exports = function (grunt) {
|
|||
.then(() => done(err));
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function verifyTranslations(uiI18nObj, parsePaths)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { defaults } = require('lodash');
|
||||
const babelOptions = require('../../src/optimize/babel_options');
|
||||
const babelOptions = require('../../src/optimize/babel/options');
|
||||
|
||||
module.exports = {
|
||||
build: {
|
||||
|
|
|
@ -37,7 +37,7 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
|
||||
|
||||
bdd.describe('field data', function () {
|
||||
const queryName1 = 'Query # 1';
|
||||
const queryName1 = 'New Saved Search';
|
||||
const fromTimeString = 'September 19th 2015, 06:31:44.000';
|
||||
const toTimeString = 'September 23rd 2015, 18:31:44.000';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const sinon = require('sinon');
|
||||
const autoRelease = require('auto-release-sinon');
|
||||
|
||||
require('babel/register')(require('../src/optimize/babel_options').node);
|
||||
require('../src/optimize/babel/register');
|
||||
|
||||
// hook into the global afterEach variable to allow autoReleaseSinon to register
|
||||
// an afterEach handler before mocha has exposed itself to the test files.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const defaults = require('lodash').defaults;
|
||||
const babelOptions = require('../../src/optimize/babel_options');
|
||||
const babelOptions = require('../../src/optimize/babel/options');
|
||||
|
||||
require('source-map-support').install();
|
||||
require('babel/register')(defaults({
|
||||
require('babel-register')(defaults({
|
||||
ignore: [
|
||||
'test/fixtures/scenarios/**/*',
|
||||
'node_modules/**',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue