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

Remove legacy optimizer #73154

Merged
merged 34 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8fbc20b
Remove legacy optimizer
spalger Aug 5, 2020
682f944
update test fixutre
spalger Aug 5, 2020
f1cbff2
restore kbn/pm dist checking and update dist
spalger Aug 5, 2020
a3abe9f
update deprecation tests to be more comprehensive
spalger Aug 5, 2020
63ea215
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 5, 2020
5073e32
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 6, 2020
6c8acb9
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 6, 2020
109e474
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 10, 2020
f618833
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 10, 2020
0442364
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 10, 2020
09ecffa
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 11, 2020
93b97d6
rebuild kbn/pm dist
spalger Aug 11, 2020
28a232d
[src/cli] the server log isn't usable until started, just exit
spalger Aug 11, 2020
3725f17
expand --help for --optimize
spalger Aug 11, 2020
a5e7186
remove remaining mentions of webpackShims
spalger Aug 11, 2020
751c305
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 11, 2020
ac3d89b
remove one more unused webpackShim
spalger Aug 11, 2020
0f346f3
remove uiExports module references and fix some eslint issues
spalger Aug 11, 2020
d04bcbd
remove tests for unused functionality
spalger Aug 11, 2020
30ae99f
remove styleSheetToCompile usage from plugin-helpers
spalger Aug 11, 2020
d39ddbf
update yarn.lock
spalger Aug 11, 2020
b2a2d1c
remove invalid/unused imports
spalger Aug 11, 2020
be318f1
always attempt to use node resolution before webpack resolution
spalger Aug 11, 2020
4fd4301
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 11, 2020
054913c
revert change to max worker count
spalger Aug 11, 2020
b41d99f
Merge branch 'master' into remove/legacy-optimizer
elasticmachine Aug 12, 2020
dac0a5f
Merge branch 'master' into remove/legacy-optimizer
elasticmachine Aug 12, 2020
d2332b2
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 12, 2020
43b2fad
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 12, 2020
9f46cd1
apply some feedback
spalger Aug 13, 2020
5adf934
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 13, 2020
2f19db6
remove legacy snapshots from rendering service
spalger Aug 13, 2020
86b2a4d
remove unused variable
spalger Aug 13, 2020
f29489d
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
spalger Aug 13, 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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ target
/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
spalger marked this conversation as resolved.
Show resolved Hide resolved
/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).
tylersmalley marked this conversation as resolved.
Show resolved Hide resolved
- 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
24 changes: 0 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
},
"dependencies": {
"@babel/core": "^7.11.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we still using babel in production? I thought we pre-babel'd everything during the build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still babel-register, but I plan to remove that soon, once the plugin-helpers take care of babel-ifying things at build time.

"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/register": "^7.10.5",
"@elastic/apm-rum": "^5.4.0",
"@elastic/charts": "19.8.1",
Expand Down Expand Up @@ -154,20 +153,16 @@
"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",
"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 @@ -179,7 +174,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 @@ -211,11 +205,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 @@ -227,12 +219,9 @@
"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",
spalger marked this conversation as resolved.
Show resolved Hide resolved
"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 @@ -258,34 +247,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 @@ -451,8 +431,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 @@ -473,14 +451,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 @@ -29,6 +29,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
14 changes: 5 additions & 9 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);
spalger marked this conversation as resolved.
Show resolved Hide resolved

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
Loading