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

[Presentation] Remove uses of export * from in Presentation Util plugin #145633

Merged
merged 5 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { ExpressionRenderDefinition } from '@kbn/expressions-plugin/common';
import { i18n } from '@kbn/i18n';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { LazyDebugRenderComponent } from '../components';
import { JSON } from '../../common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
} from '@kbn/expressions-plugin/common';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { ErrorRendererConfig } from '../../common/types';
import { LazyErrorRenderComponent } from '../components';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
functionWrapper,
getElasticLogo,
getElasticOutline,
} from '@kbn/presentation-util-plugin/common/lib';
} from '@kbn/presentation-util-plugin/common';
import { imageFunction as image } from './image_function';

describe('image', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { i18n } from '@kbn/i18n';
import { getElasticLogo, resolveWithMissingImage } from '@kbn/presentation-util-plugin/common/lib';
import { getElasticLogo, resolveWithMissingImage } from '@kbn/presentation-util-plugin/common';
import { BASE64, URL } from '../constants';
import { ExpressionImageFunction, ImageMode } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Render, waitFor } from '@kbn/presentation-util-plugin/public/__stories__';
import { getElasticLogo } from '@kbn/presentation-util-plugin/common/lib';
import { getElasticLogo } from '@kbn/presentation-util-plugin/common';
import { getImageRenderer } from '../image_renderer';
import { ImageMode } from '../../../common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Observable } from 'rxjs';
import { CoreTheme } from '@kbn/core/public';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { getElasticLogo, defaultTheme$, isValidUrl } from '@kbn/presentation-util-plugin/public';
import { getElasticLogo, defaultTheme$, isValidUrl } from '@kbn/presentation-util-plugin/common';
import { ImageRendererConfig } from '../../common/types';

const strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { ExecutionContext } from '@kbn/expressions-plugin/common';
import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common';
import { metricFunction } from './metric_function';

describe('metric', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
import { i18n } from '@kbn/i18n';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { MetricRendererConfig } from '../../common/types';

const strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getElasticLogo,
getElasticOutline,
functionWrapper,
} from '@kbn/presentation-util-plugin/common/lib';
} from '@kbn/presentation-util-plugin/common';
import { repeatImageFunction } from './repeat_image_function';

describe('repeatImage', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getElasticOutline,
isValidUrl,
resolveWithMissingImage,
} from '@kbn/presentation-util-plugin/common/lib';
} from '@kbn/presentation-util-plugin/common';
import { CONTEXT, BASE64, URL } from '../constants';
import { ExpressionRepeatImageFunction } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Render } from '@kbn/presentation-util-plugin/public/__stories__';
import { getElasticLogo, getElasticOutline } from '@kbn/presentation-util-plugin/common/lib';
import { getElasticLogo, getElasticOutline } from '@kbn/presentation-util-plugin/common';
import { waitFor } from '@kbn/presentation-util-plugin/public/__stories__';
import { getRepeatImageRenderer } from '../repeat_image_renderer';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@kbn/i18n-react';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { CoreSetup } from '@kbn/core/public';
import {
defaultTheme$,
getElasticOutline,
isValidUrl,
withSuspense,
} from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$, getElasticOutline, isValidUrl } from '@kbn/presentation-util-plugin/common';
import { RepeatImageRendererConfig } from '../../common/types';

const strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
functionWrapper,
getElasticOutline,
getElasticLogo,
} from '@kbn/presentation-util-plugin/common/lib';
} from '@kbn/presentation-util-plugin/common';
import { revealImageFunction, errors } from './reveal_image_function';
import { Origin } from '../types';
import { ExecutionContext } from '@kbn/expressions-plugin/common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
resolveWithMissingImage,
getElasticOutline,
isValidUrl,
} from '@kbn/presentation-util-plugin/common/lib';
} from '@kbn/presentation-util-plugin/common';
import { ExpressionRevealImageFunction, Origin, Position } from '../types';
import { BASE64, URL } from '../constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { useRef, useState, useEffect, useCallback } from 'react';
import { useResizeObserver } from '@elastic/eui';
import { IInterpreterRenderHandlers } from '@kbn/expressions-plugin/common';
import { css, CSSObject } from '@emotion/react';
import { isValidUrl } from '@kbn/presentation-util-plugin/public';
import { isValidUrl } from '@kbn/presentation-util-plugin/common';
import { NodeDimensions, RevealImageRendererConfig, OriginString } from '../../common/types';

const revealImageParentStyle = css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import React from 'react';
import { storiesOf } from '@storybook/react';
import { getElasticOutline, getElasticLogo } from '@kbn/presentation-util-plugin/public';
import { getElasticOutline, getElasticLogo } from '@kbn/presentation-util-plugin/common';
import { Render, waitFor } from '@kbn/presentation-util-plugin/public/__stories__';
import { getRevealImageRenderer } from '..';
import { Origin } from '../../../common/types/expression_functions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
import { i18n } from '@kbn/i18n';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { RevealImageRendererConfig } from '../../common/types';

export const strings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { ExecutionContext } from '@kbn/expressions-plugin/common';
import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common';
import { progressFunction, errors } from './progress_function';

