Skip to content

Commit

Permalink
Sustainable Kibana Architecture: Categorise straightforward packages (
Browse files Browse the repository at this point in the history
#199630)

## Summary

This PR is part of the Kibana Sustainable Architecture effort.

The goal is to start categorising Kibana packages into _generic
platform_ (`group: "platform"`) vs _solution-specific_.

```
group?: 'search' | 'security' | 'observability' | 'platform'
visibility?: 'private' | 'shared'
```
Uncategorised modules are considered to be `group: 'common', visibility:
'shared'` by default.

We want to prevent code from solution A to depend on code from solution
B.
Thus, the rules are pretty simple:

* Modules can only depend on:
  * Modules in the same group
  * OR modules with 'shared' visibility
* Modules in `'observability', 'security', 'search'` groups are
mandatorily `visibility: "private"`.

Long term, the goal is to re-organise packages into dedicated folders,
e.g.:

```
x-pack/platform/plugins/private
x-pack/observability/packages
```

For this first wave, we have categorised packages that seem
"straightforward":
* Any packages that have:
  * at least one dependant module
  * all dependants belong to the same group
* Categorise all Core packages:
  * `@kbn/core-...-internal` => _platform/private_
  * everything else => _platform/shared_
* Categorise as _platform/shared_ those packages that:
  * Have at least one dependant in the _platform_ group.
  * Don't have any `devOnly: true` dependants.

### What we ask from you, as CODEOWNERS of the _package manifests_, is
that you confirm that the categorisation is correct:

* `group: "platform", visibility: "private"` if it's a package that
should only be used from platform code, not from any solution code. It
will be loaded systematically in all serverless flavors, but solution
plugins and packages won't be able to `import` from it.
* `group: "platform", visibility: "shared"` if it's a package that can
be consumed by both platform and solutions code. It will be loaded
systematically in all serverless flavors, and anybody can import / use
code from it.
* `group: "observability" | "security" | "search", visibility:
"private"` if it's a package that is intented to be used exclusively
from a given solution. It won't be accessible nor loaded from other
solutions nor platform code.

Please refer to
[#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E)
for any related questions.

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit b24fdf5)

# Conflicts:
#	.github/CODEOWNERS
#	packages/kbn-flot-charts/kibana.jsonc
#	packages/kbn-item-buffer/kibana.jsonc
#	packages/kbn-mapbox-gl/kibana.jsonc
#	packages/kbn-typed-react-router-config/kibana.jsonc
#	x-pack/packages/maps/vector_tile_utils/kibana.jsonc
#	x-pack/packages/security/ui_components/kibana.jsonc
#	x-pack/plugins/security/tsconfig.json
#	x-pack/plugins/spaces/tsconfig.json
  • Loading branch information
gsoldevila committed Nov 22, 2024
1 parent 4ad0c2d commit 8c5d062
Show file tree
Hide file tree
Showing 673 changed files with 4,026 additions and 1,527 deletions.
6 changes: 3 additions & 3 deletions examples/resizable_layout_examples/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { CoreThemeProvider } from '@kbn/core-theme-browser-internal';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import type { AppMountParameters } from '@kbn/core/public';
import { I18nProvider } from '@kbn/i18n-react';
import React, { ReactNode, useState } from 'react';
Expand Down Expand Up @@ -101,7 +101,7 @@ const ResizableSection = ({
export const renderApp = ({ element, theme$ }: AppMountParameters) => {
ReactDOM.render(
<I18nProvider>
<CoreThemeProvider theme$={theme$}>
<KibanaThemeProvider theme={{ theme$ }}>
<div
css={css`
height: calc(100vh - var(--euiFixedHeadersOffset, 0));
Expand Down Expand Up @@ -151,7 +151,7 @@ export const renderApp = ({ element, theme$ }: AppMountParameters) => {
}
/>
</div>
</CoreThemeProvider>
</KibanaThemeProvider>
</I18nProvider>,
element
);
Expand Down
2 changes: 1 addition & 1 deletion examples/resizable_layout_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"include": ["common/**/*", "public/**/*", "server/**/*", "../../typings/**/*"],
"kbn_references": [
"@kbn/resizable-layout",
"@kbn/core-theme-browser-internal",
"@kbn/core",
"@kbn/i18n-react",
"@kbn/developer-examples-plugin",
"@kbn/react-kibana-context-theme",
],
"exclude": ["target/**/*"]
}
4 changes: 2 additions & 2 deletions examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { lastValueFrom, of } from 'rxjs';

import { CoreStart } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { mountReactNode } from '@kbn/core-mount-utils-browser-internal';
import type { TimeRange } from '@kbn/es-query';
import { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public';

Expand All @@ -48,6 +47,7 @@ import {
import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import { createStateContainer, useContainerState } from '@kbn/kibana-utils-plugin/public';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { PLUGIN_ID } from '../../common';
import { getInitialStateFromUrl, SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR } from './app_locator';

Expand Down Expand Up @@ -735,7 +735,7 @@ function doSearch(
);
notifications.toasts.addSuccess({
title: 'Query result',
text: mountReactNode(message),
text: toMountPoint(message, startServices),
});
}
}),
Expand Down
1 change: 0 additions & 1 deletion examples/search_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@kbn/utility-types",
"@kbn/es-query",
"@kbn/i18n",
"@kbn/core-mount-utils-browser-internal",
"@kbn/config-schema",
"@kbn/shared-ux-router",
"@kbn/search-types",
Expand Down
6 changes: 3 additions & 3 deletions examples/unified_field_list_examples/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { I18nProvider } from '@kbn/i18n-react';
import { CoreThemeProvider } from '@kbn/core-theme-browser-internal';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
import { AppPluginStartDependencies } from './types';
import { UnifiedFieldListExampleApp } from './example_app';
Expand All @@ -22,14 +22,14 @@ export const renderApp = (
) => {
ReactDOM.render(
<I18nProvider>
<CoreThemeProvider theme$={theme$}>
<KibanaThemeProvider theme={{ theme$ }}>
<UnifiedFieldListExampleApp
services={{
core,
...deps,
}}
/>
</CoreThemeProvider>
</KibanaThemeProvider>
</I18nProvider>,
element
);
Expand Down
2 changes: 1 addition & 1 deletion examples/unified_field_list_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@kbn/field-formats-plugin",
"@kbn/data-view-field-editor-plugin",
"@kbn/unified-field-list",
"@kbn/core-theme-browser-internal",
"@kbn/ui-actions-plugin",
"@kbn/react-kibana-context-theme",
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"@kbn/core-http-router-server-internal": "link:packages/core/http/core-http-router-server-internal",
"@kbn/core-http-server": "link:packages/core/http/core-http-server",
"@kbn/core-http-server-internal": "link:packages/core/http/core-http-server-internal",
"@kbn/core-http-server-utils": "link:packages/core/http/core-http-server-utils",
"@kbn/core-i18n-browser": "link:packages/core/i18n/core-i18n-browser",
"@kbn/core-i18n-browser-internal": "link:packages/core/i18n/core-i18n-browser-internal",
"@kbn/core-i18n-server": "link:packages/core/i18n/core-i18n-server",
Expand Down Expand Up @@ -638,7 +639,6 @@
"@kbn/management-settings-types": "link:packages/kbn-management/settings/types",
"@kbn/management-settings-utilities": "link:packages/kbn-management/settings/utilities",
"@kbn/management-test-plugin": "link:test/plugin_functional/plugins/management_test_plugin",
"@kbn/manifest": "link:packages/kbn-manifest",
"@kbn/mapbox-gl": "link:packages/kbn-mapbox-gl",
"@kbn/maps-custom-raster-source-plugin": "link:x-pack/examples/third_party_maps_source_example",
"@kbn/maps-ems-plugin": "link:src/plugins/maps_ems",
Expand Down Expand Up @@ -1458,6 +1458,7 @@
"@kbn/managed-vscode-config": "link:packages/kbn-managed-vscode-config",
"@kbn/managed-vscode-config-cli": "link:packages/kbn-managed-vscode-config-cli",
"@kbn/management-storybook-config": "link:packages/kbn-management/storybook/config",
"@kbn/manifest": "link:packages/kbn-manifest",
"@kbn/mock-idp-plugin": "link:packages/kbn-mock-idp-plugin",
"@kbn/mock-idp-utils": "link:packages/kbn-mock-idp-utils",
"@kbn/observability-onboarding-e2e": "link:x-pack/plugins/observability_solution/observability_onboarding/e2e",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/analytics-collection-utils",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
8 changes: 6 additions & 2 deletions packages/cloud/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/cloud",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
8 changes: 6 additions & 2 deletions packages/content-management/content_editor/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-content-editor",
"owner": "@elastic/appex-sharedux",
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-content-insights-public",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/content-management-content-insights-server",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/content-management-favorites-common",
"owner": "@elastic/appex-sharedux"
"owner": "@elastic/appex-sharedux",
"group": "platform",
"visibility": "private"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-favorites-public",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/content-management-favorites-server",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-tabbed-table-list-view",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "private"
}
8 changes: 6 additions & 2 deletions packages/content-management/table_list_view/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-common",
"id": "@kbn/content-management-table-list-view-common",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view-table",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
8 changes: 6 additions & 2 deletions packages/content-management/user_profiles/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/content-management-user-profiles",
"owner": "@elastic/appex-sharedux"
}
"owner": [
"@elastic/appex-sharedux"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser-mocks",
"devOnly": true,
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared",
"devOnly": true
}
8 changes: 6 additions & 2 deletions packages/core/analytics/core-analytics-browser/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-analytics-browser",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
10 changes: 7 additions & 3 deletions packages/core/analytics/core-analytics-server-mocks/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server-mocks",
"devOnly": true,
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared",
"devOnly": true
}
8 changes: 6 additions & 2 deletions packages/core/analytics/core-analytics-server/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-server",
"id": "@kbn/core-analytics-server",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/core-application-browser-internal",
"owner": "@elastic/kibana-core"
}
"owner": [
"@elastic/kibana-core"
],
"group": "platform",
"visibility": "private"
}
Loading

0 comments on commit 8c5d062

Please sign in to comment.