Skip to content

Commit

Permalink
Remove legacy optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Aug 5, 2020
1 parent 2280927 commit afa73c8
Show file tree
Hide file tree
Showing 263 changed files with 9,531 additions and 20,893 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ target
/src/legacy/core_plugins/console/public/tests/webpackShims
/src/legacy/core_plugins/console/public/webpackShims
/src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/broken
/src/legacy/ui/public/flot-charts
/src/legacy/ui/public/utils/decode_geo_hash.js
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
/src/plugins/vis_type_timelion/public/_generated_/**
/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ out an open PR:

- [CONTRIBUTING.md](CONTRIBUTING.md) will help you get Kibana up and running.
- If you would like to contribute code, please follow our [STYLEGUIDE.md](STYLEGUIDE.md).
- Learn more about our UI code with [UI_SYSTEMS.md](src/legacy/ui/public/UI_SYSTEMS.md).
- For all other questions, check out the [FAQ.md](FAQ.md) and
[wiki](https://github.com/elastic/kibana/wiki).

Expand Down
2 changes: 1 addition & 1 deletion STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ Do not use setters, they cause more problems than they can solve.
When writing a new component, create a sibling SASS file of the same name and import directly into the **top** of the JS/TS component file. Doing so ensures the styles are never separated or lost on import and allows for better modularization (smaller individual plugin asset footprint).
All SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass) & Kibana invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/legacy/ui/public/styles/_globals_v7light.scss).
All SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass) & Kibana invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/core/public/core_app/styles/_globals_v7light.scss).
While the styles for this component will only be loaded if the component exists on the page,
the styles **will** be global and so it is recommended to use a three letter prefix on your
Expand Down
6 changes: 0 additions & 6 deletions docs/setup/install/deb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ locations for a Debian-based system:
| /var/log/kibana
| path.logs

| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| /var/lib/kibana/optimize
d|

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
| /usr/share/kibana/plugins
Expand Down
6 changes: 0 additions & 6 deletions docs/setup/install/rpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,6 @@ locations for an RPM-based system:
| /var/log/kibana
| path.logs

| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| /var/lib/kibana/optimize
d|

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
| /usr/share/kibana/plugins
Expand Down
6 changes: 0 additions & 6 deletions docs/setup/install/targz.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ important data later on.
| $KIBANA_HOME\data
d|

| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| $KIBANA_HOME\data\optimize
d|

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
| $KIBANA_HOME\plugins
Expand Down
6 changes: 0 additions & 6 deletions docs/setup/install/windows.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ important data later on.
| $KIBANA_HOME\data
d|

| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| $KIBANA_HOME\data\optimize
d|

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
| $KIBANA_HOME\plugins
Expand Down
23 changes: 0 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
},
"dependencies": {
"@babel/core": "^7.10.2",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.8.1",
Expand Down Expand Up @@ -154,21 +153,17 @@
"angular-route": "^1.7.9",
"angular-sanitize": "^1.7.9",
"angular-sortable-view": "^0.0.17",
"autoprefixer": "^9.7.4",
"babel-loader": "^8.0.6",
"bluebird": "3.5.5",
"boom": "^7.2.0",
"brace": "0.11.1",
"browserslist-useragent": "^3.0.2",
"cache-loader": "^4.1.0",
"chalk": "^2.4.2",
"check-disk-space": "^2.1.0",
"chokidar": "3.2.1",
"color": "1.0.3",
"commander": "3.0.2",
"compare-versions": "3.5.1",
"core-js": "^3.6.4",
"css-loader": "^3.4.2",
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"deep-freeze-strict": "^1.1.1",
Expand All @@ -180,7 +175,6 @@
"execa": "^4.0.2",
"expiry-js": "0.1.7",
"fast-deep-equal": "^3.1.1",
"file-loader": "4.2.0",
"font-awesome": "4.7.0",
"fp-ts": "^2.3.1",
"getos": "^3.1.0",
Expand Down Expand Up @@ -212,11 +206,9 @@
"leaflet-vega": "^0.8.6",
"leaflet.heat": "0.2.0",
"less": "npm:@elastic/less@2.7.3-kibana",
"less-loader": "5.0.0",
"lodash": "^4.17.15",
"lru-cache": "4.1.5",
"markdown-it": "^10.0.0",
"mini-css-extract-plugin": "0.8.0",
"minimatch": "^3.0.4",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
Expand All @@ -228,12 +220,10 @@
"opn": "^5.5.0",
"oppsy": "^2.0.0",
"pegjs": "0.10.0",
"postcss-loader": "^3.0.0",
"prop-types": "15.6.0",
"proxy-from-env": "1.0.0",
"pug": "^2.0.4",
"query-string": "5.1.1",
"raw-loader": "3.1.0",
"re2": "^1.15.4",
"react": "^16.12.0",
"react-color": "^2.13.8",
Expand All @@ -259,34 +249,25 @@
"resize-observer-polyfill": "^1.5.0",
"rison-node": "1.0.2",
"rxjs": "^6.5.5",
"script-loader": "0.7.2",
"seedrandom": "^3.0.5",
"semver": "^5.5.0",
"style-it": "^2.1.3",
"style-loader": "^1.1.3",
"symbol-observable": "^1.2.0",
"tar": "4.4.13",
"terser-webpack-plugin": "^2.3.4",
"thread-loader": "^2.1.3",
"tinygradient": "0.4.3",
"tinymath": "1.2.1",
"topojson-client": "3.0.0",
"tslib": "^2.0.0",
"type-detect": "^4.0.8",
"ui-select": "0.19.8",
"url-loader": "2.2.0",
"uuid": "3.3.2",
"val-loader": "^1.1.1",
"validate-npm-package-name": "2.2.2",
"vega": "^5.13.0",
"vega-lite": "^4.13.1",
"vega-schema-url-parser": "^1.1.0",
"vega-tooltip": "^0.12.0",
"vision": "^5.3.3",
"webpack": "^4.41.5",
"webpack-merge": "4.2.2",
"whatwg-fetch": "^3.0.0",
"wrapper-webpack-plugin": "^2.1.0",
"yauzl": "2.10.0"
},
"devDependencies": {
Expand Down Expand Up @@ -452,8 +433,6 @@
"has-ansi": "^3.0.0",
"iedriver": "^3.14.2",
"intl-messageformat-parser": "^1.4.0",
"is-path-inside": "^2.1.0",
"istanbul-instrumenter-loader": "3.0.1",
"jest": "^25.5.4",
"jest-canvas-mock": "^2.2.0",
"jest-circus": "^25.5.4",
Expand All @@ -474,14 +453,12 @@
"murmurhash3js": "3.0.1",
"mutation-observer": "^1.0.3",
"nock": "12.0.3",
"node-sass": "^4.13.1",
"normalize-path": "^3.0.0",
"nyc": "^15.0.1",
"pixelmatch": "^5.1.0",
"pkg-up": "^2.0.0",
"pngjs": "^3.4.0",
"postcss": "^7.0.32",
"postcss-url": "^8.0.0",
"prettier": "^2.0.5",
"proxyquire": "1.8.0",
"react-popper-tooltip": "^2.10.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.3.0"
"eslint-plugin-react-hooks": "^4.0.4"
}
}
4 changes: 3 additions & 1 deletion packages/kbn-babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"babel-plugin-filter-imports": "^3.0.0",
"babel-plugin-styled-components": "^1.10.7",
"babel-plugin-transform-define": "^1.3.1",
"babel-plugin-transform-imports": "^2.0.0"
"babel-plugin-transform-imports": "^2.0.0",
"react-is": "^16.8.0",
"styled-components": "^5.1.0"
}
}
1 change: 0 additions & 1 deletion packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"postcss": "^7.0.32",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"resolve-url-loader": "^3.1.1",
"rxjs": "^6.5.5",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

body {
width: $globalStyleConstant;
background-image: url("ui/icon.svg");
}

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
bar.cache.refresh();
expect(bar.cache.getModuleCount()).toBe(
// code + styles + style/css-loader runtimes + public path updater
18
16
);

expect(bar.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Expand All @@ -168,9 +168,8 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/legacy/_other_styles.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/legacy/styles.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/lib.ts,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/legacy/ui/public/icon.svg,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/legacy/ui/public/styles/_globals_v7dark.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/legacy/ui/public/styles/_globals_v7light.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v7dark.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/core_app/styles/_globals_v7light.scss,
<absolute path>/packages/kbn-optimizer/target/worker/entry_point_creator.js,
<absolute path>/packages/kbn-ui-shared-deps/public_path_module_creator.js,
]
Expand Down
16 changes: 8 additions & 8 deletions packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"filters": Array [],
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
"maxWorkerCount": 3,
"outputRoot": <absolute path>,
"pluginPaths": Array [],
"pluginScanDirs": Array [
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"filters": Array [],
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
"maxWorkerCount": 3,
"outputRoot": <absolute path>,
"pluginPaths": Array [],
"pluginScanDirs": Array [
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"filters": Array [],
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
"maxWorkerCount": 3,
"outputRoot": <absolute path>,
"pluginPaths": Array [],
"pluginScanDirs": Array [
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"filters": Array [],
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
"maxWorkerCount": 3,
"outputRoot": <absolute path>,
"pluginPaths": Array [],
"pluginScanDirs": Array [
Expand All @@ -234,7 +234,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"filters": Array [],
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
"maxWorkerCount": 3,
"outputRoot": <absolute path>,
"pluginPaths": Array [],
"pluginScanDirs": Array [
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('OptimizerConfig::create()', () => {
[Window],
],
"invocationCallOrder": Array [
21,
15,
],
"results": Array [
Object {
Expand All @@ -475,7 +475,7 @@ describe('OptimizerConfig::create()', () => {
[Window],
],
"invocationCallOrder": Array [
23,
17,
],
"results": Array [
Object {
Expand All @@ -499,7 +499,7 @@ describe('OptimizerConfig::create()', () => {
[Window],
],
"invocationCallOrder": Array [
22,
16,
],
"results": Array [
Object {
Expand Down
23 changes: 13 additions & 10 deletions packages/kbn-optimizer/src/optimizer/optimizer_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ import { findKibanaPlatformPlugins, KibanaPlatformPlugin } from './kibana_platfo
import { getPluginBundles } from './get_plugin_bundles';
import { filterById } from './filter_by_id';

function pickMaxWorkerCount(dist: boolean) {
// don't break if cpus() returns nothing, or an empty array
const cpuCount = Math.max(Os.cpus()?.length, 1);
// if we're buiding the dist then we can use more of the system's resources to get things done a little quicker
const maxWorkers = dist ? cpuCount - 1 : Math.ceil(cpuCount / 3);
// ensure we always have at least two workers
return Math.max(maxWorkers, 2);
}
// don't break if cpus() returns nothing, or an empty array
const CPU_COUNT = Math.max(Os.cpus()?.length, 1);
// ensure we have at least three workers
const MAX_WORKER_COUNT = Math.max(CPU_COUNT - 1, 3);

function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {
const result: any = {};
Expand Down Expand Up @@ -182,7 +178,7 @@ export class OptimizerConfig {

const maxWorkerCount = process.env.KBN_OPTIMIZER_MAX_WORKERS
? parseInt(process.env.KBN_OPTIMIZER_MAX_WORKERS, 10)
: options.maxWorkerCount ?? pickMaxWorkerCount(dist);
: options.maxWorkerCount ?? MAX_WORKER_COUNT;
if (typeof maxWorkerCount !== 'number' || !Number.isFinite(maxWorkerCount)) {
throw new TypeError('worker count must be a number');
}
Expand Down Expand Up @@ -217,7 +213,14 @@ export class OptimizerConfig {
new Bundle({
type: 'entry',
id: 'core',
publicDirNames: ['public', 'public/utils'],
publicDirNames: [
'public',
'public/utils',
'public/core_app/images/bg_top_branded.svg',
'public/core_app/images/bg_bottom_branded.svg',
'public/core_app/images/bg_top_branded_dark.svg',
'public/core_app/images/bg_bottom_branded_dark.svg',
],
sourceRoot: options.repoRoot,
contextDir: Path.resolve(options.repoRoot, 'src/core'),
outputDir: Path.resolve(options.outputRoot, 'src/core/target/public'),
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/worker/bundle_refs_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import webpack from 'webpack';
import { Bundle, BundleRefs, BundleRef } from '../common';
import { BundleRefModule } from './bundle_ref_module';

const RESOLVE_EXTENSIONS = ['.js', '.ts', '.tsx'];
const RESOLVE_EXTENSIONS = ['.js', '.ts', '.tsx', '.svg'];

function safeStat(path: string): Promise<Fs.Stats | undefined> {
return new Promise((resolve, reject) => {
Expand Down
Loading

0 comments on commit afa73c8

Please sign in to comment.