describe('progress', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@kbn/i18n-react';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { CoreSetup } from '@kbn/core/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { ProgressRendererConfig } from '../../common/types';
import { LazyProgressComponent } from '../components/progress';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
import { i18n } from '@kbn/i18n';
import { CoreSetup } from '@kbn/core/public';
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { withSuspense, defaultTheme$ } from '@kbn/presentation-util-plugin/public';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { ShapeRendererConfig } from '../../common/types';
import { LazyShapeComponent } from '../components/shape';

Expand Down
34 changes: 30 additions & 4 deletions src/plugins/presentation_util/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* Side Public License, v 1.
*/

// TODO: https://github.com/elastic/kibana/issues/110893
/* eslint-disable @kbn/eslint/no_export_all */
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome!


export const PLUGIN_ID = 'presentationUtil';
export const PLUGIN_NAME = 'presentationUtil';

Expand All @@ -18,4 +15,33 @@ export const PLUGIN_NAME = 'presentationUtil';
*/
export const EXPRESSIONS_LANGUAGE_ID = 'kibana-expressions';

export * from './labs';
export type {
EnvironmentName,
EnvironmentStatus,
Project,
ProjectConfig,
ProjectID,
ProjectStatus,
SolutionName,
} from './labs';

export {
LABS_PROJECT_PREFIX,
environmentNames,
projectIDs,
projects,
getProjectIDs,
isProjectEnabledByStatus,
} from './labs';

export {
defaultTheme$,
getElasticLogo,
fontStyle,
functionWrapper,
getElasticOutline,
isValidUrl,
resolveWithMissingImage,
encode,
parseDataUrl,
} from './lib';
Copy link
Member Author

@nickpeihl nickpeihl Nov 18, 2022

Choose a reason for hiding this comment

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

I'm unsure about exporting these modules from common/index.ts. It might not be necessary since, unlike the public and server directories, other plugins can import deeply from common directories (ex. import { fontStyle } from '@kbn/presentation-util-plugin/common/lib). But maybe it's better practice to publish these modules from the top level of common as we do with public and server?

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally like this approach a lot. I'm not sure why common is considered an exception to this deep imports rule.

2 changes: 1 addition & 1 deletion src/plugins/presentation_util/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"extraPublicDirs": ["common/lib"],
"extraPublicDirs": ["common"],
"requiredPlugins": ["savedObjects", "kibanaReact", "embeddable", "expressions", "dataViews"],
"optionalPlugins": []
}
12 changes: 5 additions & 7 deletions src/plugins/presentation_util/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* Side Public License, v 1.
*/

// TODO: https://github.com/elastic/kibana/issues/110893
/* eslint-disable @kbn/eslint/no_export_all */

import { ExpressionFunction } from '@kbn/expressions-plugin/common';
import { PresentationUtilPlugin } from './plugin';
import { pluginServices } from './services';
Expand All @@ -29,9 +26,6 @@ export { PluginServices, PluginServiceProvider, PluginServiceRegistry } from './

export type { PresentationUtilPluginSetup, PresentationUtilPluginStart } from './types';
export type { SaveModalDashboardProps } from './components/types';
export type { ProjectID, Project } from '../common/labs';
export { projectIDs } from '../common/labs';
export * from '../common/lib';

export {
LazyExpressionInput,
Expand All @@ -53,7 +47,11 @@ export {
type ReduxEmbeddablePackage,
} from './redux_embeddables';

export * from './components/types';
export type {
ExpressionInputEditorRef,
ExpressionInputProps,
OnExpressionInputEditorDidMount,
} from './components/types';

/** @deprecated QuickButtonProps - use `IconButtonGroupProps` from `@kbn/shared-ux-button-toolbar` */
export type { QuickButtonProps } from './components/solution_toolbar';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/presentation_util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"emitDeclarationOnly": true,
"declaration": true,
},
"extraPublicDirs": ["common"],
"include": [
"common/**/*",
"public/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper, fontStyle } from '@kbn/presentation-util-plugin/common';
import { testTable } from '../common/__fixtures__/test_tables';
import { markdown } from './markdown';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { getElasticLogo } from '@kbn/presentation-util-plugin/common/lib';
import { getElasticLogo } from '@kbn/presentation-util-plugin/common';

export const fontStyle = {
type: 'style',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { all } from './all';

describe('all', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { getFunctionErrors } from '../../../i18n';
import { emptyTable, testTable } from './__fixtures__/test_tables';
import { alterColumn } from './alterColumn';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { any } from './any';

describe('any', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { asFn } from './as';

describe('as', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { getFunctionErrors } from '../../../i18n';
import { testTable } from './__fixtures__/test_tables';
import { axisConfig } from './axisConfig';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { of } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { caseFn } from './case';

describe('case', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { testTable } from './__fixtures__/test_tables';
import { clear } from './clear';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { emptyTable, testTable } from './__fixtures__/test_tables';
import { columns } from './columns';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { functionWrapper } from '@kbn/presentation-util-plugin/common/lib';
import { functionWrapper } from '@kbn/presentation-util-plugin/common';
import { getFunctionErrors } from '../../../i18n';
import { compare } from './compare';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common';
import { isValidUrl } from '@kbn/presentation-util-plugin/common/lib';
import { isValidUrl } from '@kbn/presentation-util-plugin/common';
import { ContainerStyle, Overflow, BackgroundRepeat, BackgroundSize } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

Expand Down
Loading